Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x97A49F8eeC63C0dFeB9dB4C791229477962dc692
Balance 0 ETH
Nonce 1
Code Size 2390 bytes
Indexed Transactions 0 (1 on-chain, 0.6% indexed)
External Etherscan · Sourcify

Contract Bytecode

2390 bytes
0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c80638da5cb5b11610097578063ad58e57311610066578063ad58e57314610310578063c6dfa13f1461033c578063e1ed42861461035f578063f2fde38b14610367576100ff565b80638da5cb5b146102b65780638f32d59b146102da578063a71d6f43146102e2578063ac165d7a14610308576100ff565b806328ae433e116100d357806328ae433e146101aa57806331baa138146101b2578063715018a61461027657806383801a881461027e576100ff565b80620237f014610104578063045d84ed1461013e57806309956f661461016457806313f6321b1461017e575b600080fd5b61012a6004803603602081101561011a57600080fd5b50356001600160a01b031661038d565b604080519115158252519081900360200190f35b61012a6004803603602081101561015457600080fd5b50356001600160a01b0316610414565b61016c610434565b60408051918252519081900360200190f35b61016c6004803603604081101561019457600080fd5b506001600160a01b03813516906020013561043a565b61016c6104cc565b610274600480360360408110156101c857600080fd5b8101906020810181356401000000008111156101e357600080fd5b8201836020820111156101f557600080fd5b8035906020019184602083028401116401000000008311171561021757600080fd5b91939092909160208101903564010000000081111561023557600080fd5b82018360208201111561024757600080fd5b8035906020019184602083028401116401000000008311171561026957600080fd5b5090925090506104d2565b005b6102746105de565b6102746004803603608081101561029457600080fd5b50803590602081013590604081013590606001356001600160a01b031661066f565b6102be6106e6565b604080516001600160a01b039092168252519081900360200190f35b61012a6106f5565b6102be600480360360208110156102f857600080fd5b50356001600160a01b0316610706565b6102be610721565b61016c6004803603604081101561032657600080fd5b506001600160a01b038135169060200135610730565b61016c6004803603604081101561035257600080fd5b508035906020013561078f565b61016c6107e2565b6102746004803603602081101561037d57600080fd5b50356001600160a01b03166107e8565b6001600160a01b03808216600081815260046020818152604080842054815161237f60e41b8152938401959095525192949390931692620237f092602480840193829003018186803b1580156103e257600080fd5b505afa1580156103f6573d6000803e3d6000fd5b505050506040513d602081101561040c57600080fd5b505192915050565b6001600160a01b0390811660009081526004602052604090205416151590565b60025481565b6001600160a01b0380831660008181526004602081815260408084205481516313f6321b60e01b8152938401959095526024830187905251929493909316926313f6321b92604480840193829003018186803b15801561049957600080fd5b505afa1580156104ad573d6000803e3d6000fd5b505050506040513d60208110156104c357600080fd5b50519392505050565b60035481565b6104da6106f5565b610519576040805162461bcd60e51b81526020600482018190526024820152600080516020610902833981519152604482015290519081900360640190fd5b82811461055a576040805162461bcd60e51b815260206004820152600a6024820152690c4c2c840d8cadccee8d60b31b604482015290519081900360640190fd5b60005b838110156105d75782828281811061057157fe5b905060200201356001600160a01b03166004600087878581811061059157fe5b6001600160a01b03602091820293909301358316845283019390935260409091016000208054939091166001600160a01b0319909316929092179091555060010161055d565b5050505050565b6105e66106f5565b610625576040805162461bcd60e51b81526020600482018190526024820152600080516020610902833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6106776106f5565b6106b6576040805162461bcd60e51b81526020600482018190526024820152600080516020610902833981519152604482015290519081900360640190fd5b600193909355600291909155600355600580546001600160a01b0319166001600160a01b03909216919091179055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b6004602052600090815260409020546001600160a01b031681565b6005546001600160a01b031681565b6001600160a01b03808316600081815260046020818152604080842054815163ad58e57360e01b81529384019590955260248301879052519294939093169263ad58e57392604480840193829003018186803b15801561049957600080fd5b6005546040805163c6dfa13f60e01b8152600481018590526024810184905290516000926001600160a01b03169163c6dfa13f916044808301926020929190829003018186803b15801561049957600080fd5b60015481565b6107f06106f5565b61082f576040805162461bcd60e51b81526020600482018190526024820152600080516020610902833981519152604482015290519081900360640190fd5b6108388161083b565b50565b6001600160a01b0381166108805760405162461bcd60e51b81526004018080602001828103825260268152602001806108dc6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a265627a7a7231582047650ea92699c2b091c42ea46e7edfa66ec02884533fca5d455a27d8b232864f64736f6c63430005100032

Verified Source Code Partial Match

Compiler: v0.5.16+commit.9c3226ce EVM: istanbul Optimization: Yes (200 runs)
ConfigurableInterestBankConfig.sol 315 lines
// File: openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol

pragma solidity ^0.5.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be aplied to your functions to restrict their use to
 * the owner.
 */
contract Ownable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * > Note: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// File: openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol

pragma solidity ^0.5.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, "SafeMath: division by zero");
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b != 0, "SafeMath: modulo by zero");
        return a % b;
    }
}

// File: contracts/BankConfig.sol

pragma solidity 0.5.16;

interface BankConfig {
    /// @dev Return minimum ETH debt size per position.
    function minDebtSize() external view returns (uint256);

