ETH Price: $1,881.30 (-2.90%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TripleSlopeModel

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
/**
 *Submitted for verification at Etherscan.io on 2020-11-09
*/

// 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);
}

contract TripleSlopeModel {
    using SafeMath for uint256;

    /// @dev Return the interest rate per second, using 1e18 as denom.
    function getInterestRate(uint256 debt, uint256 floating) external pure returns (uint256) {
        uint256 total = debt.add(floating);
        uint256 utilization = debt.mul(100e18).div(total);
        if (utilization < 80e18) {
            // Less than 80% utilization - 0%-10% APY
            return utilization.mul(10e16).div(80e18) / 365 days;
        } else if (utilization < 90e18) {
            // Between 80% and 90% - 10% APY
            return uint256(10e16) / 365 days;
        } else if (utilization < 100e18) {
            // Between 90% and 100% - 10%-50% APY
            return (10e16 + utilization.sub(90e18).mul(40e16).div(10e18)) / 365 days;
        } else {
            // Not possible, but just in case - 50% APY
            return uint256(50e16) / 365 days;
        }
    }
}

Contract Security Audit

Contract ABI

API
[{"constant":true,"inputs":[{"internalType":"uint256","name":"debt","type":"uint256"},{"internalType":"uint256","name":"floating","type":"uint256"}],"name":"getInterestRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"}]

608060405234801561001057600080fd5b5061036b806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c6dfa13f14610030575b600080fd5b6100536004803603604081101561004657600080fd5b5080359060200135610065565b60408051918252519081900360200190f35b600080610078848463ffffffff61019416565b905060006100a5826100998768056bc75e2d6310000063ffffffff6101f516565b9063ffffffff61024e16565b90506804563918244f4000008110156100f3576301e133806100e26804563918244f4000006100998467016345785d8a000063ffffffff6101f516565b816100e957fe5b049250505061018e565b6804e1003b28d9280000811015610117576301e1338067016345785d8a00006100e9565b68056bc75e2d6310000081101561017b576301e1338061016a678ac7230489e8000061009967058d15e17628000061015e866804e1003b28d928000063ffffffff6102b816565b9063ffffffff6101f516565b67016345785d8a000001816100e957fe5b6301e133806706f05b59d3b200006100e9565b92915050565b6000828201838110156101ee576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000826102045750600061018e565b8282028284828161021157fe5b04146101ee5760405162461bcd60e51b81526004018080602001828103825260218152602001806103166021913960400191505060405180910390fd5b60008082116102a4576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816102af57fe5b04949350505050565b60008282111561030f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a7231582034886063f543cf4ca1402ccd652257853ce6cc33b082458dc44d7fdf2b6eaf2564736f6c63430005100032

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c6dfa13f14610030575b600080fd5b6100536004803603604081101561004657600080fd5b5080359060200135610065565b60408051918252519081900360200190f35b600080610078848463ffffffff61019416565b905060006100a5826100998768056bc75e2d6310000063ffffffff6101f516565b9063ffffffff61024e16565b90506804563918244f4000008110156100f3576301e133806100e26804563918244f4000006100998467016345785d8a000063ffffffff6101f516565b816100e957fe5b049250505061018e565b6804e1003b28d9280000811015610117576301e1338067016345785d8a00006100e9565b68056bc75e2d6310000081101561017b576301e1338061016a678ac7230489e8000061009967058d15e17628000061015e866804e1003b28d928000063ffffffff6102b816565b9063ffffffff6101f516565b67016345785d8a000001816100e957fe5b6301e133806706f05b59d3b200006100e9565b92915050565b6000828201838110156101ee576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000826102045750600061018e565b8282028284828161021157fe5b04146101ee5760405162461bcd60e51b81526004018080602001828103825260218152602001806103166021913960400191505060405180910390fd5b60008082116102a4576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816102af57fe5b04949350505050565b60008282111561030f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a7231582034886063f543cf4ca1402ccd652257853ce6cc33b082458dc44d7fdf2b6eaf2564736f6c63430005100032

Deployed Bytecode Sourcemap

7478:953:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7478:953:0;;;;;;;;;;;;;;;;;;;7618:810;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7618:810:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;7698:7;;7734:18;:4;7743:8;7734:18;:8;:18;:::i;:::-;7718:34;-1:-1:-1;7763:19:0;7785:27;7718:34;7785:16;:4;7794:6;7785:16;:8;:16;:::i;:::-;:20;:27;:20;:27;:::i;:::-;7763:49;;7841:5;7827:11;:19;7823:598;;;7961:8;7925:33;7952:5;7925:22;:11;7941:5;7925:22;:15;:22;:::i;:33::-;:44;;;;;;7918:51;;;;;;7823:598;8005:5;7991:11;:19;7987:434;;;8097:8;8088:5;8080:25;;7987:434;8141:6;8127:11;:20;8123:298;;;8279:8;8231:44;8269:5;8231:33;8258:5;8231:22;:11;8247:5;8231:22;:15;:22;:::i;:::-;:26;:33;:26;:33;:::i;:44::-;8223:5;:52;8222:65;;;;8123:298;8401:8;8392:5;8384:25;;7618:810;;;;;:::o;3397:181::-;3455:7;3487:5;;;3511:6;;;;3503:46;;;;;-1:-1:-1;;;3503:46:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;3569:1;3397:181;-1:-1:-1;;;3397:181:0:o;4288:470::-;4346:7;4590:6;4586:47;;-1:-1:-1;4620:1:0;4613:8;;4586:47;4657:5;;;4661:1;4657;:5;:1;4681:5;;;;;:10;4673:56;;;;-1:-1:-1;;;4673:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5226:333;5284:7;5383:1;5379;:5;5371:44;;;;;-1:-1:-1;;;5371:44:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;5426:9;5442:1;5438;:5;;;;;;;5226:333;-1:-1:-1;;;;5226:333:0:o;3853:184::-;3911:7;3944:1;3939;:6;;3931:49;;;;;-1:-1:-1;;;3931:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4003:5:0;;;3853:184::o

Swarm Source

bzzr://34886063f543cf4ca1402ccd652257853ce6cc33b082458dc44d7fdf2b6eaf25

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
Loading...
Loading
Loading...
Loading

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.