ETH Price: $3,407.49 (+1.49%)

Contract

0x7ec46976F861F165c4b7336781343b02d473F437
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Decrease Positio...144171542022-03-19 13:34:52983 days ago1647696892IN
0x7ec46976...2d473F437
0 ETH0.0379305527.17586701
Configure Stop L...139902812022-01-12 10:51:221049 days ago1641984682IN
0x7ec46976...2d473F437
0 ETH0.0304978116.83996371

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
139080462021-12-30 17:32:341062 days ago1640885554  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FoldingAccount

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 9999 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) public {
        aStore().foldingRegistry = foldingRegistry;
    }

    /// @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": true,
    "runs": 9999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

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

608060405234801561001057600080fd5b506040516103f63803806103f683398101604081905261002f91610083565b8061003861005f565b60020180546001600160a01b0319166001600160a01b0392909216919091179055506100b1565b7fadbb89e904f74d44d0d104c851da4f2fa24de8f1dee64f038923bb940f37d53a90565b600060208284031215610094578081fd5b81516001600160a01b03811681146100aa578182fd5b9392505050565b610336806100c06000396000f3fe60806040526000357fffffffff00000000000000000000000000000000000000000000000000000000161561003657610036610038565b005b60008061004361023d565b805490915073ffffffffffffffffffffffffffffffffffffffff1661008f5780547fffffffffffffffffffffffff00000000000000000000000000000000000000001633178155600191505b600181015473ffffffffffffffffffffffffffffffffffffffff16801561013e5760018201546000357fffffffff000000000000000000000000000000000000000000000000000000009081167401000000000000000000000000000000000000000090920460e01b1614610139576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610130906102c9565b60405180910390fd5b61020d565b60028201546040517fdc9cc64500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063dc9cc645906101ba907fffffffff00000000000000000000000000000000000000000000000000000000600035169060040161029c565b60206040518083038186803b1580156101d257600080fd5b505afa1580156101e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020a9190610261565b90505b3660008037600080366000845af43d806000803e81801561023857851561023357600085555b816000f35b816000fd5b7fadbb89e904f74d44d0d104c851da4f2fa24de8f1dee64f038923bb940f37d53a90565b600060208284031215610272578081fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610295578182fd5b9392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b60208082526003908201527f464131000000000000000000000000000000000000000000000000000000000060408201526060019056fea264697066735822122024923cd795b5543a38f56fe39c7b6ead92248d6b1e0a30cc07b17c8087c8a18264736f6c634300060c0033000000000000000000000000ec6b351778aaa2349a8726b4837e05232ef20d03

Deployed Bytecode

0x60806040526000357fffffffff00000000000000000000000000000000000000000000000000000000161561003657610036610038565b005b60008061004361023d565b805490915073ffffffffffffffffffffffffffffffffffffffff1661008f5780547fffffffffffffffffffffffff00000000000000000000000000000000000000001633178155600191505b600181015473ffffffffffffffffffffffffffffffffffffffff16801561013e5760018201546000357fffffffff000000000000000000000000000000000000000000000000000000009081167401000000000000000000000000000000000000000090920460e01b1614610139576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610130906102c9565b60405180910390fd5b61020d565b60028201546040517fdc9cc64500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063dc9cc645906101ba907fffffffff00000000000000000000000000000000000000000000000000000000600035169060040161029c565b60206040518083038186803b1580156101d257600080fd5b505afa1580156101e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020a9190610261565b90505b3660008037600080366000845af43d806000803e81801561023857851561023357600085555b816000f35b816000fd5b7fadbb89e904f74d44d0d104c851da4f2fa24de8f1dee64f038923bb940f37d53a90565b600060208284031215610272578081fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610295578182fd5b9392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b60208082526003908201527f464131000000000000000000000000000000000000000000000000000000000060408201526060019056fea264697066735822122024923cd795b5543a38f56fe39c7b6ead92248d6b1e0a30cc07b17c8087c8a18264736f6c634300060c0033

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

000000000000000000000000ec6b351778aaa2349a8726b4837e05232ef20d03

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

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


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.