Skip to content

Commit

Permalink
docs: update Markdown docs for LSP7
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Sep 21, 2023
1 parent 0710c74 commit 6dc7f4b
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 34 deletions.
6 changes: 0 additions & 6 deletions contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ pragma solidity ^0.8.4;
// modules
import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";

// errors
import {
LSP7AmountExceedsAuthorizedAmount,
LSP7CannotSendWithAddressZero
} from "../LSP7Errors.sol";

/**
* @title LSP7 token extension that allows token holders to destroy both
* their own tokens and those that they have an allowance for as an operator.
Expand Down
41 changes: 36 additions & 5 deletions docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ Atomically decreases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ------------------------------------------------------ |
| `operator` | `address` | the operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. |
| `operator` | `address` | The operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -392,8 +392,8 @@ Atomically increases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` | `address` | the operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance |
| `operator` | `address` | The operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -792,7 +792,7 @@ Save gas by emitting the [`DataChanged`](#datachanged) event with only the first
function _updateOperator(
address tokenOwner,
address operator,
uint256 amount,
uint256 allowance,
bytes operatorNotificationData
) internal nonpayable;
```
Expand All @@ -801,6 +801,15 @@ Changes token `amount` the `operator` has access to from `tokenOwner` tokens.
If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators.
If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified.

#### Parameters

| Name | Type | Description |
| -------------------------- | :-------: | -------------------------------------------------------------------------------------- |
| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. |
| `operator` | `address` | The address to grant an allowance to spend. |
| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. |
| `operatorNotificationData` | `bytes` | - |

<br/>

### \_mint
Expand Down Expand Up @@ -871,6 +880,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r

<br/>

### \_spendAllowance

```solidity
function _spendAllowance(
address operator,
address tokenOwner,
uint256 amountToSpend
) internal nonpayable;
```

Spend `amount` from the `operator`'s authorized on behalf of the `tokenOwner`.

#### Parameters

| Name | Type | Description |
| --------------- | :-------: | ------------------------------------------------------------------- |
| `operator` | `address` | The address of the operator to decrease the allowance of. |
| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. |
| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. |

<br/>

### \_transfer

```solidity
Expand Down
41 changes: 36 additions & 5 deletions docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ Atomically decreases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ------------------------------------------------------ |
| `operator` | `address` | the operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. |
| `operator` | `address` | The operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -417,8 +417,8 @@ Atomically increases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` | `address` | the operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance |
| `operator` | `address` | The operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -817,7 +817,7 @@ Save gas by emitting the [`DataChanged`](#datachanged) event with only the first
function _updateOperator(
address tokenOwner,
address operator,
uint256 amount,
uint256 allowance,
bytes operatorNotificationData
) internal nonpayable;
```
Expand All @@ -826,6 +826,15 @@ Changes token `amount` the `operator` has access to from `tokenOwner` tokens.
If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators.
If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified.

#### Parameters

| Name | Type | Description |
| -------------------------- | :-------: | -------------------------------------------------------------------------------------- |
| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. |
| `operator` | `address` | The address to grant an allowance to spend. |
| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. |
| `operatorNotificationData` | `bytes` | - |

<br/>

### \_mint
Expand Down Expand Up @@ -896,6 +905,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r

<br/>

### \_spendAllowance

```solidity
function _spendAllowance(
address operator,
address tokenOwner,
uint256 amountToSpend
) internal nonpayable;
```

Spend `amount` from the `operator`'s authorized on behalf of the `tokenOwner`.

#### Parameters

| Name | Type | Description |
| --------------- | :-------: | ------------------------------------------------------------------- |
| `operator` | `address` | The address of the operator to decrease the allowance of. |
| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. |
| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. |

<br/>

### \_transfer

```solidity
Expand Down
41 changes: 36 additions & 5 deletions docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ Atomically decreases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ------------------------------------------------------ |
| `operator` | `address` | the operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. |
| `operator` | `address` | The operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -390,8 +390,8 @@ Atomically increases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` | `address` | the operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance |
| `operator` | `address` | The operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -817,7 +817,7 @@ Save gas by emitting the [`DataChanged`](#datachanged) event with only the first
function _updateOperator(
address tokenOwner,
address operator,
uint256 amount,
uint256 allowance,
bytes operatorNotificationData
) internal nonpayable;
```
Expand All @@ -826,6 +826,15 @@ Changes token `amount` the `operator` has access to from `tokenOwner` tokens.
If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators.
If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified.

#### Parameters

| Name | Type | Description |
| -------------------------- | :-------: | -------------------------------------------------------------------------------------- |
| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. |
| `operator` | `address` | The address to grant an allowance to spend. |
| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. |
| `operatorNotificationData` | `bytes` | - |

<br/>

### \_mint
Expand Down Expand Up @@ -880,6 +889,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r

<br/>

### \_spendAllowance

```solidity
function _spendAllowance(
address operator,
address tokenOwner,
uint256 amountToSpend
) internal nonpayable;
```

Spend `amount` from the `operator`'s authorized on behalf of the `tokenOwner`.

#### Parameters

| Name | Type | Description |
| --------------- | :-------: | ------------------------------------------------------------------- |
| `operator` | `address` | The address of the operator to decrease the allowance of. |
| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. |
| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. |

<br/>

### \_transfer

```solidity
Expand Down
30 changes: 26 additions & 4 deletions docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ Atomically decreases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ------------------------------------------------------ |
| `operator` | `address` | the operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. |
| `operator` | `address` | The operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -456,8 +456,8 @@ Atomically increases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` | `address` | the operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance |
| `operator` | `address` | The operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -1012,6 +1012,28 @@ function _burn(address from, uint256 amount, bytes data) internal nonpayable;

<br/>

### \_spendAllowance

```solidity
function _spendAllowance(
address operator,
address tokenOwner,
uint256 amountToSpend
) internal nonpayable;
```

Spend `amount` from the `operator`'s authorized on behalf of the `tokenOwner`.

#### Parameters

| Name | Type | Description |
| --------------- | :-------: | ------------------------------------------------------------------- |
| `operator` | `address` | The address of the operator to decrease the allowance of. |
| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. |
| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. |

<br/>

### \_transfer

```solidity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ Atomically decreases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ------------------------------------------------------ |
| `operator` | `address` | the operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | the amount to decrease by in the operator's allowance. |
| `operator` | `address` | The operator to decrease allowance for `msg.sender` |
| `substractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -461,8 +461,8 @@ Atomically increases the allowance granted to `operator` by the caller. This is

| Name | Type | Description |
| -------------------------- | :-------: | ----------------------------------------------------------------------- |
| `operator` | `address` | the operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | the additional amount to add on top of the current operator's allowance |
| `operator` | `address` | The operator to increase the allowance for `msg.sender` |
| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance |
| `operatorNotificationData` | `bytes` | - |

<br/>
Expand Down Expand Up @@ -1050,6 +1050,28 @@ function _burn(address from, uint256 amount, bytes data) internal nonpayable;

<br/>

### \_spendAllowance

```solidity
function _spendAllowance(
address operator,
address tokenOwner,
uint256 amountToSpend
) internal nonpayable;
```

Spend `amount` from the `operator`'s authorized on behalf of the `tokenOwner`.

#### Parameters

| Name | Type | Description |
| --------------- | :-------: | ------------------------------------------------------------------- |
| `operator` | `address` | The address of the operator to decrease the allowance of. |
| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. |
| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. |

<br/>

### \_transfer

```solidity
Expand Down
Loading

0 comments on commit 6dc7f4b

Please sign in to comment.