erc2018i

    0

    0

    lucycodes42

    Solidity Code Snippets

    The ClearableToken interface looks much like a traditional ERC20 token, with a few additions. The ClearableToken interface has an orderTransfer() function that allows users to order a transfer of tokens from one account to another. The orderTransferFrom() function allows users to order a transfer from one account to another. The cancelTransfer() function allows a user to cancel a previously placed order for a transfer. The processClearableTransfer() function allows a user to process a previously placed order for a transfer. The executeClearableTransfer() function allows a user to execute a previously placed order for a transfer. The rejectClearableTransfer() function allows a user to reject a previously placed order for a transfer. The retrieveClearableTransferData() function allows a user to view all information associated with a transfer. Finally, the authorizeClearableTransferOperator() function allows a user to authorize another user to be the clearable transfer operator. The revokeClearableTransferOperator() function allows a user to revoke the authorization of a previously authorized clearable transfer operator. The isClearableTransferOperatorFor() function allows a user to view if they are the clearable transfer operator for a given account and operation.

    Shortcut: erc2018i_draft

    // https://eips.ethereum.org/EIPS/eip-2018
    // https://github.com/IoBuilders/clearable-token (example)
    // SPDX-License-Identifier: MIT
    /*
    In banking and finance, clearing denotes all activities from the time a commitment is made for a transaction until it is settled
    
    The clearing process turns the promise of a transfer into the actual movement of money from one account to another.
    A clearing agent decides if the transfer can be executed or not.
    The amount which should be transferred is not deducted from the balance of the payer, but neither is it available for another transfer and therefore ensures,
    that the execution of the transfer will be successful when it is executed.
    */
    pragma solidity >=0.5.0 <0.8.0;
    
    interface ClearableToken /* is ERC-1996 */ {
        enum ClearableTransferStatusCode { Nonexistent, Ordered, InProcess, Executed, Rejected, Cancelled }
    
        function orderTransfer(string calldata operationId, address to, uint256 value) external returns (bool);
        function orderTransferFrom(string calldata operationId, address from, address to, uint256 value) external returns (bool);
        function cancelTransfer(string calldata operationId) external returns (bool);
        function processClearableTransfer(string calldata operationId) external returns (bool);
        function executeClearableTransfer(string calldata operationId) external returns (bool);
        function rejectClearableTransfer(string calldata operationId, string calldata reason) external returns (bool);
        function retrieveClearableTransferData(string calldata operationId) external view returns (address from, address to,
                                                    uint256 value, ClearableTransferStatusCode status);
    
        function authorizeClearableTransferOperator(address operator) external returns (bool);
        function revokeClearableTransferOperator(address operator) external returns (bool);
        function isClearableTransferOperatorFor(address operator, address from) external view returns (bool);
    
        event ClearableTransferOrdered(address indexed orderer, string operationId, address indexed from, address indexed to, uint256 value);
        event ClearableTransferInProcess(address indexed orderer, string operationId);
        event ClearableTransferExecuted(address indexed orderer, string operationId);
        event ClearableTransferRejected(address indexed orderer, string operationId, string reason);
        event ClearableTransferCancelled(address indexed orderer, string operationId);
        event AuthorizedClearableTransferOperator(address indexed operator, address indexed account);
        event RevokedClearableTransferOperator(address indexed operator, address indexed account);
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.