false
false

Contract Address Details

0xEF6890d740E1244fEa42E3D1B9Ff515C24c004Ce

Contract Name
OpenLevDelegator
Creator
0x68b6f4–0b8438 at 0xd08718–3a5b38
Implementation
0x9a17c94f9b1bbd8fd7ad43e54d806d07d4c14ddc
Balance
0 KCS ( )
Tokens
Fetching tokens...
Transactions
10,583 Transactions
Transfers
50,020 Transfers
Gas Used
4,814,281,286
Last Balance Update
45210578
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
OpenLevDelegator




Optimization enabled
true
Compiler version
v0.7.6+commit.7338295f




Optimization runs
200
Verified at
2022-03-31T12:32:17.918943Z

Constructor Arguments

0000000000000000000000008a2f01b39319de1dfe219090018b6f460e968e00000000000000000000000000c2e51ab824cc088cb5253e74963b00a15be7d23400000000000000000000000000000000000000000000000000000000000001000000000000000000000000004446fc4eb47f2f6586f9faab68b3498f86c07521000000000000000000000000c7ff25ad08aa8ea665cf78532f7317067cffb2900000000000000000000000000000000000000000000000000000000000000120000000000000000000000000ad0bfa476fb71215ba026ebe60ffa9b31d98efe70000000000000000000000007c0d5bf86427c02f6a841e28ff7cf2934aa83b3400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e

Arg [0] (address) : 0x8a2f01b39319de1dfe219090018b6f460e968e00
Arg [1] (address) : 0xc2e51ab824cc088cb5253e74963b00a15be7d234
Arg [2] (address[]) : []
Arg [3] (address) : 0x4446fc4eb47f2f6586f9faab68b3498f86c07521
Arg [4] (address) : 0xc7ff25ad08aa8ea665cf78532f7317067cffb290
Arg [5] (uint8[]) : [13, 14]
Arg [6] (address) : 0xad0bfa476fb71215ba026ebe60ffa9b31d98efe7
Arg [7] (address) : 0x7c0d5bf86427c02f6a841e28ff7cf2934aa83b34

              

project:/contracts/OpenLevDelegator.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

import "./Adminable.sol";
import "./DelegatorInterface.sol";


/**
  * @title OpenLevDelegator
  * @author OpenLeverage
  */
contract OpenLevDelegator is DelegatorInterface, Adminable {

    constructor(
        address _controller,
        address _dexAggregator,
        address[] memory _depositTokens,
        address _wETH,
        address _xOLE,
        uint8[] memory _supportDexs,
        address payable _admin,
        address implementation_){
        admin = msg.sender;
        // Creator of the contract is admin during initialization
        // First delegate gets to initialize the delegator (i.e. storage contract)
        delegateTo(implementation_, abi.encodeWithSignature("initialize(address,address,address[],address,address,uint8[])",
            _controller,
            _dexAggregator,
            _depositTokens,
            _wETH,
            _xOLE,
            _supportDexs
            ));
        implementation = implementation_;

        // Set the proper admin now that initialization is done
        admin = _admin;
    }

    /**
     * Called by the admin to update the implementation of the delegator
     * @param implementation_ The address of the new implementation for delegation
     */
    function setImplementation(address implementation_) public override onlyAdmin {
        address oldImplementation = implementation;
        implementation = implementation_;
        emit NewImplementation(oldImplementation, implementation);
    }
}
        

project:/contracts/DelegatorInterface.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;


abstract contract DelegatorInterface {
    /**
     * Implementation address for this contract
     */
    address public implementation;

    /**
     * Emitted when implementation is changed
     */
    event NewImplementation(address oldImplementation, address newImplementation);

    /**
     * Called by the admin to update the implementation of the delegator
     * @param implementation_ The address of the new implementation for delegation
     */
    function setImplementation(address implementation_) public virtual;


    /**
    * Internal method to delegate execution to another contract
    * @dev It returns to the external caller whatever the implementation returns or forwards reverts
    * @param callee The contract to delegatecall
    * @param data The raw data to delegatecall
    * @return The returned bytes from the delegatecall
    */
    function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returnData) = callee.delegatecall(data);
        assembly {
            if eq(success, 0) {revert(add(returnData, 0x20), returndatasize())}
        }
        return returnData;
    }

    /**
     * Delegates execution to the implementation contract
     * @dev It returns to the external caller whatever the implementation returns or forwards reverts
     * @param data The raw data to delegatecall
     * @return The returned bytes from the delegatecall
     */
    function delegateToImplementation(bytes memory data) public returns (bytes memory) {
        return delegateTo(implementation, data);
    }

    /**
     * Delegates execution to an implementation contract
     * @dev It returns to the external caller whatever the implementation returns or forwards reverts
     *  There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.
     * @param data The raw data to delegatecall
     * @return The returned bytes from the delegatecall
     */
    function delegateToViewImplementation(bytes memory data) public view returns (bytes memory) {
        (bool success, bytes memory returnData) = address(this).staticcall(abi.encodeWithSignature("delegateToImplementation(bytes)", data));
        assembly {
            if eq(success, 0) {revert(add(returnData, 0x20), returndatasize())}
        }
        return abi.decode(returnData, (bytes));
    }
    /**
    * Delegates execution to an implementation contract
    * @dev It returns to the external caller whatever the implementation returns or forwards reverts
    */
    fallback() external payable {
        _fallback();
    }

    receive() external payable {
        _fallback();
    }

    function _fallback() internal {
        // delegate all other functions to current implementation
        if (msg.data.length > 0) {
            (bool success,) = implementation.delegatecall(msg.data);
            assembly {
                let free_mem_ptr := mload(0x40)
                returndatacopy(free_mem_ptr, 0, returndatasize())
                switch success
                case 0 {revert(free_mem_ptr, returndatasize())}
                default {return (free_mem_ptr, returndatasize())}
            }
        }
    }
}
          

project:/contracts/Adminable.sol

// SPDX-License-Identifier: BUSL-1.1


pragma solidity 0.7.6;

