ETH Price: $3,759.06 (-2.08%)
Gas: 13 Gwei

Contract

0xa94220fA11A854dA12856dcABaF97D8188F0B3EA
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60806040112496122020-11-13 13:25:341293 days ago1605273934IN
 Create: KeeperDaoTokenAdapter
0 ETH0.0217064840

Advanced mode:
Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
KeeperDaoTokenAdapter

Compiler Version
v0.6.5+commit.f956cc89

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 4 : KeeperDaoTokenAdapter.sol
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;

import { ERC20 } from "../../ERC20.sol";
import { TokenMetadata, Component } from "../../Structs.sol";
import { TokenAdapter } from "../TokenAdapter.sol";


/**
 * @dev KToken contract interface.
 * Only the functions required for KeeperDaoTokenAdapter contract are added.
 */
interface KToken {
    function underlying() external view returns (address);
}


/**
 * @dev LiquidityPoolV2 contract interface.
 * Only the functions required for KeeperDaoTokenAdapter contract are added.
 */
interface LiquidityPoolV2 {
    function borrowableBalance(address) external view returns (uint256);
}


/**
 * @title Token adapter for KTokens.
 * @dev Implementation of TokenAdapter interface.
 * @author Igor Sobolev <[email protected]>
 */
contract KeeperDaoTokenAdapter is TokenAdapter {

    address internal constant POOL = 0x53463cd0b074E5FDafc55DcE7B1C82ADF1a43B2E;

    /**
     * @return TokenMetadata struct with ERC20-style token info.
     * @dev Implementation of TokenAdapter interface function.
     */
    function getMetadata(address token) external view override returns (TokenMetadata memory) {
        return TokenMetadata({
            token: token,
            name: ERC20(token).name(),
            symbol: ERC20(token).symbol(),
            decimals: ERC20(token).decimals()
        });
    }

    /**
     * @return Array of Component structs with underlying tokens rates for the given token.
     * @dev Implementation of TokenAdapter interface function.
     */
    function getComponents(address token) external view override returns (Component[] memory) {
        Component[] memory underlyingTokens = new Component[](1);
        address underlyingToken = KToken(token).underlying();
        uint256 borrowableBalance = LiquidityPoolV2(POOL).borrowableBalance(underlyingToken);

        underlyingTokens[0] = Component({
            token: underlyingToken,
            tokenType: "ERC20",
            rate: borrowableBalance * 1e18 / ERC20(token).totalSupply()
        });

        return underlyingTokens;
    }
}

File 2 of 4 : ERC20.sol
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;


interface ERC20 {
    function approve(address, uint256) external returns (bool);
    function transfer(address, uint256) external returns (bool);
    function transferFrom(address, address, uint256) external returns (bool);
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint256);
    function balanceOf(address) external view returns (uint256);
}

File 3 of 4 : Structs.sol
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;


struct ProtocolBalance {
    ProtocolMetadata metadata;
    AdapterBalance[] adapterBalances;
}


struct ProtocolMetadata {
    string name;
    string description;
    string websiteURL;
    string iconURL;
    uint256 version;
}


struct AdapterBalance {
    AdapterMetadata metadata;
    FullTokenBalance[] balances;
}


struct AdapterMetadata {
    address adapterAddress;
    string adapterType; // "Asset", "Debt"
}


// token and its underlying tokens (if exist) balances
struct FullTokenBalance {
    TokenBalance base;
    TokenBalance[] underlying;
}


struct TokenBalance {
    TokenMetadata metadata;
    uint256 amount;
}


// ERC20-style token metadata
// 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE address is used for ETH
struct TokenMetadata {
    address token;
    string name;
    string symbol;
    uint8 decimals;
}


struct Component {
    address token;
    string tokenType;  // "ERC20" by default
    uint256 rate;  // price per full share (1e18)
}

File 4 of 4 : TokenAdapter.sol
// Copyright (C) 2020 Zerion Inc. <https://zerion.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;

import { TokenMetadata, Component } from "../Structs.sol";


/**
 * @title Token adapter interface.
 * @dev getMetadata() and getComponents() functions MUST be implemented.
 * @author Igor Sobolev <[email protected]>
 */
interface TokenAdapter {

    /**
     * @dev MUST return TokenMetadata struct with ERC20-style token info.
     * struct TokenMetadata {
     *     address token;
     *     string name;
     *     string symbol;
     *     uint8 decimals;
     * }
     */
    function getMetadata(address token) external view returns (TokenMetadata memory);