    /// @dev Return the interest rate per second, using 1e18 as denom.
    function getInterestRate(uint256 debt, uint256 floating) external view returns (uint256);

    /// @dev Return the bps rate for reserve pool.
    function getReservePoolBps() external view returns (uint256);

    /// @dev Return the bps rate for Avada Kill caster.
    function getKillBps() external view returns (uint256);

    /// @dev Return whether the given address is a goblin.
    function isGoblin(address goblin) external view returns (bool);

    /// @dev Return whether the given goblin accepts more debt. Revert on non-goblin.
    function acceptDebt(address goblin) external view returns (bool);

    /// @dev Return the work factor for the goblin + ETH debt, using 1e4 as denom. Revert on non-goblin.
    function workFactor(address goblin, uint256 debt) external view returns (uint256);

    /// @dev Return the kill factor for the goblin + ETH debt, using 1e4 as denom. Revert on non-goblin.
    function killFactor(address goblin, uint256 debt) external view returns (uint256);
}

// File: contracts/GoblinConfig.sol

pragma solidity 0.5.16;

interface GoblinConfig {
    /// @dev Return whether the given goblin accepts more debt.
    function acceptDebt(address goblin) external view returns (bool);
    /// @dev Return the work factor for the goblin + ETH debt, using 1e4 as denom.
    function workFactor(address goblin, uint256 debt) external view returns (uint256);
    /// @dev Return the kill factor for the goblin + ETH debt, using 1e4 as denom.
    function killFactor(address goblin, uint256 debt) external view returns (uint256);
}

// File: contracts/ConfigurableInterestBankConfig.sol

pragma solidity 0.5.16;




interface InterestModel {
    /// @dev Return the interest rate per second, using 1e18 as denom.
    function getInterestRate(uint256 debt, uint256 floating) external view returns (uint256);
}


contract ConfigurableInterestBankConfig is BankConfig, Ownable {
    /// The minimum ETH debt size per position.
    uint256 public minDebtSize;
    /// The portion of interests allocated to the reserve pool.
    uint256 public getReservePoolBps;
    /// The reward for successfully killing a position.
    uint256 public getKillBps;
    /// Mapping for goblin address to its configuration.
    mapping (address => GoblinConfig) public goblins;
    /// Interest rate model
    InterestModel public interestModel;

    constructor(
        uint256 _minDebtSize,
        uint256 _reservePoolBps,
        uint256 _killBps,
        InterestModel _interestModel
    ) public {
        setParams(_minDebtSize, _reservePoolBps, _killBps, _interestModel);
    }

    /// @dev Set all the basic parameters. Must only be called by the owner.
    /// @param _minDebtSize The new minimum debt size value.
    /// @param _reservePoolBps The new interests allocated to the reserve pool value.
    /// @param _killBps The new reward for killing a position value.
    /// @param _interestModel The new interest rate model contract.
    function setParams(
        uint256 _minDebtSize,
        uint256 _reservePoolBps,
        uint256 _killBps,
        InterestModel _interestModel
    ) public onlyOwner {
        minDebtSize = _minDebtSize;
        getReservePoolBps = _reservePoolBps;
        getKillBps = _killBps;
        interestModel = _interestModel;
    }

    /// @dev Set the configuration for the given goblins. Must only be called by the owner.
    function setGoblins(address[] calldata addrs, GoblinConfig[] calldata configs) external onlyOwner {
        require(addrs.length == configs.length, "bad length");
        for (uint256 idx = 0; idx < addrs.length; idx++) {
            goblins[addrs[idx]] = configs[idx];
        }
    }

    /// @dev Return the interest rate per second, using 1e18 as denom.
    function getInterestRate(uint256 debt, uint256 floating) external view returns (uint256) {
        return interestModel.getInterestRate(debt, floating);
    }

    /// @dev Return whether the given address is a goblin.
    function isGoblin(address goblin) external view returns (bool) {
        return address(goblins[goblin]) != address(0);
    }

    /// @dev Return whether the given goblin accepts more debt. Revert on non-goblin.
    function acceptDebt(address goblin) external view returns (bool) {
        return goblins[goblin].acceptDebt(goblin);
    }

    /// @dev Return the work factor for the goblin + ETH debt, using 1e4 as denom. Revert on non-goblin.
    function workFactor(address goblin, uint256 debt) external view returns (uint256) {
        return goblins[goblin].workFactor(goblin, debt);
    }

    /// @dev Return the kill factor for the goblin + ETH debt, using 1e4 as denom. Revert on non-goblin.
    function killFactor(address goblin, uint256 debt) external view returns (uint256) {
        return goblins[goblin].killFactor(goblin, debt);
    }
}

Read Contract

acceptDebt 0x000237f0 → bool
getInterestRate 0xc6dfa13f → uint256
getKillBps 0x28ae433e → uint256
getReservePoolBps 0x09956f66 → uint256
goblins 0xa71d6f43 → address
interestModel 0xac165d7a → address
isGoblin 0x045d84ed → bool
isOwner 0x8f32d59b → bool
killFactor 0x13f6321b → uint256
minDebtSize 0xe1ed4286 → uint256
owner 0x8da5cb5b → address
workFactor 0xad58e573 → uint256

Write Contract 4 functions

These functions modify contract state and require a wallet transaction to execute.

renounceOwnership 0x715018a6
No parameters
setGoblins 0x31baa138
address[] addrs
address[] configs
setParams 0x83801a88
uint256 _minDebtSize
uint256 _reservePoolBps
uint256 _killBps
address _interestModel
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

This address has 1 on-chain transactions, but only 0.6% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →