ETH Price: $2,633.00 (-1.23%)

Contract

0xC413f5a641A0cb1057b8FC3a706a6e2Af5b8E3eF
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Decrease Positio...139078572021-12-30 16:49:301004 days ago1640882970IN
0xC413f5a6...Af5b8E3eF
0 ETH0.24258926102.19599199

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
133740402021-10-07 20:46:451088 days ago1633639605  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FoldingAccount

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 3 : FoldingAccount.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import '../modules/FoldingAccount/FoldingAccountStorage.sol';
import './interfaces/IFoldingConnectorProvider.sol';

contract FoldingAccount is FoldingAccountStorage {
    constructor(address foldingRegistry, address nft) public {
        AccountStore storage store = aStore();

        store.foldingRegistry = foldingRegistry;
        store.nft = nft;
    }

    /// @notice Find the connector for `msg.sig` and delegate call it with `msg.data`
    function delegate() private {
        bool firstCall = false; // We need to delete the entryCaller on exit

        AccountStore storage accountStorage = aStore();
        if (accountStorage.entryCaller == address(0)) {
            accountStorage.entryCaller = msg.sender;
            firstCall = true;
        }
        // Check if a connector expects a callback or find connector
        address impl = accountStorage.callbackTarget;
        if (impl != address(0)) {
            require(accountStorage.expectedCallbackSig == msg.sig, 'FA1');
        } else {
            impl = IFoldingConnectorProvider(accountStorage.foldingRegistry).getImplementation(msg.sig);
        }

        /// @dev This assembly code returns directly to caller
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(0, 0, size)
            switch result
            case 0 {
                revert(0, size)
            }
            default {
                /// @dev if this is the first call, set the entryCaller to 0
                if firstCall {
                    sstore(accountStorage_slot, 0)
                }
                return(0, size)
            }
        }
    }

    fallback() external payable {
        if (msg.sig != bytes4(0)) delegate();
    }
}

File 2 of 3 : FoldingAccountStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

contract FoldingAccountStorage {
    bytes32 constant ACCOUNT_STORAGE_POSITION = keccak256('folding.account.storage');

    /**
     * entryCaller:         address of the caller of the account, during a transaction
     *
     * callbackTarget:      address of logic to be run when expecting a callback
     *
     * expectedCallbackSig: signature of function to be run when expecting a callback
     *
     * foldingRegistry      address of factory creating FoldingAccount
     *
     * nft:                 address of the nft contract.
     *
     * owner:               address of the owner of this FoldingAccount.
     */
    struct AccountStore {
        address entryCaller;
        address callbackTarget;
        bytes4 expectedCallbackSig;
        address foldingRegistry;
        address nft;
        address owner;
    }

    modifier onlyAccountOwner() {
        AccountStore storage s = aStore();
        require(s.entryCaller == s.owner, 'FA2');
        _;
    }

    modifier onlyNFTContract() {
        AccountStore storage s = aStore();
        require(s.entryCaller == s.nft, 'FA3');
        _;
    }

    modifier onlyAccountOwnerOrRegistry() {
        AccountStore storage s = aStore();
        require(s.entryCaller == s.owner || s.entryCaller == s.foldingRegistry, 'FA4');
        _;
    }

    function aStore() internal pure returns (AccountStore storage s) {
        bytes32 position = ACCOUNT_STORAGE_POSITION;
        assembly {
            s_slot := position
        }
    }

    function accountOwner() internal view returns (address) {
        return aStore().owner;
    }
}

File 3 of 3 : IFoldingConnectorProvider.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

interface IFoldingConnectorProvider {
    function getImplementation(bytes4 functionSignature) external view returns (address implementation);
}

Settings
{
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"foldingRegistry","type":"address"},{"internalType":"address","name":"nft","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"}]