    /**
     * @dev MUST return array of Component structs with underlying tokens rates for the given token.
     * struct Component {
     *     address token;    // Address of token contract
     *     string tokenType; // Token type ("ERC20" by default)
     *     uint256 rate;     // Price per share (1e18)
     * }
     */
    function getComponents(address token) external view returns (Component[] memory);
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "evmVersion": "istanbul",
  "libraries": {
    "": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getComponents","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"tokenType","type":"string"},{"internalType":"uint256","name":"rate","type":"uint256"}],"internalType":"struct Component[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getMetadata","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct TokenMetadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506108dd806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632a50c1461461003b57806379b1833414610064575b600080fd5b61004e610049366004610574565b610084565b60405161005b91906107c2565b60405180910390f35b610077610072366004610574565b610286565b60405161005b9190610710565b61008c6104fc565b60405180608001604052808373ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b1580156100f957600080fd5b505afa15801561010d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261015391908101906105b3565b81526020018373ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561019e57600080fd5b505afa1580156101b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526101f891908101906105b3565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561024357600080fd5b505afa158015610257573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027b9190610684565b60ff16905292915050565b604080516001808252818301909252606091829190816020015b6102a861053d565b8152602001906001900390816102a057905050905060008373ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b15801561030557600080fd5b505afa158015610319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033d9190610597565b6040517f736158d00000000000000000000000000000000000000000000000000000000081529091506000907353463cd0b074e5fdafc55dce7b1c82adf1a43b2e9063736158d0906103939085906004016106ef565b60206040518083038186803b1580156103ab57600080fd5b505afa1580156103bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e3919061066c565b905060405180606001604052808373ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600581526020017f455243323000000000000000000000000000000000000000000000000000000081525081526020018673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561048d57600080fd5b505afa1580156104a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c5919061066c565b83670de0b6b3a764000002816104d757fe5b04815250836000815181106104e857fe5b602090810291909101015250909392505050565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001600060ff1681525090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081525090565b600060208284031215610585578081fd5b813561059081610882565b9392505050565b6000602082840312156105a8578081fd5b815161059081610882565b6000602082840312156105c4578081fd5b815167ffffffffffffffff808211156105db578283fd5b81840185601f8201126105ec578384fd5b80519250818311156105fc578384fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116820101818110848211171561063a578586fd5b604052838152818401602001871015610651578485fd5b610662846020830160208501610852565b9695505050505050565b60006020828403121561067d578081fd5b5051919050565b600060208284031215610695578081fd5b815160ff81168114610590578182fd5b600081518084526106bd816020860160208601610852565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60208082528251828201819052600091906040908185019080840286018301878501865b838110156107b4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08984030185528151606073ffffffffffffffffffffffffffffffffffffffff825116855288820151818a870152610796828701826106a5565b92890151958901959095525094870194925090860190600101610734565b509098975050505050505050565b60006020825273ffffffffffffffffffffffffffffffffffffffff83511660208301526020830151608060408401526107fe60a08401826106a5565b604085015191507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe084820301606085015261083981836106a5565b60ff606087015116608086015280935050505092915050565b60005b8381101561086d578181015183820152602001610855565b8381111561087c576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff811681146108a457600080fd5b5056fea2646970667358221220efc1e06ae90cf7aad69daee70c733eaa90f40916f0711ffcd7ebf5618befe5a264736f6c63430006050033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100365760003560e01c80632a50c1461461003b57806379b1833414610064575b600080fd5b61004e610049366004610574565b610084565b60405161005b91906107c2565b60405180910390f35b610077610072366004610574565b610286565b60405161005b9190610710565b61008c6104fc565b60405180608001604052808373ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b1580156100f957600080fd5b505afa15801561010d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261015391908101906105b3565b81526020018373ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561019e57600080fd5b505afa1580156101b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526101f891908101906105b3565b81526020018373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561024357600080fd5b505afa158015610257573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027b9190610684565b60ff16905292915050565b604080516001808252818301909252606091829190816020015b6102a861053d565b8152602001906001900390816102a057905050905060008373ffffffffffffffffffffffffffffffffffffffff16636f307dc36040518163ffffffff1660e01b815260040160206040518083038186803b15801561030557600080fd5b505afa158015610319573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033d9190610597565b6040517f736158d00000000000000000000000000000000000000000000000000000000081529091506000907353463cd0b074e5fdafc55dce7b1c82adf1a43b2e9063736158d0906103939085906004016106ef565b60206040518083038186803b1580156103ab57600080fd5b505afa1580156103bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e3919061066c565b905060405180606001604052808373ffffffffffffffffffffffffffffffffffffffff1681526020016040518060400160405280600581526020017f455243323000000000000000000000000000000000000000000000000000000081525081526020018673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561048d57600080fd5b505afa1580156104a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c5919061066c565b83670de0b6b3a764000002816104d757fe5b04815250836000815181106104e857fe5b602090810291909101015250909392505050565b6040518060800160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001600060ff1681525090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081525090565b600060208284031215610585578081fd5b813561059081610882565b9392505050565b6000602082840312156105a8578081fd5b815161059081610882565b6000602082840312156105c4578081fd5b815167ffffffffffffffff808211156105db578283fd5b81840185601f8201126105ec578384fd5b80519250818311156105fc578384fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f860116820101818110848211171561063a578586fd5b604052838152818401602001871015610651578485fd5b610662846020830160208501610852565b9695505050505050565b60006020828403121561067d578081fd5b5051919050565b600060208284031215610695578081fd5b815160ff81168114610590578182fd5b600081518084526106bd816020860160208601610852565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60208082528251828201819052600091906040908185019080840286018301878501865b838110156107b4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08984030185528151606073ffffffffffffffffffffffffffffffffffffffff825116855288820151818a870152610796828701826106a5565b92890151958901959095525094870194925090860190600101610734565b509098975050505050505050565b60006020825273ffffffffffffffffffffffffffffffffffffffff83511660208301526020830151608060408401526107fe60a08401826106a5565b604085015191507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe084820301606085015261083981836106a5565b60ff606087015116608086015280935050505092915050565b60005b8381101561086d578181015183820152602001610855565b8381111561087c576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff811681146108a457600080fd5b5056fea2646970667358221220efc1e06ae90cf7aad69daee70c733eaa90f40916f0711ffcd7ebf5618befe5a264736f6c63430006050033

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  ]

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.