From 06b26949f4822b6d88ed7fa8bdc5973bccde3487 Mon Sep 17 00:00:00 2001 From: Oleksii Matiiasevych Date: Fri, 20 Sep 2024 16:21:39 +0700 Subject: [PATCH 1/2] Add docs --- contracts/handlers/DefaultMessageReceiver.sol | 26 ++++++++++++++----- contracts/handlers/ERC20Handler.sol | 1 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/contracts/handlers/DefaultMessageReceiver.sol b/contracts/handlers/DefaultMessageReceiver.sol index 70537d01..22665d1c 100644 --- a/contracts/handlers/DefaultMessageReceiver.sol +++ b/contracts/handlers/DefaultMessageReceiver.sol @@ -8,6 +8,10 @@ import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "../utils/AccessControl.sol"; import "../interfaces/ISygmaMessageReceiver.sol"; +/** + @title Optinal Message Call made as part of other handlers proposal execution. + @author ChainSafe Systems. + */ contract DefaultMessageReceiver is ISygmaMessageReceiver, AccessControl, ERC721Holder, ERC1155Holder { bytes32 public constant SYGMA_HANDLER_ROLE = keccak256("SYGMA_HANDLER_ROLE"); @@ -45,10 +49,10 @@ contract DefaultMessageReceiver is ISygmaMessageReceiver, AccessControl, ERC721H uint256 amount ); - /// Constructor /// - - /// @param sygmaHandlers The contract addresses with access to message processing. - /// @param recoverGas The amount of gas needed to forward the original amount to receiver. + /** + @param sygmaHandlers The contract addresses with access to message processing. + @param recoverGas The amount of gas needed to forward the original amount to receiver. + */ constructor(address[] memory sygmaHandlers, uint256 recoverGas) { _recoverGas = recoverGas; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); @@ -68,6 +72,12 @@ contract DefaultMessageReceiver is ISygmaMessageReceiver, AccessControl, ERC721H specified in this particular Action.tokenReceive property. In such a case it is a users responsibility to either send it all with a transferBalanceAction() Action or to include an extra action[s] with tokenReceive set to each of the tokens received. + @param tokenSent Optional address of the token sent along or prior to calling this function. + @param amount Amount of the token sent along or prior to calling this function. + @param message User generated execution command which consists of + {transactionId} an arbitrary identifier. + {actions} array of Action items that allow generic logic execution. + {receiver} a fallback address that will receive any leftovers after either success of fail. */ function handleSygmaMessage( address tokenSent, @@ -183,8 +193,12 @@ contract DefaultMessageReceiver is ISygmaMessageReceiver, AccessControl, ERC721H } } - /// @notice Helper function that could be used as an Action to itself to transfer whole - /// @notice balance of a particular token. + /** + @notice Helper function that could be used as an Action to itself to transfer whole + balance of a particular token. + @param token Address of the ERC20 token or 0x0 for native token. + @param receiver Address that should receive the whole balance. + */ function transferBalanceAction(address token, address receiver) external { if (msg.sender != address(this)) revert InsufficientPermission(); if (token != zeroAddress) { diff --git a/contracts/handlers/ERC20Handler.sol b/contracts/handlers/ERC20Handler.sol index d9ffc350..73cb070a 100644 --- a/contracts/handlers/ERC20Handler.sol +++ b/contracts/handlers/ERC20Handler.sol @@ -21,6 +21,7 @@ contract ERC20Handler is IHandler, ERCHandlerHelpers, DepositDataHelper, ERC20Sa /** @param bridgeAddress Contract address of previously deployed Bridge. + @param defaultMessageReceiver Contract address of previously deployed DefaultMessageReceiver. */ constructor( address bridgeAddress, From ee19c6fa7c1311a2f09513f952b643fd9db45a7d Mon Sep 17 00:00:00 2001 From: Oleksii Matiiasevych Date: Fri, 20 Sep 2024 16:25:39 +0700 Subject: [PATCH 2/2] Add stab commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a995837f..398572ff 100644 --- a/README.md +++ b/README.md @@ -47,4 +47,4 @@ Please email us a description of the flaw and any related information (e.g. repr [dev@buildwithsygma.com](mailto:dev@buildwithsygma.com). ## Audits -You can find audit reports inside [`/audits`](./audits/) \ No newline at end of file +You can find audit reports inside [`/audits`](./audits/)