Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PolynomialInterestSetter
Compiler Version
v0.5.9+commit.e560f70d
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2019-06-12
*/
/*
Copyright 2019 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.5.9;
pragma experimental ABIEncoderV2;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on 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);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: contracts/protocol/lib/Require.sol
/**
* @title Require
* @author dYdX
*
* Stringifies parameters to pretty-print revert messages. Costs more gas than regular require()
*/
library Require {
// ============ Constants ============
uint256 constant ASCII_ZERO = 48; // '0'
uint256 constant ASCII_RELATIVE_ZERO = 87; // 'a' - 10
uint256 constant ASCII_LOWER_EX = 120; // 'x'
bytes2 constant COLON = 0x3a20; // ': '
bytes2 constant COMMA = 0x2c20; // ', '
bytes2 constant LPAREN = 0x203c; // ' <'
byte constant RPAREN = 0x3e; // '>'
uint256 constant FOUR_BIT_MASK = 0xf;
// ============ Library Functions ============
function that(
bool must,
bytes32 file,
bytes32 reason
)
internal
pure
{
if (!must) {
revert(
string(
abi.encodePacked(
stringify(file),
COLON,
stringify(reason)
)
)
);
}
}
function that(
bool must,
bytes32 file,
bytes32 reason,
uint256 payloadA
)
internal
pure
{
if (!must) {
revert(
string(
abi.encodePacked(
stringify(file),
COLON,
stringify(reason),
LPAREN,
stringify(payloadA),
RPAREN
)
)
);
}
}
function that(
bool must,
bytes32 file,
bytes32 reason,
uint256 payloadA,
uint256 payloadB
)
internal
pure
{
if (!must) {
revert(
string(
abi.encodePacked(
stringify(file),
COLON,
stringify(reason),
LPAREN,
stringify(payloadA),
COMMA,
stringify(payloadB),
RPAREN
)
)
);
}
}
function that(
bool must,
bytes32 file,
bytes32 reason,
address payloadA
)
internal
pure
{
if (!must) {
revert(
string(
abi.encodePacked(
stringify(file),
COLON,
stringify(reason),
LPAREN,
stringify(payloadA),
RPAREN
)
)
);
}
}
function that(
bool must,
bytes32 file,
bytes32 reason,
address payloadA,
uint256 payloadB
)
internal
pure
{
if (!must) {
revert(
string(
abi.encodePacked(
stringify(file),
COLON,
stringify(reason),
LPAREN,
stringify(payloadA),
COMMA,
stringify(payloadB),
RPAREN
)
)
);
}
}
function that(
bool must,
bytes32 file,
bytes32 reason,
address payloadA,
uint256 payloadB,
uint256 payloadC
)
internal
pure
{
if (!must) {
revert(
string(
abi.encodePacked(
stringify(file),
COLON,
stringify(reason),
LPAREN,
stringify(payloadA),
COMMA,
stringify(payloadB),
COMMA,
stringify(payloadC),
RPAREN
)
)
);
}
}
// ============ Private Functions ============
function stringify(
bytes32 input
)
private
pure
returns (bytes memory)
{
// put the input bytes into the result
bytes memory result = abi.encodePacked(input);
// determine the length of the input by finding the location of the last non-zero byte
for (uint256 i = 32; i > 0; ) {
// reverse-for-loops with unsigned integer
/* solium-disable-next-line security/no-modify-for-iter-var */
i--;
// find the last non-zero byte in order to determine the length
if (result[i] != 0) {
uint256 length = i + 1;
/* solium-disable-next-line security/no-inline-assembly */
assembly {
mstore(result, length) // r.length = length;
}
return result;
}
}
// all bytes are zero
return new bytes(0);
}
function stringify(
uint256 input
)
private
pure
returns (bytes memory)
{
if (input == 0) {
return "0";
}
// get the final string length
uint256 j = input;
uint256 length;
while (j != 0) {
length++;
j /= 10;
}
// allocate the string
bytes memory bstr = new bytes(length);
// populate the string starting with the least-significant character
j = input;
for (uint256 i = length; i > 0; ) {
// reverse-for-loops with unsigned integer
/* solium-disable-next-line security/no-modify-for-iter-var */
i--;
// take last decimal digit
bstr[i] = byte(uint8(ASCII_ZERO + (j % 10)));
// remove the last decimal digit
j /= 10;
}
return bstr;
}
function stringify(
address input
)
private
pure
returns (bytes memory)
{
uint256 z = uint256(input);
// addresses are "0x" followed by 20 bytes of data which take up 2 characters each
bytes memory result = new bytes(42);
// populate the result with "0x"
result[0] = byte(uint8(ASCII_ZERO));
result[1] = byte(uint8(ASCII_LOWER_EX));
// for each byte (starting from the lowest byte), populate the result with two characters
for (uint256 i = 0; i < 20; i++) {
// each byte takes two characters
uint256 shift = i * 2;
// populate the least-significant character
result[41 - shift] = char(z & FOUR_BIT_MASK);
z = z >> 4;
// populate the most-significant character
result[40 - shift] = char(z & FOUR_BIT_MASK);
z = z >> 4;
}
return result;
}
function char(
uint256 input
)
private
pure
returns (byte)
{
// return ASCII digit (0-9)
if (input < 10) {
return byte(uint8(input + ASCII_ZERO));
}
// return ASCII letter (a-f)
return byte(uint8(input + ASCII_RELATIVE_ZERO));
}
}
// File: contracts/protocol/lib/Math.sol
/**
* @title Math
* @author dYdX
*
* Library for non-standard Math functions
*/
library Math {
using SafeMath for uint256;
// ============ Constants ============
bytes32 constant FILE = "Math";
// ============ Library Functions ============
/*
* Return target * (numerator / denominator).
*/
function getPartial(
uint256 target,
uint256 numerator,
uint256 denominator
)
internal
pure
returns (uint256)
{
return target.mul(numerator).div(denominator);
}
/*
* Return target * (numerator / denominator), but rounded up.
*/
function getPartialRoundUp(
uint256 target,
uint256 numerator,
uint256 denominator
)
internal
pure
returns (uint256)
{
if (target == 0 || numerator == 0) {
// SafeMath will check for zero denominator
return SafeMath.div(0, denominator);
}
return target.mul(numerator).sub(1).div(denominator).add(1);
}
function to128(
uint256 number
)
internal
pure
returns (uint128)
{
uint128 result = uint128(number);
Require.that(
result == number,
FILE,
"Unsafe cast to uint128"
);
return result;
}
function to96(
uint256 number
)
internal
pure
returns (uint96)
{
uint96 result = uint96(number);
Require.that(
result == number,
FILE,
"Unsafe cast to uint96"
);
return result;
}
function to32(
uint256 number
)
internal
pure
returns (uint32)
{
uint32 result = uint32(number);
Require.that(
result == number,
FILE,
"Unsafe cast to uint32"
);
return result;
}
function min(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
return a < b ? a : b;
}
function max(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
return a > b ? a : b;
}
}
// File: contracts/protocol/lib/Decimal.sol
/**
* @title Decimal
* @author dYdX
*
* Library that defines a fixed-point number with 18 decimal places.
*/
library Decimal {
using SafeMath for uint256;
// ============ Constants ============
uint256 constant BASE = 10**18;
// ============ Structs ============
struct D256 {
uint256 value;
}
// ============ Functions ============
function one()
internal
pure
returns (D256 memory)
{
return D256({ value: BASE });
}
function onePlus(
D256 memory d
)
internal
pure
returns (D256 memory)
{
return D256({ value: d.value.add(BASE) });
}
function mul(
uint256 target,
D256 memory d
)
internal
pure
returns (uint256)
{
return Math.getPartial(target, d.value, BASE);
}
function div(
uint256 target,
D256 memory d
)
internal
pure
returns (uint256)
{
return Math.getPartial(target, BASE, d.value);
}
}
// File: contracts/protocol/lib/Time.sol
/**
* @title Time
* @author dYdX
*
* Library for dealing with time, assuming timestamps fit within 32 bits (valid until year 2106)
*/
library Time {
// ============ Library Functions ============
function currentTime()
internal
view
returns (uint32)
{
return Math.to32(block.timestamp);
}
}
// File: contracts/protocol/lib/Types.sol
/**
* @title Types
* @author dYdX
*
* Library for interacting with the basic structs used in Solo
*/
library Types {
using Math for uint256;
// ============ AssetAmount ============
enum AssetDenomination {
Wei, // the amount is denominated in wei
Par // the amount is denominated in par
}
enum AssetReference {
Delta, // the amount is given as a delta from the current value
Target // the amount is given as an exact number to end up at
}
struct AssetAmount {
bool sign; // true if positive
AssetDenomination denomination;
AssetReference ref;
uint256 value;
}
// ============ Par (Principal Amount) ============
// Total borrow and supply values for a market
struct TotalPar {
uint128 borrow;
uint128 supply;
}
// Individual principal amount for an account
struct Par {
bool sign; // true if positive
uint128 value;
}
function zeroPar()
internal
pure
returns (Par memory)
{
return Par({
sign: false,
value: 0
});
}
function sub(
Par memory a,
Par memory b
)
internal
pure
returns (Par memory)
{
return add(a, negative(b));
}
function add(
Par memory a,
Par memory b
)
internal
pure
returns (Par memory)
{
Par memory result;
if (a.sign == b.sign) {
result.sign = a.sign;
result.value = SafeMath.add(a.value, b.value).to128();
} else {
if (a.value >= b.value) {
result.sign = a.sign;
result.value = SafeMath.sub(a.value, b.value).to128();
} else {
result.sign = b.sign;
result.value = SafeMath.sub(b.value, a.value).to128();
}
}
return result;
}
function equals(
Par memory a,
Par memory b
)
internal
pure
returns (bool)
{
if (a.value == b.value) {
if (a.value == 0) {
return true;
}
return a.sign == b.sign;
}
return false;
}
function negative(
Par memory a
)
internal
pure
returns (Par memory)
{
return Par({
sign: !a.sign,
value: a.value
});
}
function isNegative(
Par memory a
)
internal
pure
returns (bool)
{
return !a.sign && a.value > 0;
}
function isPositive(
Par memory a
)
internal
pure
returns (bool)
{
return a.sign && a.value > 0;
}
function isZero(
Par memory a
)
internal
pure
returns (bool)
{
return a.value == 0;
}
// ============ Wei (Token Amount) ============
// Individual token amount for an account
struct Wei {
bool sign; // true if positive
uint256 value;
}
function zeroWei()
internal
pure
returns (Wei memory)
{
return Wei({
sign: false,
value: 0
});
}
function sub(
Wei memory a,
Wei memory b
)
internal
pure
returns (Wei memory)
{
return add(a, negative(b));
}
function add(
Wei memory a,
Wei memory b
)
internal
pure
returns (Wei memory)
{
Wei memory result;
if (a.sign == b.sign) {
result.sign = a.sign;
result.value = SafeMath.add(a.value, b.value);
} else {
if (a.value >= b.value) {
result.sign = a.sign;
result.value = SafeMath.sub(a.value, b.value);
} else {
result.sign = b.sign;
result.value = SafeMath.sub(b.value, a.value);
}
}
return result;
}
function equals(
Wei memory a,
Wei memory b
)
internal
pure
returns (bool)
{
if (a.value == b.value) {
if (a.value == 0) {
return true;
}
return a.sign == b.sign;
}
return false;
}
function negative(
Wei memory a
)
internal
pure
returns (Wei memory)
{
return Wei({
sign: !a.sign,
value: a.value
});
}
function isNegative(
Wei memory a
)
internal
pure
returns (bool)
{
return !a.sign && a.value > 0;
}
function isPositive(
Wei memory a
)
internal
pure
returns (bool)
{
return a.sign && a.value > 0;
}
function isZero(
Wei memory a
)
internal
pure
returns (bool)
{
return a.value == 0;
}
}
// File: contracts/protocol/lib/Interest.sol
/**
* @title Interest
* @author dYdX
*
* Library for managing the interest rate and interest indexes of Solo
*/
library Interest {
using Math for uint256;
using SafeMath for uint256;
// ============ Constants ============
bytes32 constant FILE = "Interest";
uint64 constant BASE = 10**18;
// ============ Structs ============
struct Rate {
uint256 value;
}
struct Index {
uint96 borrow;
uint96 supply;
uint32 lastUpdate;
}
// ============ Library Functions ============
/**
* Get a new market Index based on the old index and market interest rate.
* Calculate interest for borrowers by using the formula rate * time. Approximates
* continuously-compounded interest when called frequently, but is much more
* gas-efficient to calculate. For suppliers, the interest rate is adjusted by the earningsRate,
* then prorated the across all suppliers.
*
* @param index The old index for a market
* @param rate The current interest rate of the market
* @param totalPar The total supply and borrow par values of the market
* @param earningsRate The portion of the interest that is forwarded to the suppliers
* @return The updated index for a market
*/
function calculateNewIndex(
Index memory index,
Rate memory rate,
Types.TotalPar memory totalPar,
Decimal.D256 memory earningsRate
)
internal
view
returns (Index memory)
{
(
Types.Wei memory supplyWei,
Types.Wei memory borrowWei
) = totalParToWei(totalPar, index);
// get interest increase for borrowers
uint32 currentTime = Time.currentTime();
uint256 borrowInterest = rate.value.mul(uint256(currentTime).sub(index.lastUpdate));
// get interest increase for suppliers
uint256 supplyInterest;
if (Types.isZero(supplyWei)) {
supplyInterest = 0;
} else {
supplyInterest = Decimal.mul(borrowInterest, earningsRate);
if (borrowWei.value < supplyWei.value) {
supplyInterest = Math.getPartial(supplyInterest, borrowWei.value, supplyWei.value);
}
}
assert(supplyInterest <= borrowInterest);
return Index({
borrow: Math.getPartial(index.borrow, borrowInterest, BASE).add(index.borrow).to96(),
supply: Math.getPartial(index.supply, supplyInterest, BASE).add(index.supply).to96(),
lastUpdate: currentTime
});
}
function newIndex()
internal
view
returns (Index memory)
{
return Index({
borrow: BASE,
supply: BASE,
lastUpdate: Time.currentTime()
});
}
/*
* Convert a principal amount to a token amount given an index.
*/
function parToWei(
Types.Par memory input,
Index memory index
)
internal
pure
returns (Types.Wei memory)
{
uint256 inputValue = uint256(input.value);
if (input.sign) {
return Types.Wei({
sign: true,
value: inputValue.getPartial(index.supply, BASE)
});
} else {
return Types.Wei({
sign: false,
value: inputValue.getPartialRoundUp(index.borrow, BASE)
});
}
}
/*
* Convert a token amount to a principal amount given an index.
*/
function weiToPar(
Types.Wei memory input,
Index memory index
)
internal
pure
returns (Types.Par memory)
{
if (input.sign) {
return Types.Par({
sign: true,
value: input.value.getPartial(BASE, index.supply).to128()
});
} else {
return Types.Par({
sign: false,
value: input.value.getPartialRoundUp(BASE, index.borrow).to128()
});
}
}
/*
* Convert the total supply and borrow principal amounts of a market to total supply and borrow
* token amounts.
*/
function totalParToWei(
Types.TotalPar memory totalPar,
Index memory index
)
internal
pure
returns (Types.Wei memory, Types.Wei memory)
{
Types.Par memory supplyPar = Types.Par({
sign: true,
value: totalPar.supply
});
Types.Par memory borrowPar = Types.Par({
sign: false,
value: totalPar.borrow
});
Types.Wei memory supplyWei = parToWei(supplyPar, index);
Types.Wei memory borrowWei = parToWei(borrowPar, index);
return (supplyWei, borrowWei);
}
}
// File: contracts/protocol/interfaces/IInterestSetter.sol
/**
* @title IInterestSetter
* @author dYdX
*
* Interface that Interest Setters for Solo must implement in order to report interest rates.
*/
interface IInterestSetter {
// ============ Public Functions ============
/**
* Get the interest rate of a token given some borrowed and supplied amounts
*
* @param token The address of the ERC20 token for the market
* @param borrowWei The total borrowed token amount for the market
* @param supplyWei The total supplied token amount for the market
* @return The interest rate per second
*/
function getInterestRate(
address token,
uint256 borrowWei,
uint256 supplyWei
)
external
view
returns (Interest.Rate memory);
}
// File: contracts/external/interestsetters/PolynomialInterestSetter.sol
/**
* @title PolynomialInterestSetter
* @author dYdX
*
* Interest setter that sets interest based on a polynomial of the usage percentage of the market.
*/
contract PolynomialInterestSetter is
IInterestSetter
{
using Math for uint256;
using SafeMath for uint256;
// ============ Constants ============
uint256 constant PERCENT = 100;
uint256 constant BASE = 10 ** 18;
uint256 constant SECONDS_IN_A_YEAR = 60 * 60 * 24 * 365;
uint256 constant BYTE = 8;
// ============ Structs ============
struct PolyStorage {
uint128 maxAPR;
uint128 coefficients;
}
// ============ Storage ============
PolyStorage g_storage;
// ============ Constructor ============
constructor(
PolyStorage memory params
)
public
{
// verify that all coefficients add up to 100%
uint256 sumOfCoefficients = 0;
for (
uint256 coefficients = params.coefficients;
coefficients != 0;
coefficients >>= BYTE
) {
sumOfCoefficients += coefficients % 256;
}
require(
sumOfCoefficients == PERCENT,
"Coefficients must sum to 100"
);
// store the params
g_storage = params;
}
// ============ Public Functions ============
/**
* Get the interest rate given some borrowed and supplied amounts. The interest function is a
* polynomial function of the utilization (borrowWei / supplyWei) of the market.
*
* - If borrowWei > supplyWei then the utilization is considered to be equal to 1.
* - If both are zero, then the utilization is considered to be equal to 0.
*
* @return The interest rate per second (times 10 ** 18)
*/
function getInterestRate(
address /* token */,
uint256 borrowWei,
uint256 supplyWei
)
external
view
returns (Interest.Rate memory)
{
if (borrowWei == 0) {
return Interest.Rate({
value: 0
});
}
PolyStorage memory s = g_storage;
uint256 maxAPR = s.maxAPR;
if (borrowWei >= supplyWei) {
return Interest.Rate({
value: maxAPR / SECONDS_IN_A_YEAR
});
}
uint256 result = 0;
uint256 polynomial = BASE;
// for each non-zero coefficient...
uint256 coefficients = s.coefficients;
while (true) {
// gets the lowest-order byte
uint256 coefficient = coefficients % 256;
// if non-zero, add to result
if (coefficient != 0) {
// no safeAdd since there are at most 16 coefficients
// no safeMul since (coefficient < 256 && polynomial <= 10**18)
result += coefficient * polynomial;
// break if this is the last non-zero coefficient
if (coefficient == coefficients) {
break;
}
}
// increase the order of the polynomial term
// no safeDiv since supplyWei must be stricly larger than borrowWei
polynomial = polynomial.mul(borrowWei) / supplyWei;
// move to next coefficient
coefficients >>= BYTE;
}
// normalize the result
// no safeMul since result fits within 72 bits and maxAPR fits within 128 bits
// no safeDiv since the divisor is a non-zero constant
return Interest.Rate({
value: result * maxAPR / (SECONDS_IN_A_YEAR * BASE * PERCENT)
});
}
/**
* Get the maximum APR that this interestSetter will return. The actual APY may be higher
* depending on how often the interest is compounded.
*
* @return The maximum APR
*/
function getMaxAPR()
external
view
returns (uint256)
{
return g_storage.maxAPR;
}
/**
* Get all of the coefficients of the interest calculation, starting from the coefficient for
* the first-order utilization variable.
*
* @return The coefficients
*/
function getCoefficients()
external
view
returns (uint256[] memory)
{
// allocate new array with maximum of 16 coefficients
uint256[] memory result = new uint256[](16);
// add the coefficients to the array
uint256 numCoefficients = 0;
for (
uint256 coefficients = g_storage.coefficients;
coefficients != 0;
coefficients >>= BYTE
) {
result[numCoefficients] = coefficients % 256;
numCoefficients++;
}
// modify result.length to match numCoefficients
/* solium-disable-next-line security/no-inline-assembly */
assembly {
mstore(result, numCoefficients)
}
return result;
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"getMaxAPR","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCoefficients","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"borrowWei","type":"uint256"},{"name":"supplyWei","type":"uint256"}],"name":"getInterestRate","outputs":[{"components":[{"name":"value","type":"uint256"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"name":"maxAPR","type":"uint128"},{"name":"coefficients","type":"uint128"}],"name":"params","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]Contract Creation Code
608060405234801561001057600080fd5b5060405161068c38038061068c83398101604081905261002f9161013e565b60208101516000906001600160801b03165b8015610059576101008106919091019060081c610041565b506064811461009d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100949061019d565b60405180910390fd5b508051600080546020909301516001600160801b03908116700100000000000000000000000000000000029281166001600160801b0319909416939093179092161790556101ff565b6000604082840312156100f857600080fd5b61010260406101ad565b90506000610110848461012d565b82525060206101218484830161012d565b60208301525092915050565b8051610138816101e8565b92915050565b60006040828403121561015057600080fd5b600061015c84846100e6565b949350505050565b6000610171601c836101d3565b7f436f656666696369656e7473206d7573742073756d20746f2031303000000000815260200192915050565b6020808252810161013881610164565b6040518181016001600160401b03811182821017156101cb57600080fd5b604052919050565b90815260200190565b6001600160801b031690565b6101f1816101dc565b81146101fc57600080fd5b50565b61047e8061020e6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80631e68607a14610046578063afd4c8d614610064578063e8177dcf14610079575b600080fd5b61004e610099565b60405161005b91906103d9565b60405180910390f35b61006c6100b1565b60405161005b91906103ba565b61008c6100873660046102da565b61013e565b60405161005b91906103cb565b6000546fffffffffffffffffffffffffffffffff1690565b604080516010808252610220820190925260609182919060208201610200803883395050600080549293509170010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1690505b801561013657610100810683838151811061011d57fe5b602090810291909101015260019091019060081c610106565b508152905090565b61014661029a565b826101605750604080516020810190915260008152610263565b6101686102ad565b50604080518082019091526000546fffffffffffffffffffffffffffffffff8082168084527001000000000000000000000000000000009092041660208301528385106101d45760405180602001604052806301e1338083816101c757fe5b0481525092505050610263565b6020820151600090670de0b6b3a7640000906fffffffffffffffffffffffffffffffff165b60ff81168015610218578281028401935081811415610218575061023c565b87610229848b63ffffffff61026a16565b8161023057fe5b0492505060081c6101f9565b6040805160208101909152806b0a3098c68eb9427db8000000858702049052955050505050505b9392505050565b60008261027957506000610294565b8282028284828161028657fe5b041461029157600080fd5b90505b92915050565b6040518060200160405280600081525090565b604080518082019091526000808252602082015290565b80356102948161041b565b803561029481610432565b6000806000606084860312156102ef57600080fd5b60006102fb86866102c4565b935050602061030c868287016102cf565b925050604061031d868287016102cf565b9150509250925092565b600061033383836103ab565b505060200190565b6000610346826103ed565b61035081856103f1565b935061035b836103e7565b8060005b838110156103895781516103738882610327565b975061037e836103e7565b92505060010161035f565b509495945050505050565b805160208301906103a584826103ab565b50505050565b6103b481610418565b82525050565b60208082528101610263818461033b565b602081016102948284610394565b6020810161029482846103ab565b60200190565b5190565b90815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8216610294565b90565b610424816103fa565b811461042f57600080fd5b50565b6104248161041856fea365627a7a72305820d11f690d9450e8c835c9468078d3df320289c1c040cac902d5560726eb19a8f66c6578706572696d656e74616cf564736f6c634300050900400000000000000000000000000000000000000000000000000a688906bd8b00000000000000000000000000000000000000000000000000000055000000000f00
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631e68607a14610046578063afd4c8d614610064578063e8177dcf14610079575b600080fd5b61004e610099565b60405161005b91906103d9565b60405180910390f35b61006c6100b1565b60405161005b91906103ba565b61008c6100873660046102da565b61013e565b60405161005b91906103cb565b6000546fffffffffffffffffffffffffffffffff1690565b604080516010808252610220820190925260609182919060208201610200803883395050600080549293509170010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1690505b801561013657610100810683838151811061011d57fe5b602090810291909101015260019091019060081c610106565b508152905090565b61014661029a565b826101605750604080516020810190915260008152610263565b6101686102ad565b50604080518082019091526000546fffffffffffffffffffffffffffffffff8082168084527001000000000000000000000000000000009092041660208301528385106101d45760405180602001604052806301e1338083816101c757fe5b0481525092505050610263565b6020820151600090670de0b6b3a7640000906fffffffffffffffffffffffffffffffff165b60ff81168015610218578281028401935081811415610218575061023c565b87610229848b63ffffffff61026a16565b8161023057fe5b0492505060081c6101f9565b6040805160208101909152806b0a3098c68eb9427db8000000858702049052955050505050505b9392505050565b60008261027957506000610294565b8282028284828161028657fe5b041461029157600080fd5b90505b92915050565b6040518060200160405280600081525090565b604080518082019091526000808252602082015290565b80356102948161041b565b803561029481610432565b6000806000606084860312156102ef57600080fd5b60006102fb86866102c4565b935050602061030c868287016102cf565b925050604061031d868287016102cf565b9150509250925092565b600061033383836103ab565b505060200190565b6000610346826103ed565b61035081856103f1565b935061035b836103e7565b8060005b838110156103895781516103738882610327565b975061037e836103e7565b92505060010161035f565b509495945050505050565b805160208301906103a584826103ab565b50505050565b6103b481610418565b82525050565b60208082528101610263818461033b565b602081016102948284610394565b6020810161029482846103ab565b60200190565b5190565b90815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8216610294565b90565b610424816103fa565b811461042f57600080fd5b50565b6104248161041856fea365627a7a72305820d11f690d9450e8c835c9468078d3df320289c1c040cac902d5560726eb19a8f66c6578706572696d656e74616cf564736f6c63430005090040
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000a688906bd8b00000000000000000000000000000000000000000000000000000055000000000f00
-----Decoded View---------------
Arg [0] : params (tuple):
Arg [1] : maxAPR (uint128): 750000000000000000
Arg [2] : coefficients (uint128): 23925373020409600
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000a688906bd8b0000
Arg [1] : 0000000000000000000000000000000000000000000000000055000000000f00
Deployed Bytecode Sourcemap
26051:4978:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26051:4978:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;29889:127;;;:::i;:::-;;;;;;;;;;;;;;;;30228:798;;;:::i;:::-;;;;;;;;27751:1918;;;;;;;;;:::i;:::-;;;;;;;;29889:127;29960:7;29992:16;;;29889:127;:::o;30228:798::-;30428:17;;;30442:2;30428:17;;;;;;;;;30305:16;;;;30428:17;;;;17:15:-1;;105:10;30428:17:0;88:34:-1;-1:-1;;30504:23:0;30584:22;;30402:43;;-1:-1:-1;30504:23:0;30584:22;;;;;;-1:-1:-1;30542:247:0;30621:17;;30542:247;;30742:3;30727:12;:18;30701:6;30708:15;30701:23;;;;;;;;;;;;;;;;;:44;30760:17;;;;;26395:1;30653:21;30542:247;;;-1:-1:-1;30951:31:0;;30958:6;-1:-1:-1;30228:798:0;:::o;27751:1918::-;27919:20;;:::i;:::-;27961:14;27957:111;;-1:-1:-1;27999:57:0;;;;;;;;;-1:-1:-1;27999:57:0;;27992:64;;27957:111;28080:20;;:::i;:::-;-1:-1:-1;28080:32:0;;;;;;;;;28103:9;28080:32;;;;;;;;;;;;;;;;;28165:22;;;28161:144;;28211:82;;;;;;;;26344:18;28251:6;:26;;;;;;28211:82;;;28204:89;;;;;;28161:144;28452:14;;;;28317;;26290:8;;28429:37;;28477:878;28570:18;;;28652:16;;28648:411;;28865:10;28851:11;:24;28841:34;;;;28982:12;28967:11;:27;28963:81;;;29019:5;;;28963:81;29255:9;29227:25;:10;29242:9;29227:25;:14;:25;:::i;:::-;:37;;;;;;;-1:-1:-1;;26395:1:0;29322:21;28477:878;;;29559:102;;;;;;;;;;29614:34;29595:15;;;:54;29559:102;;29552:109;-1:-1:-1;;;;;;27751:1918:0;;;;;;:::o;956:433::-;1014:7;1258:6;1254:47;;-1:-1:-1;1288:1:0;1281:8;;1254:47;1325:5;;;1329:1;1325;:5;:1;1349:5;;;;;:10;1341:19;;;;;;1380:1;-1:-1:-1;956:433:0;;;;;:::o;26051:4978::-;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;-1:-1:-1;26051:4978:0;;;;;;;;:::o;5:130:-1:-;72:20;;97:33;72:20;97:33;;142:130;209:20;;234:33;209:20;234:33;;279:491;;;;417:2;405:9;396:7;392:23;388:32;385:2;;;433:1;430;423:12;385:2;468:1;485:53;530:7;510:9;485:53;;;475:63;;447:97;575:2;593:53;638:7;629:6;618:9;614:22;593:53;;;583:63;;554:98;683:2;701:53;746:7;737:6;726:9;722:22;701:53;;;691:63;;662:98;379:391;;;;;;778:173;;865:46;907:3;899:6;865:46;;;-1:-1;;940:4;931:14;;858:93;990:690;;1135:54;1183:5;1135:54;;;1202:86;1281:6;1276:3;1202:86;;;1195:93;;1309:56;1359:5;1309:56;;;1385:7;1413:1;1398:260;1423:6;1420:1;1417:13;1398:260;;;1490:6;1484:13;1511:63;1570:3;1555:13;1511:63;;;1504:70;;1591:60;1644:6;1591:60;;;1581:70;-1:-1;;1445:1;1438:9;1398:260;;;-1:-1;1671:3;;1114:566;-1:-1;;;;;1114:566;1739:315;1943:22;;1876:4;1867:14;;;1971:62;1871:3;1943:22;1971:62;;;1896:143;1849:205;;;;2061:103;2134:24;2152:5;2134:24;;;2129:3;2122:37;2116:48;;;2291:361;2459:2;2473:47;;;2444:18;;2534:108;2444:18;2628:6;2534:108;;2659:301;2821:2;2806:18;;2835:115;2810:9;2923:6;2835:115;;2967:213;3085:2;3070:18;;3099:71;3074:9;3143:6;3099:71;;3187:151;3311:4;3302:14;;3259:79;3345:137;3448:12;;3419:63;3605:178;3723:19;;;3772:4;3763:14;;3716:67;3791:91;;3962:42;3951:54;;3853:24;3934:76;4017:72;4079:5;4062:27;4096:117;4165:24;4183:5;4165:24;;;4158:5;4155:35;4145:2;;4204:1;4201;4194:12;4145:2;4139:74;;4220:117;4289:24;4307:5;4289:24;
Swarm Source
bzzr://d11f690d9450e8c835c9468078d3df320289c1c040cac902d5560726eb19a8f6
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.