Skip to content

Commit

Permalink
docs: update LSP0 Natspec
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Aug 23, 2023
1 parent b8bb000 commit b31d3af
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 33 deletions.
2 changes: 1 addition & 1 deletion contracts/LSP0ERC725Account/ILSP0ERC725Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {ILSP14Ownable2Step} from "../LSP14Ownable2Step/ILSP14Ownable2Step.sol";
*/
interface ILSP0ERC725Account {
/**
* @dev Emitted when receiving native tokens.
* @notice `value` native tokens received from `sender`.
* @dev Emitted when receiving native tokens.
* @param sender The address that sent some native tokens to this contract.
* @param value The amount of native tokens received.
*/
Expand Down
25 changes: 10 additions & 15 deletions contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ abstract contract LSP0ERC725AccountCore is
* - If the operation type is `STATICCALL` (3) or `DELEGATECALL` (4), `value` transfer is disallowed and must be 0.
*
* @custom:events
* - {Executed} event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). (each iteration)
* - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2) (each iteration)
* - {Executed} event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4).
* - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2).
* - {ValueReceived} event when receiving native tokens.
*/
function execute(
Expand Down Expand Up @@ -621,7 +621,7 @@ abstract contract LSP0ERC725AccountCore is
}

/**
* @notice Checking if this contract supports the interface defined by the bytes4 interface ID `interfaceId`.
* @notice Checking if this contract supports the interface defined by the `bytes4` interface ID `interfaceId`.
*
* @dev Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-ContractExtension] by
* checking if the interfaceId being queried is supported on another linked extension.
Expand Down Expand Up @@ -723,15 +723,11 @@ abstract contract LSP0ERC725AccountCore is
/**
* @dev Forwards the call to an extension mapped to a function selector.
*
* Calls {_getExtension} to get the address of the extension mapped to the function selector being
* called on the account. If there is no extension, the `address(0)` will be returned.
* Calls {_getExtension} to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned.
*
* Reverts if there is no extension for the function being called, except for the bytes4(0) function
* selector, which passes even if there is no extension for it.
* Reverts if there is no extension for the function being called, except for the bytes4(0) function selector, which passes even if there is no extension for it.
*
* If there is an extension for the function selector being called, it calls the extension with the
* CALL opcode, passing the `msg.data` appended with the 20 bytes of the `msg.sender` and
* 32 bytes of the `msg.value`
* If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the `msg.data` appended with the 20 bytes of the `msg.sender` and 32 bytes of the `msg.value`
*/
function _fallbackLSP17Extendable(
bytes calldata callData
Expand Down Expand Up @@ -764,9 +760,8 @@ abstract contract LSP0ERC725AccountCore is

/**
* @dev Returns the extension address stored under the following data key:
* {_LSP17_EXTENSION_PREFIX + <bytes4>} (Check [LSP2-ERC725YJSONSchema] for encoding the data key)
*
* If no extension is stored, returns the address(0)
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
* - If no extension is stored, returns the address(0).
*/
function _getExtension(
bytes4 functionSelector
Expand All @@ -786,10 +781,10 @@ abstract contract LSP0ERC725AccountCore is
}

/**
* @custom:events {DataChanged} event with only the first 256 bytes of {dataValue}.
*
* @dev This function overrides the {ERC725YCore} internal {_setData} function to optimize gas usage by emitting only the first 256 bytes of the `dataValue`.
*
* @custom:events {DataChanged} event with only the first 256 bytes of {dataValue}.
*
* @param dataKey The key to store the data value under.
* @param dataValue The data value to be stored.
*/
Expand Down
18 changes: 8 additions & 10 deletions contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,22 @@ import {
contract LSP0ERC725AccountInit is LSP0ERC725AccountInitAbstract {
/**
* @notice deploying a `LSP0ERC725AccountInit` base contract to be used behind proxy
* @dev Locks the base contract on deployment, so that it cannot be initialized, owned and controlled by anyone
* after it has been deployed. This is intended so that the sole purpose of this contract is to be used as a base
* contract behind a proxy.
* @dev Locks the base contract on deployment, so that it cannot be initialized, owned and controlled by anyone after it has been deployed. This is intended so that the sole purpose of this contract is to be used as a base contract behind a proxy.
*/
constructor() {
_disableInitializers();
}

/**
* @notice Initializing the contract owner to: `initialOwner`
* @dev Set `initialOwner` as the contract owner.
* The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier.
* The `initialize(address)` function also allows funding the contract on initialization.
* @notice Initializing a LSP0ERC725Account contract with owner set to address `initialOwner`.
*
* Emitted Events:
* - ValueReceived: when the contract is funded on initialization.
* @dev Set `initialOwner` as the contract owner. The `initialize(address)` also allows funding the contract on deployment.
*
* @param initialOwner the owner of the contract
* @param initialOwner The owner of the contract.
*
* @custom:events
* - {ValueReceived} event when funding the contract on deployment.
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
*/
function initialize(
address initialOwner
Expand Down
14 changes: 7 additions & 7 deletions contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ abstract contract LSP0ERC725AccountInitAbstract is
LSP0ERC725AccountCore
{
/**
* @dev Set `initialOwner` as the contract owner. ERC725X & ERC725Y parent contracts
* are not initialised as they don't have non-zero initial state.
* If you decide to add non-zero initial state to any of those
* contracts, you MUST initialize them here
* @dev Set `initialOwner` as the contract owner.
*
* Emitted Events:
* - ValueReceived: if the transaction that triggered this internal `_initialize` function contained some `msg.value`.
* @param initialOwner The owner of the contract.
*
* @param initialOwner the owner of the contract
* @custom:warning ERC725X & ERC725Y parent contracts are not initialised as they don't have non-zero initial state. If you decide to add non-zero initial state to any of those contracts, you must initialize them here.
*
* @custom:events
* - {ValueReceived} event when funding the contract on deployment.
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
*/
function _initialize(
address initialOwner
Expand Down

0 comments on commit b31d3af

Please sign in to comment.