Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-md committed Oct 21, 2024
1 parent d086426 commit a81b921
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pages/reference-smart-account/owners/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"addOwnerWithThreshold": "addOwnerWithThreshold",
"changeThreshold": "changeThreshold",
"getThreshold": "getThreshold",
"getOwners": "getOwners",
"getThreshold": "getThreshold",
"isOwner": "isOwner",
"removeOwner": "removeOwner",
"swapOwner": "swapOwner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This can only be done via a Safe transaction.
}
contract Example {
function example() {
function example() ... {
(ISafe safe).addOwnerWithThreshold(
"0x...",
1
Expand Down
8 changes: 8 additions & 0 deletions pages/reference-smart-account/owners/changeThreshold.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ This can only be done via a Safe transaction.
interface ISafe {
function changeThreshold(uint256 _threshold) external
}
contract Example {
function example() ... {
(ISafe safe).changeThreshold(
1
)
}
}
```
</Tabs.Tab>
</Tabs>
Expand Down
13 changes: 5 additions & 8 deletions pages/reference-smart-account/owners/getThreshold.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import { Tabs } from "nextra/components"

# `getThreshold`

## Overview

```solidity
function getThreshold() external view returns (uint256)
```

Returns the number of required confirmations for a Safe transaction aka the threshold.

## Usage
Expand All @@ -17,8 +10,12 @@ Returns the number of required confirmations for a Safe transaction aka the thre
<Tabs items={['example.sol']}>
<Tabs.Tab>
```solidity
interface ISafe {
function getThreshold() external view returns (uint256)
}
contract Example {
function example() {
function example() ... {
(uint256 threshold) = (ISafe safe).getThreshold(); // 1
}
}
Expand Down
4 changes: 4 additions & 0 deletions pages/reference-smart-account/owners/isOwner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Returns if `owner` is an owner of the Safe.
<Tabs items={['example.sol']}>
<Tabs.Tab>
```solidity
interface ISafe {
function isOwner(address owner) external view returns (bool)
}
contract Example {
function example() … {
(bool isOwner) = (ISafe safe).isOwner("0x..."); // true
Expand Down
28 changes: 26 additions & 2 deletions pages/reference-smart-account/owners/removeOwner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This can only be done via a Safe transaction.

<Tabs items={['example.sol']}>
<Tabs.Tab>
```solidity
```solidity
interface ISafe {
function removeOwner(address prevOwner, address owner, uint256 _threshold) external
}
Expand All @@ -30,7 +30,7 @@ This can only be done via a Safe transaction.
)
}
}
```
```
</Tabs.Tab>
</Tabs>

Expand All @@ -43,18 +43,42 @@ This can only be done via a Safe transaction.

Owner that pointed to the owner to be removed in the linked list

```solidity focus=2
removeOwner(
"0x...",
"0x...",
1
)
```

### `owner`

- **Type:** `address`

Owner address to be removed.

```solidity focus=3
removeOwner(
"0x...",
"0x...",
1
)
```

### `_threshold`

- **Type:** `uint256`

New threshold.

```solidity focus=4
removeOwner(
"0x...",
"0x...",
1
)
```

## Events

### `RemovedOwner`
Expand Down
33 changes: 28 additions & 5 deletions pages/reference-smart-account/owners/swapOwner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { Tabs, Callout } from "nextra/components"

# `swapOwner`

```solidity
function swapOwner(address prevOwner, address oldOwner, address newOwner) external
```

Replaces the owner `oldOwner` in the Safe with `newOwner`.

<Callout type="warning">
Expand All @@ -20,6 +15,10 @@ This can only be done via a Safe transaction.
<Tabs items={['example.sol']}>
<Tabs.Tab>
```solidity
interface ISafe {
function swapOwner(address prevOwner, address oldOwner, address newOwner) external
}
contract Example {
function example() … {
(ISafe safe).swapOwner("0x...", "0x...", "0x...");
Expand All @@ -37,16 +36,40 @@ This can only be done via a Safe transaction.

Owner that pointed to the owner to be replaced in the linked list

```solidity focus=2
swapOwner(
"0x...",
"0x...",
"0x..."
)
```

### `oldOwner`
- **Type:** `address`

Owner address to be replaced.

```solidity focus=3
swapOwner(
"0x...",
"0x...",
"0x..."
)
```

### `newOwner`
- **Type:** `address`

New owner address.

```solidity focus=4
swapOwner(
"0x...",
"0x...",
"0x..."
)
```

## Events

### [`AddedOwner`](./addOwnerWithThreshold.mdx#addedowner)
Expand Down

0 comments on commit a81b921

Please sign in to comment.