From 6dc7f4b64f70e808053da420d3e603b78c44606c Mon Sep 17 00:00:00 2001 From: CJ42 Date: Thu, 21 Sep 2023 10:16:26 +0100 Subject: [PATCH] docs: update Markdown docs for LSP7 --- .../extensions/LSP7Burnable.sol | 6 --- .../LSP7DigitalAsset/LSP7DigitalAsset.md | 41 ++++++++++++++++--- .../extensions/LSP7Burnable.md | 41 ++++++++++++++++--- .../extensions/LSP7CappedSupply.md | 41 ++++++++++++++++--- .../extensions/LSP7CompatibleERC20.md | 30 ++++++++++++-- .../presets/LSP7CompatibleERC20Mintable.md | 30 ++++++++++++-- .../LSP7DigitalAsset/presets/LSP7Mintable.md | 41 ++++++++++++++++--- 7 files changed, 196 insertions(+), 34 deletions(-) diff --git a/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol b/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol index 58e819169..dc01771da 100644 --- a/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +++ b/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol @@ -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. diff --git a/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md b/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md index be60e15ab..832baa130 100644 --- a/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md +++ b/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md @@ -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` | - |
@@ -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` | - |
@@ -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; ``` @@ -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` | - | +
### \_mint @@ -871,6 +880,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r
+### \_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`. | + +
+ ### \_transfer ```solidity diff --git a/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md index 4b9ae506f..99198e9c7 100644 --- a/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md +++ b/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -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` | - |
@@ -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` | - |
@@ -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; ``` @@ -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` | - | +
### \_mint @@ -896,6 +905,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r
+### \_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`. | + +
+ ### \_transfer ```solidity diff --git a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md index 79ecb62fb..c61290f00 100644 --- a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md +++ b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -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` | - |
@@ -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` | - |
@@ -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; ``` @@ -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` | - | +
### \_mint @@ -880,6 +889,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r
+### \_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`. | + +
+ ### \_transfer ```solidity diff --git a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md index 5add8d3b5..cb0d1c26d 100644 --- a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md +++ b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md @@ -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` | - |
@@ -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` | - |
@@ -1012,6 +1012,28 @@ function _burn(address from, uint256 amount, bytes data) internal nonpayable;
+### \_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`. | + +
+ ### \_transfer ```solidity diff --git a/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md b/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md index 052cc44df..641a96381 100644 --- a/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md +++ b/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md @@ -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` | - |
@@ -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` | - |
@@ -1050,6 +1050,28 @@ function _burn(address from, uint256 amount, bytes data) internal nonpayable;
+### \_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`. | + +
+ ### \_transfer ```solidity diff --git a/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md index 7be6c980c..36818291e 100644 --- a/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md +++ b/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -266,8 +266,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` | - |
@@ -421,8 +421,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` | - |
@@ -854,7 +854,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; ``` @@ -863,6 +863,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` | - | +
### \_mint @@ -933,6 +942,28 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r
+### \_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`. | + +
+ ### \_transfer ```solidity