608060405234801561001057600080fd5b506040516106a03803806106a083398181016040528101906100329190610114565b60006100426100d260201b60201c565b9050828160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050610199565b6000807fadbb89e904f74d44d0d104c851da4f2fa24de8f1dee64f038923bb940f37d53a90508091505090565b60008151905061010e81610182565b92915050565b6000806040838503121561012757600080fd5b6000610135858286016100ff565b9250506020610146858286016100ff565b9150509250929050565b600061015b82610162565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b61018b81610150565b811461019657600080fd5b50565b6104f8806101a86000396000f3fe6080604052600060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166000357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461007a5761007961007c565b5b005b600080610087610347565b9050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561012a57338160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600191505b60008160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610241576000357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168260010160149054906101000a900460e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461023c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102339061041c565b60405180910390fd5b610315565b8160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc9cc6456000357fffffffff00000000000000000000000000000000000000000000000000000000166040518263ffffffff1660e01b81526004016102c29190610401565b60206040518083038186803b1580156102da57600080fd5b505afa1580156102ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103129190610389565b90505b3660008037600080366000845af43d806000803e816000811461034257851561033d57600085555b816000f35b816000fd5b6000807fadbb89e904f74d44d0d104c851da4f2fa24de8f1dee64f038923bb940f37d53a90508091505090565b600081519050610383816104ab565b92915050565b60006020828403121561039b57600080fd5b60006103a984828501610374565b91505092915050565b6103bb8161045f565b82525050565b60006103ce60038361043c565b91507f46413100000000000000000000000000000000000000000000000000000000006000830152602082019050919050565b600060208201905061041660008301846103b2565b92915050565b60006020820190508181036000830152610435816103c1565b9050919050565b600082825260208201905092915050565b60006104588261048b565b9050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6104b48161044d565b81146104bf57600080fd5b5056fea2646970667358221220878340752fc061c9df1d7ce21d54bbc2320033737c1eb7d202f3e974f3dc49c864736f6c634300060c0033000000000000000000000000ec6b351778aaa2349a8726b4837e05232ef20d03000000000000000000000000b410075e1e13c182475b2d0ece9445f2710ab197

Deployed Bytecode

0x6080604052600060e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166000357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461007a5761007961007c565b5b005b600080610087610347565b9050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561012a57338160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600191505b60008160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610241576000357fffffffff00000000000000000000000000000000000000000000000000000000167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168260010160149054906101000a900460e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461023c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102339061041c565b60405180910390fd5b610315565b8160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc9cc6456000357fffffffff00000000000000000000000000000000000000000000000000000000166040518263ffffffff1660e01b81526004016102c29190610401565b60206040518083038186803b1580156102da57600080fd5b505afa1580156102ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103129190610389565b90505b3660008037600080366000845af43d806000803e816000811461034257851561033d57600085555b816000f35b816000fd5b6000807fadbb89e904f74d44d0d104c851da4f2fa24de8f1dee64f038923bb940f37d53a90508091505090565b600081519050610383816104ab565b92915050565b60006020828403121561039b57600080fd5b60006103a984828501610374565b91505092915050565b6103bb8161045f565b82525050565b60006103ce60038361043c565b91507f46413100000000000000000000000000000000000000000000000000000000006000830152602082019050919050565b600060208201905061041660008301846103b2565b92915050565b60006020820190508181036000830152610435816103c1565b9050919050565b600082825260208201905092915050565b60006104588261048b565b9050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6104b48161044d565b81146104bf57600080fd5b5056fea2646970667358221220878340752fc061c9df1d7ce21d54bbc2320033737c1eb7d202f3e974f3dc49c864736f6c634300060c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000ec6b351778aaa2349a8726b4837e05232ef20d03000000000000000000000000b410075e1e13c182475b2d0ece9445f2710ab197

-----Decoded View---------------
Arg [0] : foldingRegistry (address): 0xEc6b351778aAA2349a8726B4837e05232ef20d03
Arg [1] : nft (address): 0xB410075E1E13c182475b2D0Ece9445f2710AB197

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ec6b351778aaa2349a8726b4837e05232ef20d03
Arg [1] : 000000000000000000000000b410075e1e13c182475b2d0ece9445f2710ab197


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.