abstract contract Adminable {
    address payable public admin;
    address payable public pendingAdmin;
    address payable public developer;

    event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);

    event NewAdmin(address oldAdmin, address newAdmin);
    constructor () {
        developer = msg.sender;
    }

    modifier onlyAdmin() {
        require(msg.sender == admin, "caller must be admin");
        _;
    }
    modifier onlyAdminOrDeveloper() {
        require(msg.sender == admin || msg.sender == developer, "caller must be admin or developer");
        _;
    }

    function setPendingAdmin(address payable newPendingAdmin) external virtual onlyAdmin {
        // Save current value, if any, for inclusion in log
        address oldPendingAdmin = pendingAdmin;
        // Store pendingAdmin with value newPendingAdmin
        pendingAdmin = newPendingAdmin;
        // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
        emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
    }

    function acceptAdmin() external virtual {
        require(msg.sender == pendingAdmin, "only pendingAdmin can accept admin");
        // Save current values for inclusion in log
        address oldAdmin = admin;
        address oldPendingAdmin = pendingAdmin;
        // Store admin with value pendingAdmin
        admin = pendingAdmin;
        // Clear the pending value
        pendingAdmin = address(0);
        emit NewAdmin(oldAdmin, admin);
        emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
    }

}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_controller","internalType":"address"},{"type":"address","name":"_dexAggregator","internalType":"address"},{"type":"address[]","name":"_depositTokens","internalType":"address[]"},{"type":"address","name":"_wETH","internalType":"address"},{"type":"address","name":"_xOLE","internalType":"address"},{"type":"uint8[]","name":"_supportDexs","internalType":"uint8[]"},{"type":"address","name":"_admin","internalType":"address payable"},{"type":"address","name":"implementation_","internalType":"address"}]},{"type":"event","name":"NewAdmin","inputs":[{"type":"address","name":"oldAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"NewImplementation","inputs":[{"type":"address","name":"oldImplementation","internalType":"address","indexed":false},{"type":"address","name":"newImplementation","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"NewPendingAdmin","inputs":[{"type":"address","name":"oldPendingAdmin","internalType":"address","indexed":false},{"type":"address","name":"newPendingAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptAdmin","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"admin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"delegateToImplementation","inputs":[{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"delegateToViewImplementation","inputs":[{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"developer","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"implementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"pendingAdmin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setImplementation","inputs":[{"type":"address","name":"implementation_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPendingAdmin","inputs":[{"type":"address","name":"newPendingAdmin","internalType":"address payable"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50604051610d9e380380610d9e833981810160405261010081101561003457600080fd5b8151602083015160408085018051915193959294830192918464010000000082111561005f57600080fd5b90830190602082018581111561007457600080fd5b825186602082028301116401000000008211171561009157600080fd5b82525081516020918201928201910280838360005b838110156100be5781810151838201526020016100a6565b5050505091909101604081815260208401519084015160609094018051919694959294935090846401000000008211156100f757600080fd5b90830190602082018581111561010c57600080fd5b825186602082028301116401000000008211171561012957600080fd5b82525081516020918201928201910280838360005b8381101561015657818101518382015260200161013e565b50505050919091016040818152602084810151949091015160038054336001600160a01b031991821681179092556001805490911690911790556001600160a01b038d8116602485019081528d821660448601528b82166084860152908a1660a485015260c0606485019081528c5160e48601528c5196985091965061029b958795508e948e948e948e948e948e94919360c48301926101040191898201910280838360005b838110156102145781810151838201526020016101fc565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561025357818101518382015260200161023b565b50506040805193909501838103601f1901845290945250602081018051632bb78d0360e01b6001600160e01b0391821617909152909b506102d7169950505050505050505050565b50600080546001600160a01b039283166001600160a01b0319918216179091556001805493909216921691909117905550610398945050505050565b6060600080846001600160a01b0316846040518082805190602001908083835b602083106103165780518252601f1990920191602091820191016102f7565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610376576040519150601f19603f3d011682016040523d82523d6000602084013e61037b565b606091505b50915091506000821415610390573d60208201fd5b949350505050565b6109f7806103a76000396000f3fe60806040526004361061008a5760003560e01c80634dd18bf5116100595780634dd18bf5146102c25780635c60da1b146102f5578063ca4b208b1461030a578063d784d4261461031f578063f851a4401461035257610099565b80630933c1ed146100a15780630e18b681146101c957806326782247146101de5780634487152f1461020f57610099565b3661009957610097610367565b005b610097610367565b3480156100ad57600080fd5b50610154600480360360208110156100c457600080fd5b8101906020810181356401000000008111156100df57600080fd5b8201836020820111156100f157600080fd5b8035906020019184600183028401116401000000008311171561011357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103f2945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d557600080fd5b50610097610411565b3480156101ea57600080fd5b506101f3610511565b604080516001600160a01b039092168252519081900360200190f35b34801561021b57600080fd5b506101546004803603602081101561023257600080fd5b81019060208101813564010000000081111561024d57600080fd5b82018360208201111561025f57600080fd5b8035906020019184600183028401116401000000008311171561028157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610520945050505050565b3480156102ce57600080fd5b50610097600480360360208110156102e557600080fd5b50356001600160a01b0316610740565b34801561030157600080fd5b506101f36107f9565b34801561031657600080fd5b506101f3610808565b34801561032b57600080fd5b506100976004803603602081101561034257600080fd5b50356001600160a01b0316610817565b34801561035e57600080fd5b506101f36108cf565b36156103f057600080546040516001600160a01b0390911690829036908083838082843760405192019450600093509091505080830381855af49150503d80600081146103d0576040519150601f19603f3d011682016040523d82523d6000602084013e6103d5565b606091505b505090506040513d6000823e8180156103ec573d82f35b3d82fd5b565b60005460609061040b906001600160a01b0316836108de565b92915050565b6002546001600160a01b0316331461045a5760405162461bcd60e51b81526004018080602001828103825260228152602001806109a06022913960400191505060405180910390fd5b60018054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a15050565b6002546001600160a01b031681565b6060600080306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b83811015610570578181015183820152602001610558565b50505050905090810190601f16801561059d5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b602083106105f85780518252601f1990920191602091820191016105d9565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610658576040519150601f19603f3d011682016040523d82523d6000602084013e61065d565b606091505b50915091506000821415610672573d60208201fd5b80806020019051602081101561068757600080fd5b81019080805160405193929190846401000000008211156106a757600080fd5b9083019060208201858111156106bc57600080fd5b82516401000000008111828201881017156106d657600080fd5b82525081516020918201929091019080838360005b838110156107035781810151838201526020016106eb565b50505050905090810190601f1680156107305780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b6001546001600160a01b03163314610796576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a15050565b6000546001600160a01b031681565b6003546001600160a01b031681565b6001546001600160a01b0316331461086d576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600080546001600160a01b038381166001600160a01b0319831617928390556040805192821680845293909116602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a15050565b6001546001600160a01b031681565b6060600080846001600160a01b0316846040518082805190602001908083835b6020831061091d5780518252601f1990920191602091820191016108fe565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461097d576040519150601f19603f3d011682016040523d82523d6000602084013e610982565b606091505b50915091506000821415610997573d60208201fd5b94935050505056fe6f6e6c792070656e64696e6741646d696e2063616e206163636570742061646d696ea2646970667358221220dc71f6a4e2dfe48604092438994ce2392918a6182e4ce3bd7e64ed56ef6e3a0264736f6c634300070600330000000000000000000000008a2f01b39319de1dfe219090018b6f460e968e00000000000000000000000000c2e51ab824cc088cb5253e74963b00a15be7d23400000000000000000000000000000000000000000000000000000000000001000000000000000000000000004446fc4eb47f2f6586f9faab68b3498f86c07521000000000000000000000000c7ff25ad08aa8ea665cf78532f7317067cffb2900000000000000000000000000000000000000000000000000000000000000120000000000000000000000000ad0bfa476fb71215ba026ebe60ffa9b31d98efe70000000000000000000000007c0d5bf86427c02f6a841e28ff7cf2934aa83b3400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e

Deployed ByteCode

0x60806040526004361061008a5760003560e01c80634dd18bf5116100595780634dd18bf5146102c25780635c60da1b146102f5578063ca4b208b1461030a578063d784d4261461031f578063f851a4401461035257610099565b80630933c1ed146100a15780630e18b681146101c957806326782247146101de5780634487152f1461020f57610099565b3661009957610097610367565b005b610097610367565b3480156100ad57600080fd5b50610154600480360360208110156100c457600080fd5b8101906020810181356401000000008111156100df57600080fd5b8201836020820111156100f157600080fd5b8035906020019184600183028401116401000000008311171561011357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103f2945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d557600080fd5b50610097610411565b3480156101ea57600080fd5b506101f3610511565b604080516001600160a01b039092168252519081900360200190f35b34801561021b57600080fd5b506101546004803603602081101561023257600080fd5b81019060208101813564010000000081111561024d57600080fd5b82018360208201111561025f57600080fd5b8035906020019184600183028401116401000000008311171561028157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610520945050505050565b3480156102ce57600080fd5b50610097600480360360208110156102e557600080fd5b50356001600160a01b0316610740565b34801561030157600080fd5b506101f36107f9565b34801561031657600080fd5b506101f3610808565b34801561032b57600080fd5b506100976004803603602081101561034257600080fd5b50356001600160a01b0316610817565b34801561035e57600080fd5b506101f36108cf565b36156103f057600080546040516001600160a01b0390911690829036908083838082843760405192019450600093509091505080830381855af49150503d80600081146103d0576040519150601f19603f3d011682016040523d82523d6000602084013e6103d5565b606091505b505090506040513d6000823e8180156103ec573d82f35b3d82fd5b565b60005460609061040b906001600160a01b0316836108de565b92915050565b6002546001600160a01b0316331461045a5760405162461bcd60e51b81526004018080602001828103825260228152602001806109a06022913960400191505060405180910390fd5b60018054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a15050565b6002546001600160a01b031681565b6060600080306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b83811015610570578181015183820152602001610558565b50505050905090810190601f16801561059d5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b602083106105f85780518252601f1990920191602091820191016105d9565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610658576040519150601f19603f3d011682016040523d82523d6000602084013e61065d565b606091505b50915091506000821415610672573d60208201fd5b80806020019051602081101561068757600080fd5b81019080805160405193929190846401000000008211156106a757600080fd5b9083019060208201858111156106bc57600080fd5b82516401000000008111828201881017156106d657600080fd5b82525081516020918201929091019080838360005b838110156107035781810151838201526020016106eb565b50505050905090810190601f1680156107305780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b6001546001600160a01b03163314610796576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600280546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a15050565b6000546001600160a01b031681565b6003546001600160a01b031681565b6001546001600160a01b0316331461086d576040805162461bcd60e51b815260206004820152601460248201527331b0b63632b91036bab9ba1031329030b236b4b760611b604482015290519081900360640190fd5b600080546001600160a01b038381166001600160a01b0319831617928390556040805192821680845293909116602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a15050565b6001546001600160a01b031681565b6060600080846001600160a01b0316846040518082805190602001908083835b6020831061091d5780518252601f1990920191602091820191016108fe565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461097d576040519150601f19603f3d011682016040523d82523d6000602084013e610982565b606091505b50915091506000821415610997573d60208201fd5b94935050505056fe6f6e6c792070656e64696e6741646d696e2063616e206163636570742061646d696ea2646970667358221220dc71f6a4e2dfe48604092438994ce2392918a6182e4ce3bd7e64ed56ef6e3a0264736f6c63430007060033