Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
Latest 1 internal transaction
Advanced mode:
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
14554594 | 599 days 3 hrs ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
Publican
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 8000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2022-04-10 */ // SPDX-License-Identifier: AGPL-3.0-or-later // Copyright (C) 2018 Rain <[email protected]> pragma solidity ^0.8.4; interface ICodex { function init(address vault) external; function setParam(bytes32 param, uint256 data) external; function setParam( address, bytes32, uint256 ) external; function credit(address) external view returns (uint256); function unbackedDebt(address) external view returns (uint256); function balances( address, uint256, address ) external view returns (uint256); function vaults(address vault) external view returns ( uint256 totalNormalDebt, uint256 rate, uint256 debtCeiling, uint256 debtFloor ); function positions( address vault, uint256 tokenId, address position ) external view returns (uint256 collateral, uint256 normalDebt); function globalDebt() external view returns (uint256); function globalUnbackedDebt() external view returns (uint256); function globalDebtCeiling() external view returns (uint256); function delegates(address, address) external view returns (uint256); function grantDelegate(address) external; function revokeDelegate(address) external; function modifyBalance( address, uint256, address, int256 ) external; function transferBalance( address vault, uint256 tokenId, address src, address dst, uint256 amount ) external; function transferCredit( address src, address dst, uint256 amount ) external; function modifyCollateralAndDebt( address vault, uint256 tokenId, address user, address collateralizer, address debtor, int256 deltaCollateral, int256 deltaNormalDebt ) external; function transferCollateralAndDebt( address vault, uint256 tokenId, address src, address dst, int256 deltaCollateral, int256 deltaNormalDebt ) external; function confiscateCollateralAndDebt( address vault, uint256 tokenId, address user, address collateralizer, address debtor, int256 deltaCollateral, int256 deltaNormalDebt ) external; function settleUnbackedDebt(uint256 debt) external; function createUnbackedDebt( address debtor, address creditor, uint256 debt ) external; function modifyRate( address vault, address creditor, int256 rate ) external; function lock() external; } // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } interface IDebtAuction { function auctions(uint256) external view returns ( uint256, uint256, address, uint48, uint48 ); function codex() external view returns (ICodex); function token() external view returns (IERC20); function minBidBump() external view returns (uint256); function tokenToSellBump() external view returns (uint256); function bidDuration() external view returns (uint48); function auctionDuration() external view returns (uint48); function auctionCounter() external view returns (uint256); function live() external view returns (uint256); function aer() external view returns (address); function setParam(bytes32 param, uint256 data) external; function startAuction( address recipient, uint256 tokensToSell, uint256 bid ) external returns (uint256 id); function redoAuction(uint256 id) external; function submitBid( uint256 id, uint256 tokensToSell, uint256 bid ) external; function closeAuction(uint256 id) external; function lock() external; function cancelAuction(uint256 id) external; } interface ISurplusAuction { function auctions(uint256) external view returns ( uint256, uint256, address, uint48, uint48 ); function codex() external view returns (ICodex); function token() external view returns (IERC20); function minBidBump() external view returns (uint256); function bidDuration() external view returns (uint48); function auctionDuration() external view returns (uint48); function auctionCounter() external view returns (uint256); function live() external view returns (uint256); function setParam(bytes32 param, uint256 data) external; function startAuction(uint256 creditToSell, uint256 bid) external returns (uint256 id); function redoAuction(uint256 id) external; function submitBid( uint256 id, uint256 creditToSell, uint256 bid ) external; function closeAuction(uint256 id) external; function lock(uint256 credit) external; function cancelAuction(uint256 id) external; } interface IAer { function codex() external view returns (ICodex); function surplusAuction() external view returns (ISurplusAuction); function debtAuction() external view returns (IDebtAuction); function debtQueue(uint256) external view returns (uint256); function queuedDebt() external view returns (uint256); function debtOnAuction() external view returns (uint256); function auctionDelay() external view returns (uint256); function debtAuctionSellSize() external view returns (uint256); function debtAuctionBidSize() external view returns (uint256); function surplusAuctionSellSize() external view returns (uint256); function surplusBuffer() external view returns (uint256); function live() external view returns (uint256); function setParam(bytes32 param, uint256 data) external; function setParam(bytes32 param, address data) external; function queueDebt(uint256 debt) external; function unqueueDebt(uint256 queuedAt) external; function settleDebtWithSurplus(uint256 debt) external; function settleAuctionedDebt(uint256 debt) external; function startDebtAuction() external returns (uint256 auctionId); function startSurplusAuction() external returns (uint256 auctionId); function transferCredit(address to, uint256 credit) external; function lock() external; }interface IPublican { function vaults(address vault) external view returns (uint256, uint256); function codex() external view returns (ICodex); function aer() external view returns (IAer); function baseInterest() external view returns (uint256); function init(address vault) external; function setParam( address vault, bytes32 param, uint256 data ) external; function setParam(bytes32 param, uint256 data) external; function setParam(bytes32 param, address data) external; function virtualRate(address vault) external returns (uint256 rate); function collect(address vault) external returns (uint256 rate); } interface IGuarded { function ANY_SIG() external view returns (bytes32); function ANY_CALLER() external view returns (address); function allowCaller(bytes32 sig, address who) external; function blockCaller(bytes32 sig, address who) external; function canCall(bytes32 sig, address who) external view returns (bool); } /// @title Guarded /// @notice Mixin implementing an authentication scheme on a method level abstract contract Guarded is IGuarded { /// ======== Custom Errors ======== /// error Guarded__notRoot(); error Guarded__notGranted(); /// ======== Storage ======== /// /// @notice Wildcard for granting a caller to call every guarded method bytes32 public constant override ANY_SIG = keccak256("ANY_SIG"); /// @notice Wildcard for granting a caller to call every guarded method address public constant override ANY_CALLER = address(uint160(uint256(bytes32(keccak256("ANY_CALLER"))))); /// @notice Mapping storing who is granted to which method /// @dev Method Signature => Caller => Bool mapping(bytes32 => mapping(address => bool)) private _canCall; /// ======== Events ======== /// event AllowCaller(bytes32 sig, address who); event BlockCaller(bytes32 sig, address who); constructor() { // set root _setRoot(msg.sender); } /// ======== Auth ======== /// modifier callerIsRoot() { if (_canCall[ANY_SIG][msg.sender]) { _; } else revert Guarded__notRoot(); } modifier checkCaller() { if (canCall(msg.sig, msg.sender)) { _; } else revert Guarded__notGranted(); } /// @notice Grant the right to call method `sig` to `who` /// @dev Only the root user (granted `ANY_SIG`) is able to call this method /// @param sig Method signature (4Byte) /// @param who Address of who should be able to call `sig` function allowCaller(bytes32 sig, address who) public override callerIsRoot { _canCall[sig][who] = true; emit AllowCaller(sig, who); } /// @notice Revoke the right to call method `sig` from `who` /// @dev Only the root user (granted `ANY_SIG`) is able to call this method /// @param sig Method signature (4Byte) /// @param who Address of who should not be able to call `sig` anymore function blockCaller(bytes32 sig, address who) public override callerIsRoot { _canCall[sig][who] = false; emit BlockCaller(sig, who); } /// @notice Returns if `who` can call `sig` /// @param sig Method signature (4Byte) /// @param who Address of who should be able to call `sig` function canCall(bytes32 sig, address who) public view override returns (bool) { return (_canCall[sig][who] || _canCall[ANY_SIG][who] || _canCall[sig][ANY_CALLER]); } /// @notice Sets the root user (granted `ANY_SIG`) /// @param root Address of who should be set as root function _setRoot(address root) internal { _canCall[ANY_SIG][root] = true; emit AllowCaller(ANY_SIG, root); } /// @notice Unsets the root user (granted `ANY_SIG`) /// @param root Address of who should be unset as root function _unsetRoot(address root) internal { _canCall[ANY_SIG][root] = false; emit AllowCaller(ANY_SIG, root); } }// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC. uint256 constant MLN = 10**6; uint256 constant BLN = 10**9; uint256 constant WAD = 10**18; uint256 constant RAY = 10**18; uint256 constant RAD = 10**18; /* solhint-disable func-visibility, no-inline-assembly */ error Math__toInt256_overflow(uint256 x); function toInt256(uint256 x) pure returns (int256) { if (x > uint256(type(int256).max)) revert Math__toInt256_overflow(x); return int256(x); } function min(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { z = x <= y ? x : y; } } function max(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { z = x >= y ? x : y; } } error Math__diff_overflow(uint256 x, uint256 y); function diff(uint256 x, uint256 y) pure returns (int256 z) { unchecked { z = int256(x) - int256(y); if (!(int256(x) >= 0 && int256(y) >= 0)) revert Math__diff_overflow(x, y); } } error Math__add_overflow(uint256 x, uint256 y); function add(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { if ((z = x + y) < x) revert Math__add_overflow(x, y); } } error Math__add48_overflow(uint256 x, uint256 y); function add48(uint48 x, uint48 y) pure returns (uint48 z) { unchecked { if ((z = x + y) < x) revert Math__add48_overflow(x, y); } } error Math__add_overflow_signed(uint256 x, int256 y); function add(uint256 x, int256 y) pure returns (uint256 z) { unchecked { z = x + uint256(y); if (!(y >= 0 || z <= x)) revert Math__add_overflow_signed(x, y); if (!(y <= 0 || z >= x)) revert Math__add_overflow_signed(x, y); } } error Math__sub_overflow(uint256 x, uint256 y); function sub(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { if ((z = x - y) > x) revert Math__sub_overflow(x, y); } } error Math__sub_overflow_signed(uint256 x, int256 y); function sub(uint256 x, int256 y) pure returns (uint256 z) { unchecked { z = x - uint256(y); if (!(y <= 0 || z <= x)) revert Math__sub_overflow_signed(x, y); if (!(y >= 0 || z >= x)) revert Math__sub_overflow_signed(x, y); } } error Math__mul_overflow(uint256 x, uint256 y); function mul(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { if (!(y == 0 || (z = x * y) / y == x)) revert Math__mul_overflow(x, y); } } error Math__mul_overflow_signed(uint256 x, int256 y); function mul(uint256 x, int256 y) pure returns (int256 z) { unchecked { z = int256(x) * y; if (int256(x) < 0) revert Math__mul_overflow_signed(x, y); if (!(y == 0 || z / y == int256(x))) revert Math__mul_overflow_signed(x, y); } } function wmul(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { z = mul(x, y) / WAD; } } function wmul(uint256 x, int256 y) pure returns (int256 z) { unchecked { z = mul(x, y) / int256(WAD); } } error Math__div_overflow(uint256 x, uint256 y); function div(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { if (y == 0) revert Math__div_overflow(x, y); return x / y; } } function wdiv(uint256 x, uint256 y) pure returns (uint256 z) { unchecked { z = mul(x, WAD) / y; } } // optimized version from dss PR #78 function wpow( uint256 x, uint256 n, uint256 b ) pure returns (uint256 z) { unchecked { assembly { switch n case 0 { z := b } default { switch x case 0 { z := 0 } default { switch mod(n, 2) case 0 { z := b } default { z := x } let half := div(b, 2) // for rounding. for { n := div(n, 2) } n { n := div(n, 2) } { let xx := mul(x, x) if shr(128, x) { revert(0, 0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0, 0) } x := div(xxRound, b) if mod(n, 2) { let zx := mul(z, x) if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0, 0) } let zxRound := add(zx, half) if lt(zxRound, zx) { revert(0, 0) } z := div(zxRound, b) } } } } } } } /* solhint-disable func-visibility, no-inline-assembly */ /// @title Publican /// @notice `Publican` is responsible for setting the debt interest rate and collecting interest /// Uses Jug.sol from DSS (MakerDAO) / TaxCollector.sol from GEB (Reflexer Labs) as a blueprint /// Changes from Jug.sol / TaxCollector.sol: /// - only WAD precision is used (no RAD and RAY) /// - uses a method signature based authentication scheme /// - configuration by Vaults contract Publican is Guarded, IPublican { /// ======== Custom Errors ======== /// error Publican__init_vaultAlreadyInit(); error Publican__setParam_notCollected(); error Publican__setParam_unrecognizedParam(); error Publican__collect_invalidBlockTimestamp(); /// ======== Storage ======== /// // Vault specific configuration data struct VaultConfig { // Collateral-specific, per-second stability fee contribution [wad] uint256 interestPerSecond; // Time of last drip [unix epoch time] uint256 lastCollected; } /// @notice Vault Configs /// @dev Vault => Vault Config mapping(address => VaultConfig) public override vaults; /// @notice Codex ICodex public immutable override codex; /// @notice Aer IAer public override aer; /// @notice Global, per-second stability fee contribution [wad] uint256 public override baseInterest; /// ======== Events ======== /// event Init(address indexed vault); event SetParam(bytes32 indexed param, uint256); event SetParam(bytes32 indexed param, address indexed data); event SetParam(address indexed vault, bytes32 indexed param, uint256 data); event Collect(address indexed vault); constructor(address codex_) Guarded() { codex = ICodex(codex_); } /// ======== Configuration ======== /// /// @notice Initializes a new Vault /// @dev Sender has to be allowed to call this method /// @param vault Address of the Vault function init(address vault) external override checkCaller { VaultConfig storage v = vaults[vault]; if (v.interestPerSecond != 0) revert Publican__init_vaultAlreadyInit(); v.interestPerSecond = WAD; v.lastCollected = block.timestamp; emit Init(vault); } /// @notice Sets various variables for a Vault /// @dev Sender has to be allowed to call this method /// @param vault Address of the Vault /// @param param Name of the variable to set /// @param data New value to set for the variable [wad] function setParam( address vault, bytes32 param, uint256 data ) external override checkCaller { if (block.timestamp != vaults[vault].lastCollected) revert Publican__setParam_notCollected(); if (param == "interestPerSecond") vaults[vault].interestPerSecond = data; else revert Publican__setParam_unrecognizedParam(); emit SetParam(vault, param, data); } /// @notice Sets various variables for this contract /// @dev Sender has to be allowed to call this method /// @param param Name of the variable to set /// @param data New value to set for the variable [wad] function setParam(bytes32 param, uint256 data) external override checkCaller { if (param == "baseInterest") baseInterest = data; else revert Publican__setParam_unrecognizedParam(); emit SetParam(param, data); } /// @notice Sets various variables for this contract /// @dev Sender has to be allowed to call this method /// @param param Name of the variable to set /// @param data New value to set for the variable [address] function setParam(bytes32 param, address data) external override checkCaller { if (param == "aer") aer = IAer(data); else revert Publican__setParam_unrecognizedParam(); emit SetParam(param, data); } /// ======== Interest Rates ======== /// /// @notice Returns the up to date rate (virtual rate) for a given vault as the rate stored in Codex /// might be outdated /// @param vault Address of the Vault /// @return rate Virtual rate function virtualRate(address vault) external view override returns (uint256 rate) { (, uint256 prev, , ) = codex.vaults(vault); if (block.timestamp < vaults[vault].lastCollected) return prev; rate = wmul( wpow( add(baseInterest, vaults[vault].interestPerSecond), sub(block.timestamp, vaults[vault].lastCollected), WAD ), prev ); } /// @notice Collects accrued interest from all Position on a Vault by updating the Vault's rate /// @param vault Address of the Vault /// @return rate Set rate function collect(address vault) public override returns (uint256 rate) { if (block.timestamp < vaults[vault].lastCollected) revert Publican__collect_invalidBlockTimestamp(); (, uint256 prev, , ) = codex.vaults(vault); rate = wmul( wpow( add(baseInterest, vaults[vault].interestPerSecond), sub(block.timestamp, vaults[vault].lastCollected), WAD ), prev ); codex.modifyRate(vault, address(aer), diff(rate, prev)); vaults[vault].lastCollected = block.timestamp; emit Collect(vault); } /// @notice Batches interest collection. See `collect(address vault)`. /// @param vaults_ Array of Vault addresses /// @return rates Set rates for each updated Vault function collectMany(address[] memory vaults_) external returns (uint256[] memory) { uint256[] memory rates = new uint256[](vaults_.length); for (uint256 i = 0; i < vaults_.length; i++) { rates[i] = collect(vaults_[i]); } return rates; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"codex_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Guarded__notGranted","type":"error"},{"inputs":[],"name":"Guarded__notRoot","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__add_overflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__diff_overflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__mul_overflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"}],"name":"Math__sub_overflow","type":"error"},{"inputs":[],"name":"Publican__collect_invalidBlockTimestamp","type":"error"},{"inputs":[],"name":"Publican__init_vaultAlreadyInit","type":"error"},{"inputs":[],"name":"Publican__setParam_notCollected","type":"error"},{"inputs":[],"name":"Publican__setParam_unrecognizedParam","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"sig","type":"bytes32"},{"indexed":false,"internalType":"address","name":"who","type":"address"}],"name":"AllowCaller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"sig","type":"bytes32"},{"indexed":false,"internalType":"address","name":"who","type":"address"}],"name":"BlockCaller","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"Init","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"param","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"SetParam","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"param","type":"bytes32"},{"indexed":true,"internalType":"address","name":"data","type":"address"}],"name":"SetParam","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"bytes32","name":"param","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"SetParam","type":"event"},{"inputs":[],"name":"ANY_CALLER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ANY_SIG","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aer","outputs":[{"internalType":"contract IAer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sig","type":"bytes32"},{"internalType":"address","name":"who","type":"address"}],"name":"allowCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"baseInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sig","type":"bytes32"},{"internalType":"address","name":"who","type":"address"}],"name":"blockCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sig","type":"bytes32"},{"internalType":"address","name":"who","type":"address"}],"name":"canCall","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"codex","outputs":[{"internalType":"contract ICodex","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"collect","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"vaults_","type":"address[]"}],"name":"collectMany","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"param","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"setParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"param","type":"bytes32"},{"internalType":"address","name":"data","type":"address"}],"name":"setParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"bytes32","name":"param","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"setParam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaults","outputs":[{"internalType":"uint256","name":"interestPerSecond","type":"uint256"},{"internalType":"uint256","name":"lastCollected","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"virtualRate","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b506040516114f33803806114f383398101604081905261002f916100e9565b61003833610049565b6001600160a01b0316608052610119565b6001600160a01b03811660008181527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b29006020908152604091829020805460ff1916600117905581517f13eb61d6467453b8d8e0d2a40b8dcee776dde376f951013dfdab1b9189651b618152908101929092527f9c21fb13a2f9c0e9222fe9a6810fe483b60248132981e1e0554bae602e93a9dd910160405180910390a150565b6000602082840312156100fb57600080fd5b81516001600160a01b038116811461011257600080fd5b9392505050565b6080516113aa6101496000396000818161018801528181610499015281816105ad01526109be01526113aa6000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80639fd9eaaf11610097578063bbd91c4611610066578063bbd91c4614610287578063edd1b0be146102ae578063ee53e637146102c1578063f63b0f3d146102e157600080fd5b80639fd9eaaf14610205578063a622ee7c14610218578063a746d48914610254578063b748b9fb1461026757600080fd5b80633092fac3116100d35780633092fac31461017a57806341779f861461018357806352b43adf146101cf5780639f30490a146101f257600080fd5b8063012abbe91461010557806306ec16f81461011a57806319ab453c146101405780632936ff2b14610153575b600080fd5b61011861011336600461108f565b6102f4565b005b61012d6101283660046110bb565b6103ef565b6040519081526020015b60405180910390f35b61011861014e3660046110bb565b6106c8565b61012d7f13eb61d6467453b8d8e0d2a40b8dcee776dde376f951013dfdab1b9189651b6181565b61012d60035481565b6101aa7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610137565b6101e26101dd36600461108f565b6107e1565b6040519015158152602001610137565b6101186102003660046110d6565b6108a0565b61012d6102133660046110bb565b610974565b61023f6102263660046110bb565b6001602081905260009182526040909120805491015482565b60408051928352602083019190915201610137565b61011861026236600461108f565b610aa9565b6002546101aa9073ffffffffffffffffffffffffffffffffffffffff1681565b6101aa7f48a48edb17b6277f3d9897feeb510d1503580c3997a055cb5a635e86f81c243a81565b6101186102bc36600461108f565b610b6d565b6102d46102cf366004611127565b610c4e565b604051610137919061120a565b6101186102ef36600461124e565b610cfc565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156103bd5760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558051858152918201929092527faec761575684e54a883064093131de012d7a9e8fc898f13474e50fcfbdce7d0b91015b60405180910390a15050565b6040517f6d6b83b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020819052604082200154421015610451576040517f3d418d2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fa622ee7c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063a622ee7c90602401608060405180830381865afa1580156104e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105069190611281565b505060035473ffffffffffffffffffffffffffffffffffffffff8616600090815260016020526040902054919350610590925061058a916105479190610e36565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600160208190526040909120015461057c904290610e82565b670de0b6b3a7640000610ec8565b82610f86565b60025490925073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169163472f0d6b918691166105e28686610fb0565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff8316600081815260016020819052604080832042920191909155517febc30f0f6830190d829077dd2f90a0c61437787593e0d5c7d1cf3e74d97fdee19190a250919050565b6106f67fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af5773ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020805415610759576040517f5309d5ca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b670de0b6b3a7640000815542600182015560405173ffffffffffffffffffffffffffffffffffffffff8316907f4f8cfde3439a1a302c21ca51eec26086efbfd940b8c0279889fc6bb6e73ecc6690600090a25050565b6040517faa68b5bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1680610861575073ffffffffffffffffffffffffffffffffffffffff821660009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff165b80610897575060008381526020818152604080832073eb510d1503580c3997a055cb5a635e86f81c243a845290915290205460ff165b90505b92915050565b6108ce7fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af57817f62617365496e746572657374000000000000000000000000000000000000000003610904576003819055610936565b6040517fee807d7400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817ff04ee4a7c5e0072de141f68fbec4aba82bfa0866ce04ad1f286b8602e0cbcfa68260405161096891815260200190565b60405180910390a25050565b6040517fa622ee7c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015260009182917f0000000000000000000000000000000000000000000000000000000000000000169063a622ee7c90602401608060405180830381865afa158015610a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a299190611281565b505073ffffffffffffffffffffffffffffffffffffffff8516600090815260016020819052604090912001549092504210159050610a675792915050565b60035473ffffffffffffffffffffffffffffffffffffffff8416600090815260016020526040902054610aa29161058a916105479190610e36565b9392505050565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156103bd5760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558051858152918201929092527f9c21fb13a2f9c0e9222fe9a6810fe483b60248132981e1e0554bae602e93a9dd91016103b1565b610b9b7fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af57817f61657200000000000000000000000000000000000000000000000000000000000361090457600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831617905560405173ffffffffffffffffffffffffffffffffffffffff82169083907fd473402183a624b7a23eb21bfd0a2863a628f61fb004edd801a2eab61ac2bd3d90600090a35050565b60606000825167ffffffffffffffff811115610c6c57610c6c6110f8565b604051908082528060200260200182016040528015610c95578160200160208202803683370190505b50905060005b8351811015610cf557610cc6848281518110610cb957610cb96112b7565b60200260200101516103ef565b828281518110610cd857610cd86112b7565b602090810291909101015280610ced816112e6565b915050610c9b565b5092915050565b610d2a7fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af5773ffffffffffffffffffffffffffffffffffffffff8316600090815260016020819052604090912001544214610d91576040517f9d64fee500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817f696e7465726573745065725365636f6e64000000000000000000000000000000036109045773ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260409020819055818373ffffffffffffffffffffffffffffffffffffffff167feae3e9da3f1d1474fb6ee1e0ad900272b38c9fd0c29d51b5f35a21823d0bbd4783604051610e2991815260200190565b60405180910390a3505050565b8082018281101561089a576040517f2c203e7200000000000000000000000000000000000000000000000000000000815260048101849052602481018390526044015b60405180910390fd5b8082038281111561089a576040517e5318ee0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610e79565b6000828015610f7a57848015610f6f57600185168015610eea57869350610eee565b8493505b50600284046002860495505b8515610f69578687028760801c15610f1157600080fd5b81810181811015610f2157600080fd5b8690049750506001861615610f5e578684028488820414158815151615610f4757600080fd5b81810181811015610f5757600080fd5b8690049450505b600286049550610efa565b50610f74565b600092505b50610f7e565b8291505b509392505050565b6000670de0b6b3a7640000610f9b8484611005565b81610fa857610fa8611345565b049392505050565b80820360008312801590610fc5575060008212155b61089a576040517fb57a92be0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610e79565b60008115806110265750508082028282828161102357611023611345565b04145b61089a576040517fa3b82a410000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610e79565b803573ffffffffffffffffffffffffffffffffffffffff8116811461108a57600080fd5b919050565b600080604083850312156110a257600080fd5b823591506110b260208401611066565b90509250929050565b6000602082840312156110cd57600080fd5b61089782611066565b600080604083850312156110e957600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602080838503121561113a57600080fd5b823567ffffffffffffffff8082111561115257600080fd5b818501915085601f83011261116657600080fd5b813581811115611178576111786110f8565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156111bb576111bb6110f8565b6040529182528482019250838101850191888311156111d957600080fd5b938501935b828510156111fe576111ef85611066565b845293850193928501926111de565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561124257835183529284019291840191600101611226565b50909695505050505050565b60008060006060848603121561126357600080fd5b61126c84611066565b95602085013595506040909401359392505050565b6000806000806080858703121561129757600080fd5b505082516020840151604085015160609095015191969095509092509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361133e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220a2646eaaf61736c87468947c96079f376f7e98ef4804815d5742e93ea3eaa55564736f6c634300080d00330000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f9
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80639fd9eaaf11610097578063bbd91c4611610066578063bbd91c4614610287578063edd1b0be146102ae578063ee53e637146102c1578063f63b0f3d146102e157600080fd5b80639fd9eaaf14610205578063a622ee7c14610218578063a746d48914610254578063b748b9fb1461026757600080fd5b80633092fac3116100d35780633092fac31461017a57806341779f861461018357806352b43adf146101cf5780639f30490a146101f257600080fd5b8063012abbe91461010557806306ec16f81461011a57806319ab453c146101405780632936ff2b14610153575b600080fd5b61011861011336600461108f565b6102f4565b005b61012d6101283660046110bb565b6103ef565b6040519081526020015b60405180910390f35b61011861014e3660046110bb565b6106c8565b61012d7f13eb61d6467453b8d8e0d2a40b8dcee776dde376f951013dfdab1b9189651b6181565b61012d60035481565b6101aa7f0000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f981565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610137565b6101e26101dd36600461108f565b6107e1565b6040519015158152602001610137565b6101186102003660046110d6565b6108a0565b61012d6102133660046110bb565b610974565b61023f6102263660046110bb565b6001602081905260009182526040909120805491015482565b60408051928352602083019190915201610137565b61011861026236600461108f565b610aa9565b6002546101aa9073ffffffffffffffffffffffffffffffffffffffff1681565b6101aa7f48a48edb17b6277f3d9897feeb510d1503580c3997a055cb5a635e86f81c243a81565b6101186102bc36600461108f565b610b6d565b6102d46102cf366004611127565b610c4e565b604051610137919061120a565b6101186102ef36600461124e565b610cfc565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156103bd5760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558051858152918201929092527faec761575684e54a883064093131de012d7a9e8fc898f13474e50fcfbdce7d0b91015b60405180910390a15050565b6040517f6d6b83b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020819052604082200154421015610451576040517f3d418d2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fa622ee7c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526000917f0000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f99091169063a622ee7c90602401608060405180830381865afa1580156104e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105069190611281565b505060035473ffffffffffffffffffffffffffffffffffffffff8616600090815260016020526040902054919350610590925061058a916105479190610e36565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600160208190526040909120015461057c904290610e82565b670de0b6b3a7640000610ec8565b82610f86565b60025490925073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f981169163472f0d6b918691166105e28686610fb0565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff8316600081815260016020819052604080832042920191909155517febc30f0f6830190d829077dd2f90a0c61437787593e0d5c7d1cf3e74d97fdee19190a250919050565b6106f67fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af5773ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020805415610759576040517f5309d5ca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b670de0b6b3a7640000815542600182015560405173ffffffffffffffffffffffffffffffffffffffff8316907f4f8cfde3439a1a302c21ca51eec26086efbfd940b8c0279889fc6bb6e73ecc6690600090a25050565b6040517faa68b5bf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1680610861575073ffffffffffffffffffffffffffffffffffffffff821660009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff165b80610897575060008381526020818152604080832073eb510d1503580c3997a055cb5a635e86f81c243a845290915290205460ff165b90505b92915050565b6108ce7fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af57817f62617365496e746572657374000000000000000000000000000000000000000003610904576003819055610936565b6040517fee807d7400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817ff04ee4a7c5e0072de141f68fbec4aba82bfa0866ce04ad1f286b8602e0cbcfa68260405161096891815260200190565b60405180910390a25050565b6040517fa622ee7c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015260009182917f0000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f9169063a622ee7c90602401608060405180830381865afa158015610a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a299190611281565b505073ffffffffffffffffffffffffffffffffffffffff8516600090815260016020819052604090912001549092504210159050610a675792915050565b60035473ffffffffffffffffffffffffffffffffffffffff8416600090815260016020526040902054610aa29161058a916105479190610e36565b9392505050565b3360009081527f107ee6c9edf8142ba51e10023f320f7b6ccd180a42be95ddbc18c0e5425b2900602052604090205460ff16156103bd5760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558051858152918201929092527f9c21fb13a2f9c0e9222fe9a6810fe483b60248132981e1e0554bae602e93a9dd91016103b1565b610b9b7fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af57817f61657200000000000000000000000000000000000000000000000000000000000361090457600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831617905560405173ffffffffffffffffffffffffffffffffffffffff82169083907fd473402183a624b7a23eb21bfd0a2863a628f61fb004edd801a2eab61ac2bd3d90600090a35050565b60606000825167ffffffffffffffff811115610c6c57610c6c6110f8565b604051908082528060200260200182016040528015610c95578160200160208202803683370190505b50905060005b8351811015610cf557610cc6848281518110610cb957610cb96112b7565b60200260200101516103ef565b828281518110610cd857610cd86112b7565b602090810291909101015280610ced816112e6565b915050610c9b565b5092915050565b610d2a7fffffffff0000000000000000000000000000000000000000000000000000000060003516336107e1565b156107af5773ffffffffffffffffffffffffffffffffffffffff8316600090815260016020819052604090912001544214610d91576040517f9d64fee500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b817f696e7465726573745065725365636f6e64000000000000000000000000000000036109045773ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260409020819055818373ffffffffffffffffffffffffffffffffffffffff167feae3e9da3f1d1474fb6ee1e0ad900272b38c9fd0c29d51b5f35a21823d0bbd4783604051610e2991815260200190565b60405180910390a3505050565b8082018281101561089a576040517f2c203e7200000000000000000000000000000000000000000000000000000000815260048101849052602481018390526044015b60405180910390fd5b8082038281111561089a576040517e5318ee0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610e79565b6000828015610f7a57848015610f6f57600185168015610eea57869350610eee565b8493505b50600284046002860495505b8515610f69578687028760801c15610f1157600080fd5b81810181811015610f2157600080fd5b8690049750506001861615610f5e578684028488820414158815151615610f4757600080fd5b81810181811015610f5757600080fd5b8690049450505b600286049550610efa565b50610f74565b600092505b50610f7e565b8291505b509392505050565b6000670de0b6b3a7640000610f9b8484611005565b81610fa857610fa8611345565b049392505050565b80820360008312801590610fc5575060008212155b61089a576040517fb57a92be0000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610e79565b60008115806110265750508082028282828161102357611023611345565b04145b61089a576040517fa3b82a410000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610e79565b803573ffffffffffffffffffffffffffffffffffffffff8116811461108a57600080fd5b919050565b600080604083850312156110a257600080fd5b823591506110b260208401611066565b90509250929050565b6000602082840312156110cd57600080fd5b61089782611066565b600080604083850312156110e957600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602080838503121561113a57600080fd5b823567ffffffffffffffff8082111561115257600080fd5b818501915085601f83011261116657600080fd5b813581811115611178576111786110f8565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156111bb576111bb6110f8565b6040529182528482019250838101850191888311156111d957600080fd5b938501935b828510156111fe576111ef85611066565b845293850193928501926111de565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561124257835183529284019291840191600101611226565b50909695505050505050565b60008060006060848603121561126357600080fd5b61126c84611066565b95602085013595506040909401359392505050565b6000806000806080858703121561129757600080fd5b505082516020840151604085015160609095015191969095509092509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361133e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fdfea2646970667358221220a2646eaaf61736c87468947c96079f376f7e98ef4804815d5742e93ea3eaa55564736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f9
-----Decoded View---------------
Arg [0] : codex_ (address): 0x6bF5EB06201e4ea7C315b1C23BfE79fAE30541F9
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000006bf5eb06201e4ea7c315b1c23bfe79fae30541f9
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ Download: CSV Export ]
[ 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.