Contract 0x4dad27e63da5fd85babd55b28fce986e72522280 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x34452bc0a21721f07bac4fa39621cf8def23c3018a35450d0c740f950dc679b20x60806040203220992022-08-15 14:32:4246 days 1 hr ago0x88532f5e88f6a1ccd9e64681acc63416594000f4 IN  Create: DefaultTreasury0 ETH0.001926594335 ETH
[ Download CSV Export 
Latest 3 internal transactions
Parent Txn Hash Block From To Value
0xb7323fdc6f4c3f0d9ffbe3464165f7f082712de4b64a47d4b08a4bc5566178ff203221512022-08-15 14:33:5446 days 1 hr ago 0xad961758441a99147478c594d70868c1104eb071 0x4dad27e63da5fd85babd55b28fce986e725222800 ETH
0xb7323fdc6f4c3f0d9ffbe3464165f7f082712de4b64a47d4b08a4bc5566178ff203221512022-08-15 14:33:5446 days 1 hr ago 0xad961758441a99147478c594d70868c1104eb071 0x4dad27e63da5fd85babd55b28fce986e725222800 ETH
0xb7323fdc6f4c3f0d9ffbe3464165f7f082712de4b64a47d4b08a4bc5566178ff203221512022-08-15 14:33:5446 days 1 hr ago 0xad961758441a99147478c594d70868c1104eb071 0x4dad27e63da5fd85babd55b28fce986e725222800 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DefaultTreasury

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion, GNU AGPLv3 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Arbiscan on 2022-08-15
*/

// SPDX-License-Identifier: AGPL-3.0-only

// [VOTES] The Votes Module is the ERC20 token that represents voting power in the network.

pragma solidity ^0.8.15;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*///////////////////////////////////////////////////////////////
                                  EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*///////////////////////////////////////////////////////////////
                             METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*///////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*///////////////////////////////////////////////////////////////
                             EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    bytes32 public constant PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*///////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*///////////////////////////////////////////////////////////////
                              ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*///////////////////////////////////////////////////////////////
                              EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            bytes32 digest = keccak256(
                abi.encodePacked(
                    "\x19\x01",
                    DOMAIN_SEPARATOR(),
                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
                )
            );

            address recoveredAddress = ecrecover(digest, v, r, s);

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*///////////////////////////////////////////////////////////////
                       INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

error TargetNotAContract(address target_);
error InvalidKeycode(Keycode keycode_);
error InvalidRole(Role role_);

function toKeycode(bytes5 keycode_) pure returns (Keycode) {
    return Keycode.wrap(keycode_);
}

function fromKeycode(Keycode keycode_) pure returns (bytes5) {
    return Keycode.unwrap(keycode_);
}

function toRole(bytes32 role_) pure returns (Role) {
    return Role.wrap(role_);
}

function fromRole(Role role_) pure returns (bytes32) {
    return Role.unwrap(role_);
}

function ensureContract(address target_) view {
    uint256 size;
    assembly("memory-safe") {
        size := extcodesize(target_)
    }
    if (size == 0) revert TargetNotAContract(target_);
}

function ensureValidKeycode(Keycode keycode_) pure {
    bytes5 unwrapped = Keycode.unwrap(keycode_);

    for (uint256 i = 0; i < 5; ) {
        bytes1 char = unwrapped[i];

        if (char < 0x41 || char > 0x5A) revert InvalidKeycode(keycode_); // A-Z only

        unchecked {
            i++;
        }
    }
}

function ensureValidRole(Role role_) pure {
    bytes32 unwrapped = Role.unwrap(role_);

    for (uint256 i = 0; i < 32; ) {
        bytes1 char = unwrapped[i];
        if ((char < 0x61 || char > 0x7A) && char != 0x00) {
            revert InvalidRole(role_); // a-z only
        }
        unchecked {
            i++;
        }
    }
}

// ######################## ~ ERRORS ~ ########################

// KERNEL ADAPTER

error KernelAdapter_OnlyKernel(address caller_);

// MODULE

error Module_PolicyNotAuthorized(address policy_);

// POLICY

error Policy_OnlyRole(Role role_);
error Policy_ModuleDoesNotExist(Keycode keycode_);

// KERNEL

error Kernel_OnlyExecutor(address caller_);
error Kernel_OnlyAdmin(address caller_);
error Kernel_ModuleAlreadyInstalled(Keycode module_);
error Kernel_InvalidModuleUpgrade(Keycode module_);
error Kernel_PolicyAlreadyApproved(address policy_);
error Kernel_PolicyNotApproved(address policy_);
error Kernel_AddressAlreadyHasRole(address addr_, Role role_);
error Kernel_AddressDoesNotHaveRole(address addr_, Role role_);
error Kernel_RoleDoesNotExist(Role role_);

// ######################## ~ GLOBAL TYPES ~ ########################

enum Actions {
    InstallModule,
    UpgradeModule,
    ActivatePolicy,
    DeactivatePolicy,
    ChangeExecutor,
    ChangeAdmin,
    MigrateKernel
}

struct Instruction {
    Actions action;
    address target;
}

struct Permissions {
    Keycode keycode;
    bytes4 funcSelector;
}

type Keycode is bytes5;
type Role is bytes32;

// ######################## ~ MODULE ABSTRACT ~ ########################

abstract contract KernelAdapter {
    Kernel public kernel;

    constructor(Kernel kernel_) {
        kernel = kernel_;
    }

    modifier onlyKernel() {
        if (msg.sender != address(kernel)) revert KernelAdapter_OnlyKernel(msg.sender);
        _;
    }

    function changeKernel(Kernel newKernel_) external onlyKernel {
        kernel = newKernel_;
    }
}

abstract contract Module is KernelAdapter {
    event PermissionSet(bytes4 funcSelector_, address policy_, bool permission_);

    constructor(Kernel kernel_) KernelAdapter(kernel_) {}

    modifier permissioned() {
        if (!kernel.modulePermissions(KEYCODE(), Policy(msg.sender), msg.sig))
            revert Module_PolicyNotAuthorized(msg.sender);
        _;
    }

    function KEYCODE() public pure virtual returns (Keycode);

    /// @notice Specify which version of a module is being implemented.
    /// @dev Minor version change retains interface. Major version upgrade indicates
    /// @dev breaking change to the interface.
    function VERSION() external pure virtual returns (uint8 major, uint8 minor) {}

    /// @notice Initialization function for the module.
    /// @dev This function is called when the module is installed or upgraded by the kernel.
    /// @dev Used to encompass any upgrade logic. Must be gated by onlyKernel.
    function INIT() external virtual onlyKernel {}
}

abstract contract Policy is KernelAdapter  {

    bool public isActive;

    constructor(Kernel kernel_) KernelAdapter(kernel_) {}

    modifier onlyRole(bytes32 role_) {
        Role role = toRole(role_);
        if(!kernel.hasRole(msg.sender, role))
            revert Policy_OnlyRole(role);
        _;
    }

    function configureDependencies() external virtual onlyKernel returns (Keycode[] memory dependencies) {}

    function requestPermissions() external view virtual onlyKernel returns (Permissions[] memory requests) {}

    function getModuleAddress(Keycode keycode_) internal view returns (address) {
        address moduleForKeycode = address(kernel.getModuleForKeycode(keycode_));
        if (moduleForKeycode == address(0)) revert Policy_ModuleDoesNotExist(keycode_);
        return moduleForKeycode;
    }

    /// @notice Function to let kernel grant or revoke active status
    function setActiveStatus(bool activate_) external onlyKernel {
        isActive = activate_;
    }
}

contract Kernel {
    // ######################## ~ VARS ~ ########################
    address public executor;
    address public admin;

    // ######################## ~ DEPENDENCY MANAGEMENT ~ ########################

    // Module Management
    Keycode[] public allKeycodes;
    mapping(Keycode => Module) public getModuleForKeycode; // get contract for module keycode
    mapping(Module => Keycode) public getKeycodeForModule; // get module keycode for contract
    
    // Module dependents data. Manages module dependencies for policies
    mapping(Keycode => Policy[]) public moduleDependents;
    mapping(Keycode => mapping(Policy => uint256)) public getDependentIndex;

    // Module <> Policy Permissions. Policy -> Keycode -> Function Selector -> Permission
    mapping(Keycode => mapping(Policy => mapping(bytes4 => bool))) public modulePermissions; // for policy addr, check if they have permission to call the function int he module

    // List of all active policies
    Policy[] public activePolicies;
    mapping(Policy => uint256) public getPolicyIndex;

    // Policy roles data
    mapping(address => mapping(Role => bool)) public hasRole;
    mapping(Role => bool) public isRole;

    // ######################## ~ EVENTS ~ ########################

    event PermissionsUpdated(
        Keycode indexed keycode_,
        Policy indexed policy_,
        bytes4 funcSelector_,
        bool granted_
    );
    event RoleGranted(Role indexed role_, address indexed addr_);
    event RoleRevoked(Role indexed role_, address indexed addr_);
    event ActionExecuted(Actions indexed action_, address indexed target_);

    // ######################## ~ BODY ~ ########################

    constructor() {
        executor = msg.sender;
        admin = msg.sender;
    }

    // ######################## ~ MODIFIERS ~ ########################

    // Role reserved for governor or any executing address
    modifier onlyExecutor() {
        if (msg.sender != executor) revert Kernel_OnlyExecutor(msg.sender);
        _;
    }

    // Role for managing policy roles
    modifier onlyAdmin() {
        if (msg.sender != admin) revert Kernel_OnlyAdmin(msg.sender);
        _;
    }

    // ######################## ~ KERNEL INTERFACE ~ ########################

    function executeAction(Actions action_, address target_) external onlyExecutor {
        if (action_ == Actions.InstallModule) {
            ensureContract(target_);
            ensureValidKeycode(Module(target_).KEYCODE());
            _installModule(Module(target_));
        } else if (action_ == Actions.UpgradeModule) {
            ensureContract(target_);
            ensureValidKeycode(Module(target_).KEYCODE());
            _upgradeModule(Module(target_));
        } else if (action_ == Actions.ActivatePolicy) {
            ensureContract(target_);
            _activatePolicy(Policy(target_));
        } else if (action_ == Actions.DeactivatePolicy) {
            ensureContract(target_);
            _deactivatePolicy(Policy(target_));
        } else if (action_ == Actions.MigrateKernel) {
            ensureContract(target_);
            _migrateKernel(Kernel(target_));
        } else if (action_ == Actions.ChangeExecutor) {
            executor = target_;
        } else if (action_ == Actions.ChangeAdmin) {
            admin = target_;
        }

        emit ActionExecuted(action_, target_);
    }

    // ######################## ~ KERNEL INTERNAL ~ ########################

    function _installModule(Module newModule_) internal {
        Keycode keycode = newModule_.KEYCODE();

        if (address(getModuleForKeycode[keycode]) != address(0))
            revert Kernel_ModuleAlreadyInstalled(keycode);

        getModuleForKeycode[keycode] = newModule_;
        getKeycodeForModule[newModule_] = keycode;
        allKeycodes.push(keycode);

        newModule_.INIT();
    }

    function _upgradeModule(Module newModule_) internal {
        Keycode keycode = newModule_.KEYCODE();
        Module oldModule = getModuleForKeycode[keycode];

        if (address(oldModule) == address(0) || oldModule == newModule_)
            revert Kernel_InvalidModuleUpgrade(keycode);

        getKeycodeForModule[oldModule] = Keycode.wrap(bytes5(0));
        getKeycodeForModule[newModule_] = keycode;
        getModuleForKeycode[keycode] = newModule_;

        newModule_.INIT();

        _reconfigurePolicies(keycode);
    }

    function _activatePolicy(Policy policy_) internal {
        if (policy_.isActive()) revert Kernel_PolicyAlreadyApproved(address(policy_));

        // Grant permissions for policy to access restricted module functions
        Permissions[] memory requests = policy_.requestPermissions();
        _setPolicyPermissions(policy_, requests, true);

        // Add policy to list of active policies
        activePolicies.push(policy_);
        getPolicyIndex[policy_] = activePolicies.length - 1;

        // Record module dependencies
        Keycode[] memory dependencies = policy_.configureDependencies();
        uint256 depLength = dependencies.length;

        for (uint256 i; i < depLength; ) {
            Keycode keycode = dependencies[i];

            moduleDependents[keycode].push(policy_);
            getDependentIndex[keycode][policy_] = moduleDependents[keycode].length - 1;

            unchecked {
                ++i;
            }
        }

        // Set policy status to active
        policy_.setActiveStatus(true);
    }

    function _deactivatePolicy(Policy policy_) internal {
        if (!policy_.isActive()) revert Kernel_PolicyNotApproved(address(policy_));

        // Revoke permissions
        Permissions[] memory requests = policy_.requestPermissions();
        _setPolicyPermissions(policy_, requests, false);

        // Remove policy from all policy data structures
        uint256 idx = getPolicyIndex[policy_];
        Policy lastPolicy = activePolicies[activePolicies.length - 1];

        activePolicies[idx] = lastPolicy;
        activePolicies.pop();
        getPolicyIndex[lastPolicy] = idx;
        delete getPolicyIndex[policy_];

        // Remove policy from module dependents
        _pruneFromDependents(policy_);

        // Set policy status to inactive
        policy_.setActiveStatus(false);
    }

    // WARNING: ACTION WILL BRICK THIS KERNEL. All functionality will move to the new kernel
    // New kernel must add in all of the modules and policies via executeAction
    // NOTE: Data does not get cleared from this kernel
    function _migrateKernel(Kernel newKernel_) internal {
        uint256 keycodeLen = allKeycodes.length;
        for (uint256 i; i < keycodeLen; ) {
            Module module = Module(getModuleForKeycode[allKeycodes[i]]);
            module.changeKernel(newKernel_);
            unchecked {
                ++i;
            }
        }

        uint256 policiesLen = activePolicies.length;
        for (uint256 j; j < policiesLen; ) {
            Policy policy = activePolicies[j];

            // Deactivate before changing kernel
            policy.setActiveStatus(false);
            policy.changeKernel(newKernel_);
            unchecked {
                ++j;
            }
        }
    }

    function _reconfigurePolicies(Keycode keycode_) internal {
        Policy[] memory dependents = moduleDependents[keycode_];
        uint256 depLength = dependents.length;

        for (uint256 i; i < depLength; ) {
            dependents[i].configureDependencies();

            unchecked {
                ++i;
            }
        }
    }

    function _setPolicyPermissions(
        Policy policy_,
        Permissions[] memory requests_,
        bool grant_
    ) internal {
        uint256 reqLength = requests_.length;
        for (uint256 i = 0; i < reqLength; ) {
            Permissions memory request = requests_[i];
            modulePermissions[request.keycode][policy_][request.funcSelector] = grant_;

            emit PermissionsUpdated(request.keycode, policy_, request.funcSelector, grant_);

            unchecked {
                ++i;
            }
        }
    }

    function _pruneFromDependents(Policy policy_) internal {
        Keycode[] memory dependencies = policy_.configureDependencies();
        uint256 depcLength = dependencies.length;

        for (uint256 i; i < depcLength; ) {
            Keycode keycode = dependencies[i];
            Policy[] storage dependents = moduleDependents[keycode];

            uint256 origIndex = getDependentIndex[keycode][policy_];
            Policy lastPolicy = dependents[dependents.length - 1];

            // Swap with last and pop
            dependents[origIndex] = lastPolicy;
            dependents.pop();

            // Record new index and delete terminated policy index
            getDependentIndex[keycode][lastPolicy] = origIndex;
            delete getDependentIndex[keycode][policy_];

            unchecked {
                ++i;
            }
        }
    }

    function grantRole(Role role_, address addr_) public onlyAdmin {
        if (hasRole[addr_][role_]) revert Kernel_AddressAlreadyHasRole(addr_, role_);

        ensureValidRole(role_);
        if (!isRole[role_]) isRole[role_] = true;

        hasRole[addr_][role_] = true;

        emit RoleGranted(role_, addr_);
    }

    function revokeRole(Role role_, address addr_) public onlyAdmin {
        if (!isRole[role_]) revert Kernel_RoleDoesNotExist(role_);
        if (!hasRole[addr_][role_]) revert Kernel_AddressDoesNotHaveRole(addr_, role_);

        hasRole[addr_][role_] = false;

        emit RoleRevoked(role_, addr_);
    }
}

error IsAlreadyReserveAsset();
error NotReserveAsset();

contract DefaultTreasury is Module {

    constructor(Kernel kernel_, ERC20[] memory initialAssets_) Module(kernel_) {
        uint256 length = initialAssets_.length;
        for (uint256 i; i < length;) {
            ERC20 asset = initialAssets_[i];
            isReserveAsset[asset] = true;
            reserveAssets.push(asset);
            unchecked {
                ++i;
            }
        }   
    }

    function KEYCODE() public pure override returns (Keycode) {
        return Keycode.wrap("TRSRY");
    }

    // VARIABLES

    mapping(ERC20 => bool) public isReserveAsset;
    ERC20[] public reserveAssets;

    // Policy Interface

    function getReserveAssets() public view returns (ERC20[] memory reserveAssets_) {
        reserveAssets_ = reserveAssets;
    }

    // whitelisting: add and remove reserve assets (if the treasury supports these currencies)

    function addReserveAsset(ERC20 asset_) public permissioned {
        if (isReserveAsset[asset_]) {revert IsAlreadyReserveAsset();}
        isReserveAsset[asset_] = true;
        reserveAssets.push(asset_);
    }

    function removeReserveAsset(ERC20 asset_) public permissioned {
        if (!isReserveAsset[asset_]) {revert NotReserveAsset();}       
        isReserveAsset[asset_] = false;
        
        uint numAssets = reserveAssets.length;
        for (uint i; i < numAssets;) {
            if (reserveAssets[i] == asset_) {
                reserveAssets[i] = reserveAssets[numAssets - 1];
                break;
            }
            unchecked {++i;}
        }
    }

    // more convenient than "transferFrom", since users only have to approve the Treasury
    // and any policy can make approved transfers on the Treasury's behalf.
    // beware of approving malicious policies that can rug the user.

    function depositFrom(address depositor_, ERC20 asset_, uint256 amount_) external permissioned {
        if (!isReserveAsset[asset_]) {revert NotReserveAsset();}
        asset_.transferFrom(depositor_, address(this), amount_);
    }

    // must withdraw assets to approved policies, where withdrawn assets are handled in their internal logic.
    // no direct withdraws to arbitrary addresses allowed.
    function withdraw(ERC20 asset_, uint256 amount_) external permissioned {
        if (!isReserveAsset[asset_]) {revert NotReserveAsset();}
        asset_.transfer(msg.sender, amount_);
    }
}

Contract ABI

[{"inputs":[{"internalType":"contract Kernel","name":"kernel_","type":"address"},{"internalType":"contract ERC20[]","name":"initialAssets_","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"IsAlreadyReserveAsset","type":"error"},{"inputs":[{"internalType":"address","name":"caller_","type":"address"}],"name":"KernelAdapter_OnlyKernel","type":"error"},{"inputs":[{"internalType":"address","name":"policy_","type":"address"}],"name":"Module_PolicyNotAuthorized","type":"error"},{"inputs":[],"name":"NotReserveAsset","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"funcSelector_","type":"bytes4"},{"indexed":false,"internalType":"address","name":"policy_","type":"address"},{"indexed":false,"internalType":"bool","name":"permission_","type":"bool"}],"name":"PermissionSet","type":"event"},{"inputs":[],"name":"INIT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"KEYCODE","outputs":[{"internalType":"Keycode","name":"","type":"bytes5"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint8","name":"major","type":"uint8"},{"internalType":"uint8","name":"minor","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"asset_","type":"address"}],"name":"addReserveAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Kernel","name":"newKernel_","type":"address"}],"name":"changeKernel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositor_","type":"address"},{"internalType":"contract ERC20","name":"asset_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"depositFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getReserveAssets","outputs":[{"internalType":"contract ERC20[]","name":"reserveAssets_","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"name":"isReserveAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kernel","outputs":[{"internalType":"contract Kernel","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"asset_","type":"address"}],"name":"removeReserveAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"reserveAssets","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"asset_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200113d3803806200113d833981016040819052620000349162000136565b600080546001600160a01b0319166001600160a01b0384161781558151905b81811015620000eb57600083828151811062000073576200007362000221565b6020908102919091018101516001600160a01b0316600081815260019283905260408120805460ff19168417905560028054808501825591527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b031916909117905591909101905062000053565b5050505062000237565b6001600160a01b03811681146200010b57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b80516200013181620000f5565b919050565b600080604083850312156200014a57600080fd5b82516200015781620000f5565b602084810151919350906001600160401b03808211156200017757600080fd5b818601915086601f8301126200018c57600080fd5b815181811115620001a157620001a16200010e565b8060051b604051601f19603f83011681018181108582111715620001c957620001c96200010e565b604052918252848201925083810185019189831115620001e857600080fd5b938501935b828510156200021157620002018562000124565b84529385019392850192620001ed565b8096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b610ef680620002476000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c8063d4aae0c411610081578063f04ec5471161005b578063f04ec547146101ef578063f3fef3a314610202578063ffa1ad741461021557600080fd5b8063d4aae0c414610194578063dd04e584146101b4578063ea643914146101e757600080fd5b806368a9674d116100b257806368a9674d1461015957806388e8dc751461016c578063bc819ea61461017f57600080fd5b80631ae7ec2e146100d957806337973e5f1461010c5780634657b36c14610144575b600080fd5b6040517f545253525900000000000000000000000000000000000000000000000000000081526020015b60405180910390f35b61011f61011a366004610d08565b610229565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610103565b610157610152366004610d46565b610260565b005b610157610167366004610d6a565b6102ff565b61015761017a366004610d46565b610526565b610187610801565b6040516101039190610dab565b60005461011f9073ffffffffffffffffffffffffffffffffffffffff1681565b6101d76101c2366004610d46565b60016020526000908152604090205460ff1681565b6040519015158152602001610103565b610157610870565b6101576101fd366004610d46565b6108c5565b610157610210366004610e05565b610aef565b604080516000808252602082015201610103565b6002818154811061023957600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102b8576040517f14fa403c0000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1663f166d9eb7f54525352590000000000000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b811682527fffffffffff0000000000000000000000000000000000000000000000000000009290921660048201523360248201526000359091166044820152606401602060405180830381865afa1580156103c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ea9190610e31565b610422576040517f02ad7db00000000000000000000000000000000000000000000000000000000081523360048201526024016102af565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610481576040517f2ec573e600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152306024830152604482018390528316906323b872dd906064016020604051808303816000875af11580156104fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105209190610e31565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff1663f166d9eb7f54525352590000000000000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b811682527fffffffffff0000000000000000000000000000000000000000000000000000009290921660048201523360248201526000359091166044820152606401602060405180830381865afa1580156105ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106119190610e31565b610649576040517f02ad7db00000000000000000000000000000000000000000000000000000000081523360048201526024016102af565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166106a8576040517f2ec573e600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600254905b818110156107fc578273ffffffffffffffffffffffffffffffffffffffff166002828154811061072a5761072a610e53565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16036107f457600261075e600184610e82565b8154811061076e5761076e610e53565b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff90921691839081106107a7576107a7610e53565b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6001016106f8565b505050565b6060600280548060200260200160405190810160405280929190818152602001828054801561086657602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161083b575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff1633146108c3576040517f14fa403c0000000000000000000000000000000000000000000000000000000081523360048201526024016102af565b565b60005473ffffffffffffffffffffffffffffffffffffffff1663f166d9eb7f54525352590000000000000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b811682527fffffffffff0000000000000000000000000000000000000000000000000000009290921660048201523360248201526000359091166044820152606401602060405180830381865afa15801561098c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b09190610e31565b6109e8576040517f02ad7db00000000000000000000000000000000000000000000000000000000081523360048201526024016102af565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff1615610a48576040517fdf4f2d5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff166000818152600160208190526040822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016821790556002805491820181559091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1663f166d9eb7f54525352590000000000000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b811682527fffffffffff0000000000000000000000000000000000000000000000000000009290921660048201523360248201526000359091166044820152606401602060405180830381865afa158015610bb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bda9190610e31565b610c12576040517f02ad7db00000000000000000000000000000000000000000000000000000000081523360048201526024016102af565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610c71576040517f2ec573e600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff83169063a9059cbb906044016020604051808303816000875af1158015610ce4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc9190610e31565b600060208284031215610d1a57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610d4357600080fd5b50565b600060208284031215610d5857600080fd5b8135610d6381610d21565b9392505050565b600080600060608486031215610d7f57600080fd5b8335610d8a81610d21565b92506020840135610d9a81610d21565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b81811015610df957835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101610dc7565b50909695505050505050565b60008060408385031215610e1857600080fd5b8235610e2381610d21565b946020939093013593505050565b600060208284031215610e4357600080fd5b81518015158114610d6357600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082821015610ebb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea2646970667358221220f42326f78fc694ae2340f2ec0779ebe1b5b5a56db6176589150af9b0dea188e464736f6c634300080f0033000000000000000000000000ad961758441a99147478c594d70868c1104eb07100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da1

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

000000000000000000000000ad961758441a99147478c594d70868c1104eb07100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da1

-----Decoded View---------------
Arg [0] : kernel_ (address): 0xad961758441a99147478c594d70868c1104eb071
Arg [1] : initialAssets_ (address[]): 0xda10009cbd5d07dd0cecc66161fc93d7c9000da1

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000ad961758441a99147478c594d70868c1104eb071
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [3] : 000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da1


Deployed ByteCode Sourcemap

21856:2466:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22285:105;;;22361:21;186:98:1;;174:2;159:18;22285:105:0;;;;;;;;22469:28;;;;;;:::i;:::-;;:::i;:::-;;;669:42:1;657:55;;;639:74;;627:2;612:18;22469:28:0;480:239:1;9755:99:0;;;;;;:::i;:::-;;:::i;:::-;;23714:234;;;;;;:::i;:::-;;:::i;22991:475::-;;;;;;:::i;:::-;;:::i;22533:129::-;;;:::i;:::-;;;;;;;:::i;9516:20::-;;;;;;;;;22418:44;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3039:14:1;;3032:22;3014:41;;3002:2;2987:18;22418:44:0;2874:187:1;10837:46:0;;;:::i;22768:215::-;;;;;;:::i;:::-;;:::i;24127:192::-;;;;;;:::i;:::-;;:::i;10520:78::-;;;;10570:11;3573:36:1;;;3640:2;3625:18;;3618:45;3546:18;10520:78:0;3407:262:1;22469:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;22469:28:0;:::o;9755:99::-;9675:6;;;;9653:10;:29;9649:78;;9691:36;;;;;9716:10;9691:36;;;639:74:1;612:18;;9691:36:0;;;;;;;;9649:78;9827:6:::1;:19:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;9755:99::o;23714:234::-;10096:6;;;;:24;22361:21;10096:64;;10152:7;10096:64;;;;;;;;4175:66:1;4163:79;;;;10096:64:0;;;4145:98:1;10139:10:0;4259:18:1;;;4252:83;-1:-1:-1;10152:7:0;;;;4351:18:1;;;4344:107;4118:18;;10096:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;10091:129;;10182:38;;;;;10209:10;10182:38;;;639:74:1;612:18;;10182:38:0;480:239:1;10091:129:0;23824:22:::1;::::0;::::1;;::::0;;;:14:::1;:22;::::0;;;;;::::1;;23819:56;;23856:17;;;;;;;;;;;;;;23819:56;23885:55;::::0;;;;:19:::1;5025:15:1::0;;;23885:55:0::1;::::0;::::1;5007:34:1::0;23925:4:0::1;5057:18:1::0;;;5050:43;5109:18;;;5102:34;;;23885:19:0;::::1;::::0;::::1;::::0;4919:18:1;;23885:55:0::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;23714:234:::0;;;:::o;22991:475::-;10096:6;;;;:24;22361:21;10096:64;;10152:7;10096:64;;;;;;;;4175:66:1;4163:79;;;;10096:64:0;;;4145:98:1;10139:10:0;4259:18:1;;;4252:83;-1:-1:-1;10152:7:0;;;;4351:18:1;;;4344:107;4118:18;;10096:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;10091:129;;10182:38;;;;;10209:10;10182:38;;;639:74:1;612:18;;10182:38:0;480:239:1;10091:129:0;23069:22:::1;::::0;::::1;;::::0;;;:14:::1;:22;::::0;;;;;::::1;;23064:56;;23101:17;;;;;;;;;;;;;;23064:56;23137:22;::::0;::::1;23162:5;23137:22:::0;;;:14:::1;:22;::::0;;;;:30;;;::::1;::::0;;23205:13:::1;:20:::0;;23236:223:::1;23253:9;23249:1;:13;23236:223;;;23304:6;23284:26;;:13;23298:1;23284:16;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;::::1;::::0;::::1;;:26:::0;23280:138:::1;;23350:13;23364;23376:1;23364:9:::0;:13:::1;:::i;:::-;23350:28;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;::::1;::::0;23331:13:::1;:16:::0;;23350:28:::1;::::0;;::::1;::::0;23345:1;;23331:16;::::1;;;;;:::i;:::-;;;;;;;;;:47;;;;;;;;;;;;;;;;;;23236:223;23053:413;22991:475:::0;:::o;23280:138::-:1;23443:3;;23236:223;;;;23053:413;22991:475:::0;:::o;22533:129::-;22582:29;22641:13;22624:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22533:129;:::o;10837:46::-;9675:6;;;;9653:10;:29;9649:78;;9691:36;;;;;9716:10;9691:36;;;639:74:1;612:18;;9691:36:0;480:239:1;9649:78:0;10837:46::o;22768:215::-;10096:6;;;;:24;22361:21;10096:64;;10152:7;10096:64;;;;;;;;4175:66:1;4163:79;;;;10096:64:0;;;4145:98:1;10139:10:0;4259:18:1;;;4252:83;-1:-1:-1;10152:7:0;;;;4351:18:1;;;4344:107;4118:18;;10096:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;10091:129;;10182:38;;;;;10209:10;10182:38;;;639:74:1;612:18;;10182:38:0;480:239:1;10091:129:0;22842:22:::1;::::0;::::1;;::::0;;;:14:::1;:22;::::0;;;;;::::1;;22838:61;;;22874:23;;;;;;;;;;;;;;22838:61;22909:22;;;::::0;;;22934:4:::1;22909:22;::::0;;;;;;:29;;;::::1;::::0;::::1;::::0;;22949:13:::1;:26:::0;;;;::::1;::::0;;;;;;::::1;::::0;;;::::1;::::0;;::::1;::::0;;22768:215::o;24127:192::-;10096:6;;;;:24;22361:21;10096:64;;10152:7;10096:64;;;;;;;;4175:66:1;4163:79;;;;10096:64:0;;;4145:98:1;10139:10:0;4259:18:1;;;4252:83;-1:-1:-1;10152:7:0;;;;4351:18:1;;;4344:107;4118:18;;10096:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;10091:129;;10182:38;;;;;10209:10;10182:38;;;639:74:1;612:18;;10182:38:0;480:239:1;10091:129:0;24214:22:::1;::::0;::::1;;::::0;;;:14:::1;:22;::::0;;;;;::::1;;24209:56;;24246:17;;;;;;;;;;;;;;24209:56;24275:36;::::0;;;;24291:10:::1;24275:36;::::0;::::1;5794:74:1::0;5884:18;;;5877:34;;;24275:15:0::1;::::0;::::1;::::0;::::1;::::0;5767:18:1;;24275:36:0::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;295:180:1:-:0;354:6;407:2;395:9;386:7;382:23;378:32;375:52;;;423:1;420;413:12;375:52;-1:-1:-1;446:23:1;;295:180;-1:-1:-1;295:180:1:o;724:162::-;818:42;811:5;807:54;800:5;797:65;787:93;;876:1;873;866:12;787:93;724:162;:::o;891:270::-;965:6;1018:2;1006:9;997:7;993:23;989:32;986:52;;;1034:1;1031;1024:12;986:52;1073:9;1060:23;1092:39;1125:5;1092:39;:::i;:::-;1150:5;891:270;-1:-1:-1;;;891:270:1:o;1166:485::-;1256:6;1264;1272;1325:2;1313:9;1304:7;1300:23;1296:32;1293:52;;;1341:1;1338;1331:12;1293:52;1380:9;1367:23;1399:39;1432:5;1399:39;:::i;:::-;1457:5;-1:-1:-1;1514:2:1;1499:18;;1486:32;1527:41;1486:32;1527:41;:::i;:::-;1166:485;;1587:7;;-1:-1:-1;;;1641:2:1;1626:18;;;;1613:32;;1166:485::o;1929:694::-;2113:2;2165:21;;;2235:13;;2138:18;;;2257:22;;;2084:4;;2113:2;2336:15;;;;2310:2;2295:18;;;2084:4;2379:218;2393:6;2390:1;2387:13;2379:218;;;2458:13;;2473:42;2454:62;2442:75;;2572:15;;;;2537:12;;;;2415:1;2408:9;2379:218;;;-1:-1:-1;2614:3:1;;1929:694;-1:-1:-1;;;;;;1929:694:1:o;3066:336::-;3147:6;3155;3208:2;3196:9;3187:7;3183:23;3179:32;3176:52;;;3224:1;3221;3214:12;3176:52;3263:9;3250:23;3282:39;3315:5;3282:39;:::i;:::-;3340:5;3392:2;3377:18;;;;3364:32;;-1:-1:-1;;;3066:336:1:o;4462:277::-;4529:6;4582:2;4570:9;4561:7;4557:23;4553:32;4550:52;;;4598:1;4595;4588:12;4550:52;4630:9;4624:16;4683:5;4676:13;4669:21;4662:5;4659:32;4649:60;;4705:1;4702;4695:12;5147:184;5199:77;5196:1;5189:88;5296:4;5293:1;5286:15;5320:4;5317:1;5310:15;5336:279;5376:4;5404:1;5401;5398:8;5395:188;;;5439:77;5436:1;5429:88;5540:4;5537:1;5530:15;5568:4;5565:1;5558:15;5395:188;-1:-1:-1;5600:9:1;;5336:279::o

Metadata Hash

f42326f78fc694ae2340f2ec0779ebe1b5b5a56db6176589150af9b0dea188e4
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.