erc2019i

    0

    0

    lucycodes42

    Solidity Code Snippets

    interface IFundableContract {

    address orderer;

    bool isFundOperatorFor(address walletToFund, address orderer);

    bool retrieveFundData(address orderer, string calldata operationId);

    bool processFund(string calldata operationId);

    bool executeFund(string calldata operationId);

    bool rejectFund(string calldata operationId, string calldata reason);

    bool cancelFund(string calldata operationId);

    bool isFundOperatorFor(address walletToFund, address orderer, bool frozen);

    string memory instructions;

    uint256 value;

    }

    Shortcut: erc2019i_draft

    // https://eips.ethereum.org/EIPS/eip-2019
    // https://github.com/IoBuilders/fundable-token (example)
    // SPDX-License-Identifier: MIT
    /*
    An extension to the ERC-20 standard token that allows Token wallet owners to request a wallet to be funded, by calling the smart contract and attaching a fund instruction string.
    
    Token wallet owners (or approved addresses) can order tokenization requests through blockchain.
    This is done by calling the orderFund or orderFundFrom methods,
    which initiate the workflow for the token contract operator to either honor or reject the fund request.
    In this case, fund instructions are provided when submitting the request,
    which are used by the operator to determine the source of the funds to be debited in order to do fund the token wallet (through minting).
    */
    pragma solidity >=0.5.0 <0.8.0;
    
    interface IFundable /* is ERC-20 */ {
        enum FundStatusCode {
            Nonexistent,
            Ordered,
            InProcess,
            Executed,
            Rejected,
            Cancelled
        }
        function authorizeFundOperator(address orderer) external returns (bool);
        function revokeFundOperator(address orderer) external returns (bool) ;
        function orderFund(string calldata operationId, uint256 value, string calldata instructions) external returns (bool);
        function orderFundFrom(string calldata operationId, address walletToFund, uint256 value,
                                            string calldata instructions) external returns (bool);
        function cancelFund(string calldata operationId) external returns (bool);
        function processFund(string calldata operationId) external returns (bool);
        function executeFund(string calldata operationId) external returns (bool);
        function rejectFund(string calldata operationId, string calldata reason) external returns (bool);
    
        function isFundOperatorFor(address walletToFund, address orderer) external view returns (bool);
        function retrieveFundData(address orderer, string calldata operationId) external view returns (address walletToFund,
        uint256 value, string memory instructions, FundStatusCode status);
    
        event FundOrdered(address indexed orderer, string indexed operationId, address indexed , uint256 value, string instructions);
        event FundInProcess(address indexed orderer, string indexed operationId);
        event FundExecuted(address indexed orderer, string indexed operationId);
        event FundRejected(address indexed orderer, string indexed operationId, string reason);
        event FundCancelled(address indexed orderer, string indexed operationId);
        event FundOperatorAuthorized(address indexed walletToFund, address indexed orderer);
        event FundOperatorRevoked(address indexed walletToFund, address indexed orderer);
    }
    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.