More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 102 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Beat | 18619780 | 263 days ago | IN | 0 ETH | 0.01024707 | ||||
Beat | 18617407 | 263 days ago | IN | 0 ETH | 0.0091811 | ||||
Beat | 18615023 | 264 days ago | IN | 0 ETH | 0.00985223 | ||||
Beat | 18612641 | 264 days ago | IN | 0 ETH | 0.00759173 | ||||
Beat | 18610259 | 264 days ago | IN | 0 ETH | 0.00581279 | ||||
Beat | 18607883 | 265 days ago | IN | 0 ETH | 0.0094882 | ||||
Beat | 18605501 | 265 days ago | IN | 0 ETH | 0.00450924 | ||||
Beat | 18603121 | 265 days ago | IN | 0 ETH | 0.00536077 | ||||
Beat | 18600743 | 266 days ago | IN | 0 ETH | 0.00651541 | ||||
Beat | 18598369 | 266 days ago | IN | 0 ETH | 0.00809473 | ||||
Beat | 18596005 | 266 days ago | IN | 0 ETH | 0.00642438 | ||||
Beat | 18593629 | 267 days ago | IN | 0 ETH | 0.01290713 | ||||
Beat | 18591240 | 267 days ago | IN | 0 ETH | 0.00738548 | ||||
Beat | 18588862 | 267 days ago | IN | 0 ETH | 0.00757543 | ||||
Beat | 18586489 | 268 days ago | IN | 0 ETH | 0.01652331 | ||||
Beat | 18584089 | 268 days ago | IN | 0 ETH | 0.00980042 | ||||
Beat | 18581705 | 268 days ago | IN | 0 ETH | 0.01049991 | ||||
Beat | 18579320 | 269 days ago | IN | 0 ETH | 0.016046 | ||||
Beat | 18576933 | 269 days ago | IN | 0 ETH | 0.00694927 | ||||
Beat | 18574559 | 269 days ago | IN | 0 ETH | 0.0079397 | ||||
Beat | 18572183 | 270 days ago | IN | 0 ETH | 0.01897675 | ||||
Beat | 18569787 | 270 days ago | IN | 0 ETH | 0.0088931 | ||||
Beat | 18567398 | 270 days ago | IN | 0 ETH | 0.00783309 | ||||
Beat | 18565004 | 271 days ago | IN | 0 ETH | 0.01293062 | ||||
Beat | 18562623 | 271 days ago | IN | 0 ETH | 0.00907604 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
OlympusHeart
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 10 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.15; import {ReentrancyGuard} from "solmate/utils/ReentrancyGuard.sol"; import {ERC20} from "solmate/tokens/ERC20.sol"; import {TransferHelper} from "libraries/TransferHelper.sol"; import {IOperator} from "policies/interfaces/IOperator.sol"; import {IHeart} from "policies/interfaces/IHeart.sol"; import {RolesConsumer} from "modules/ROLES/OlympusRoles.sol"; import {ROLESv1} from "modules/ROLES/ROLES.v1.sol"; import {PRICEv1} from "modules/PRICE/PRICE.v1.sol"; import "src/Kernel.sol"; /// @title Olympus Heart /// @notice Olympus Heart (Policy) Contract /// @dev The Olympus Heart contract provides keeper rewards to call the heart beat function which fuels /// Olympus market operations. The Heart orchestrates state updates in the correct order to ensure /// market operations use up to date information. /// This version implements an auction style reward system where the reward is linearly increasing up to a max reward contract OlympusHeart is IHeart, Policy, RolesConsumer, ReentrancyGuard { using TransferHelper for ERC20; // ========= STATE ========= // /// @notice Timestamp of the last beat (UTC, in seconds) uint48 public lastBeat; /// @notice Duration of the reward auction (in seconds) uint48 public auctionDuration; /// @notice Reward token address that users are sent for beating the Heart ERC20 public rewardToken; /// @notice Max reward for beating the Heart (in reward token decimals) uint256 public maxReward; /// @notice Status of the Heart, false = stopped, true = beating bool public active; // Modules PRICEv1 internal PRICE; // Policies IOperator public operator; //============================================================================================// // POLICY SETUP // //============================================================================================// /// @dev Auction duration must be less than or equal to frequency, but we cannot validate that in the constructor because PRICE is not yet set. /// Therefore, manually ensure that the value is valid when deploying the contract. constructor( Kernel kernel_, IOperator operator_, ERC20 rewardToken_, uint256 maxReward_, uint48 auctionDuration_ ) Policy(kernel_) { operator = operator_; active = true; lastBeat = uint48(block.timestamp); auctionDuration = auctionDuration_; rewardToken = rewardToken_; maxReward = maxReward_; emit RewardUpdated(rewardToken_, maxReward_, auctionDuration_); } /// @inheritdoc Policy function configureDependencies() external override returns (Keycode[] memory dependencies) { dependencies = new Keycode[](2); dependencies[0] = toKeycode("PRICE"); dependencies[1] = toKeycode("ROLES"); PRICE = PRICEv1(getModuleAddress(dependencies[0])); ROLES = ROLESv1(getModuleAddress(dependencies[1])); } /// @inheritdoc Policy function requestPermissions() external view override returns (Permissions[] memory permissions) { permissions = new Permissions[](1); permissions[0] = Permissions(PRICE.KEYCODE(), PRICE.updateMovingAverage.selector); } //============================================================================================// // CORE FUNCTIONS // //============================================================================================// /// @inheritdoc IHeart function beat() external nonReentrant { if (!active) revert Heart_BeatStopped(); uint48 currentTime = uint48(block.timestamp); if (currentTime < lastBeat + frequency()) revert Heart_OutOfCycle(); // Update the moving average on the Price module PRICE.updateMovingAverage(); // Trigger price range update and market operations operator.operate(); // Calculate the reward uint256 reward = currentReward(); // Update the last beat timestamp // Ensure that update frequency doesn't change, but do not allow multiple beats if one is skipped lastBeat = currentTime - ((currentTime - lastBeat) % frequency()); // Issue the reward rewardToken.safeTransfer(msg.sender, reward); emit RewardIssued(msg.sender, reward); emit Beat(block.timestamp); } //============================================================================================// // ADMIN FUNCTIONS // //============================================================================================// function _resetBeat() internal { lastBeat = uint48(block.timestamp) - frequency(); } /// @inheritdoc IHeart function resetBeat() external onlyRole("heart_admin") { _resetBeat(); } /// @inheritdoc IHeart function activate() external onlyRole("heart_admin") { active = true; _resetBeat(); } /// @inheritdoc IHeart function deactivate() external onlyRole("heart_admin") { active = false; } /// @inheritdoc IHeart function setOperator(address operator_) external onlyRole("heart_admin") { operator = IOperator(operator_); } modifier notWhileBeatAvailable() { // Prevent calling if a beat is available to avoid front-running a keeper if (uint48(block.timestamp) >= lastBeat + frequency()) revert Heart_BeatAvailable(); _; } /// @inheritdoc IHeart function setRewardAuctionParams( ERC20 token_, uint256 maxReward_, uint48 auctionDuration_ ) external onlyRole("heart_admin") notWhileBeatAvailable { // auction duration should be less than or equal to frequency, otherwise frequency will be used if (auctionDuration_ > frequency()) revert Heart_InvalidParams(); rewardToken = token_; maxReward = maxReward_; auctionDuration = auctionDuration_; emit RewardUpdated(token_, maxReward_, auctionDuration_); } /// @inheritdoc IHeart function withdrawUnspentRewards( ERC20 token_ ) external onlyRole("heart_admin") notWhileBeatAvailable { token_.safeTransfer(msg.sender, token_.balanceOf(address(this))); } //============================================================================================// // VIEW FUNCTIONS // //============================================================================================// /// @inheritdoc IHeart function frequency() public view returns (uint48) { return uint48(PRICE.observationFrequency()); } /// @inheritdoc IHeart function currentReward() public view returns (uint256) { // If beat not available, return 0 // Otherwise, calculate reward from linearly increasing auction bounded by maxReward and heart balance uint48 beatFrequency = frequency(); uint48 nextBeat = lastBeat + beatFrequency; uint48 currentTime = uint48(block.timestamp); uint48 duration = auctionDuration > beatFrequency ? beatFrequency : auctionDuration; if (currentTime <= nextBeat) { return 0; } else { uint256 auctionAmount = currentTime - nextBeat > duration ? maxReward : (uint256(currentTime - nextBeat) * maxReward) / uint256(duration); uint256 balance = rewardToken.balanceOf(address(this)); return auctionAmount > balance ? balance : auctionAmount; } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Gas optimized reentrancy protection for smart contracts. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/ReentrancyGuard.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol) abstract contract ReentrancyGuard { uint256 private locked = 1; modifier nonReentrant() virtual { require(locked == 1, "REENTRANCY"); locked = 2; _; locked = 1; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; /// @notice Safe ERC20 and ETH transfer library that safely handles missing return values. /// @author Modified from Uniswap & old Solmate (https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/libraries/TransferHelper.sol) library TransferHelper { function safeTransferFrom(ERC20 token, address from, address to, uint256 amount) internal { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(ERC20.transferFrom.selector, from, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool))), "TRANSFER_FROM_FAILED"); } function safeTransfer(ERC20 token, address to, uint256 amount) internal { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(ERC20.transfer.selector, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool))), "TRANSFER_FAILED"); } function safeApprove(ERC20 token, address to, uint256 amount) internal { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(ERC20.approve.selector, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool))), "APPROVE_FAILED"); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; import {IBondSDA} from "interfaces/IBondSDA.sol"; import {IBondCallback} from "interfaces/IBondCallback.sol"; interface IOperator { // ========= EVENTS ========= // event Swap( ERC20 indexed tokenIn_, ERC20 indexed tokenOut_, uint256 amountIn_, uint256 amountOut_ ); event CushionFactorChanged(uint32 cushionFactor_); event CushionParamsChanged(uint32 duration_, uint32 debtBuffer_, uint32 depositInterval_); event ReserveFactorChanged(uint32 reserveFactor_); event RegenParamsChanged(uint32 wait_, uint32 threshold_, uint32 observe_); // ========= ERRORS ========= // error Operator_InvalidParams(); error Operator_InsufficientCapacity(); error Operator_AmountLessThanMinimum(uint256 amountOut, uint256 minAmountOut); error Operator_WallDown(); error Operator_AlreadyInitialized(); error Operator_NotInitialized(); error Operator_Inactive(); // ========= STRUCTS ========== // /// @notice Configuration variables for the Operator struct Config { uint32 cushionFactor; // percent of capacity to be used for a single cushion deployment, assumes 2 decimals (i.e. 1000 = 10%) uint32 cushionDuration; // duration of a single cushion deployment in seconds uint32 cushionDebtBuffer; // Percentage over the initial debt to allow the market to accumulate at any one time. Percent with 3 decimals, e.g. 1_000 = 1 %. See IBondSDA for more info. uint32 cushionDepositInterval; // Target frequency of deposits. Determines max payout of the bond market. See IBondSDA for more info. uint32 reserveFactor; // percent of reserves in treasury to be used for a single wall, assumes 2 decimals (i.e. 1000 = 10%) uint32 regenWait; // minimum duration to wait to reinstate a wall in seconds uint32 regenThreshold; // number of price points on other side of moving average to reinstate a wall uint32 regenObserve; // number of price points to observe to determine regeneration } /// @notice Combines regeneration status for low and high sides of the range struct Status { Regen low; // regeneration status for the low side of the range Regen high; // regeneration status for the high side of the range } /// @notice Tracks status of when a specific side of the range can be regenerated by the Operator struct Regen { uint32 count; // current number of price points that count towards regeneration uint48 lastRegen; // timestamp of the last regeneration uint32 nextObservation; // index of the next observation in the observations array bool[] observations; // individual observations: true = price on other side of average, false = price on same side of average } // ========= CORE FUNCTIONS ========= // /// @notice Executes market operations logic. /// @notice Access restricted /// @dev This function is triggered by a keeper on the Heart contract. function operate() external; // ========= OPEN MARKET OPERATIONS (WALL) ========= // /// @notice Swap at the current wall prices /// @param tokenIn_ - Token to swap into the wall /// - OHM: swap at the low wall price for Reserve /// - Reserve: swap at the high wall price for OHM /// @param amountIn_ - Amount of tokenIn to swap /// @param minAmountOut_ - Minimum amount of opposite token to receive /// @return amountOut - Amount of opposite token received function swap( ERC20 tokenIn_, uint256 amountIn_, uint256 minAmountOut_ ) external returns (uint256 amountOut); /// @notice Returns the amount to be received from a swap /// @param tokenIn_ - Token to swap into the wall /// - If OHM: swap at the low wall price for Reserve /// - If Reserve: swap at the high wall price for OHM /// @param amountIn_ - Amount of tokenIn to swap /// @return Amount of opposite token received function getAmountOut(ERC20 tokenIn_, uint256 amountIn_) external view returns (uint256); // ========= ADMIN FUNCTIONS ========= // /// @notice Set the wall and cushion spreads /// @notice Access restricted /// @dev Interface for externally setting these values on the RANGE module /// @param cushionSpread_ - Percent spread to set the cushions at above/below the moving average, assumes 2 decimals (i.e. 1000 = 10%) /// @param wallSpread_ - Percent spread to set the walls at above/below the moving average, assumes 2 decimals (i.e. 1000 = 10%) function setSpreads(uint256 cushionSpread_, uint256 wallSpread_) external; /// @notice Set the threshold factor for when a wall is considered "down" /// @notice Access restricted /// @dev Interface for externally setting this value on the RANGE module /// @param thresholdFactor_ - Percent of capacity that the wall should close below, assumes 2 decimals (i.e. 1000 = 10%) function setThresholdFactor(uint256 thresholdFactor_) external; /// @notice Set the cushion factor /// @notice Access restricted /// @param cushionFactor_ - Percent of wall capacity that the operator will deploy in the cushion, assumes 2 decimals (i.e. 1000 = 10%) function setCushionFactor(uint32 cushionFactor_) external; /// @notice Set the parameters used to deploy cushion bond markets /// @notice Access restricted /// @param duration_ - Duration of cushion bond markets in seconds /// @param debtBuffer_ - Percentage over the initial debt to allow the market to accumulate at any one time. Percent with 3 decimals, e.g. 1_000 = 1 %. See IBondSDA for more info. /// @param depositInterval_ - Target frequency of deposits in seconds. Determines max payout of the bond market. See IBondSDA for more info. function setCushionParams( uint32 duration_, uint32 debtBuffer_, uint32 depositInterval_ ) external; /// @notice Set the reserve factor /// @notice Access restricted /// @param reserveFactor_ - Percent of treasury reserves to deploy as capacity for market operations, assumes 2 decimals (i.e. 1000 = 10%) function setReserveFactor(uint32 reserveFactor_) external; /// @notice Set the wall regeneration parameters /// @notice Access restricted /// @param wait_ - Minimum duration to wait to reinstate a wall in seconds /// @param threshold_ - Number of price points on other side of moving average to reinstate a wall /// @param observe_ - Number of price points to observe to determine regeneration /// @dev We must see Threshold number of price points that meet our criteria within the last Observe number of price points to regenerate a wall. function setRegenParams(uint32 wait_, uint32 threshold_, uint32 observe_) external; /// @notice Set the contracts that the Operator deploys bond markets with. /// @notice Access restricted /// @param auctioneer_ - Address of the bond auctioneer to use. /// @param callback_ - Address of the callback to use. function setBondContracts(IBondSDA auctioneer_, IBondCallback callback_) external; /// @notice Initialize the Operator to begin market operations /// @notice Access restricted /// @notice Can only be called once /// @dev This function executes actions required to start operations that cannot be done prior to the Operator policy being approved by the Kernel. function initialize() external; /// @notice Regenerate the wall for a side /// @notice Access restricted /// @param high_ Whether to regenerate the high side or low side (true = high, false = low) /// @dev This function is an escape hatch to trigger out of cycle regenerations and may be useful when doing migrations of Treasury funds function regenerate(bool high_) external; /// @notice Deactivate the Operator /// @notice Access restricted /// @dev Emergency pause function for the Operator. Prevents market operations from occurring. function deactivate() external; /// @notice Activate the Operator /// @notice Access restricted /// @dev Restart function for the Operator after a pause. function activate() external; /// @notice Manually close a cushion bond market /// @notice Access restricted /// @param high_ Whether to deactivate the high or low side cushion (true = high, false = low) /// @dev Emergency shutdown function for Cushions function deactivateCushion(bool high_) external; // ========= VIEW FUNCTIONS ========= // /// @notice Returns the full capacity of the specified wall (if it was regenerated now) /// @dev Calculates the capacity to deploy for a wall based on the amount of reserves owned by the treasury and the reserve factor. /// @param high_ - Whether to return the full capacity for the high or low wall function fullCapacity(bool high_) external view returns (uint256); /// @notice Returns the status variable of the Operator as a Status struct function status() external view returns (Status memory); /// @notice Returns the config variable of the Operator as a Config struct function config() external view returns (Config memory); }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; interface IHeart { // ========= EVENTS ========= // event Beat(uint256 timestamp_); event RewardIssued(address to_, uint256 rewardAmount_); event RewardUpdated(ERC20 token_, uint256 maxRewardAmount_, uint48 auctionDuration_); // ========= ERRORS ========= // error Heart_OutOfCycle(); error Heart_BeatStopped(); error Heart_InvalidParams(); error Heart_BeatAvailable(); // ========= CORE FUNCTIONS ========= // /// @notice Beats the heart /// @notice Only callable when enough time has passed since last beat (determined by frequency variable) /// @notice This function is incentivized with a token reward (see rewardToken and reward variables). /// @dev Triggers price oracle update and market operations function beat() external; // ========= ADMIN FUNCTIONS ========= // /// @notice Unlocks the cycle if stuck on one side, eject function /// @notice Access restricted function resetBeat() external; /// @notice Turns the heart on and resets the beat /// @notice Access restricted /// @dev This function is used to restart the heart after a pause function activate() external; /// @notice Turns the heart off /// @notice Access restricted /// @dev Emergency stop function for the heart function deactivate() external; /// @notice Updates the Operator contract address that the Heart calls on a beat /// @notice Access restricted /// @param operator_ The address of the new Operator contract function setOperator(address operator_) external; /// @notice Sets the reward token, max reward amount, and auction duration for the beat function /// @notice Access restricted /// @param token_ - New reward token address /// @param maxReward_ - New max reward amount, in units of the reward token /// @param auctionDuration_ - New auction duration, in seconds function setRewardAuctionParams( ERC20 token_, uint256 maxReward_, uint48 auctionDuration_ ) external; /// @notice Withdraws unspent balance of provided token to sender /// @notice Access restricted function withdrawUnspentRewards(ERC20 token_) external; // ========= VIEW FUNCTIONS ========= // /// @notice Heart beat frequency, in seconds function frequency() external view returns (uint48); /// @notice Current reward amount based on linear auction function currentReward() external view returns (uint256); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.15; import {ROLESv1} from "src/modules/ROLES/ROLES.v1.sol"; import "src/Kernel.sol"; /// @notice Abstract contract to have the `onlyRole` modifier /// @dev Inheriting this automatically makes ROLES module a dependency abstract contract RolesConsumer { ROLESv1 public ROLES; modifier onlyRole(bytes32 role_) { ROLES.requireRole(role_, msg.sender); _; } } /// @notice Module that holds multisig roles needed by various policies. contract OlympusRoles is ROLESv1 { //============================================================================================// // MODULE SETUP // //============================================================================================// constructor(Kernel kernel_) Module(kernel_) {} /// @inheritdoc Module function KEYCODE() public pure override returns (Keycode) { return toKeycode("ROLES"); } /// @inheritdoc Module function VERSION() external pure override returns (uint8 major, uint8 minor) { major = 1; minor = 0; } //============================================================================================// // CORE FUNCTIONS // //============================================================================================// /// @inheritdoc ROLESv1 function saveRole(bytes32 role_, address addr_) external override permissioned { if (hasRole[addr_][role_]) revert ROLES_AddressAlreadyHasRole(addr_, role_); ensureValidRole(role_); // Grant role to the address hasRole[addr_][role_] = true; emit RoleGranted(role_, addr_); } /// @inheritdoc ROLESv1 function removeRole(bytes32 role_, address addr_) external override permissioned { if (!hasRole[addr_][role_]) revert ROLES_AddressDoesNotHaveRole(addr_, role_); hasRole[addr_][role_] = false; emit RoleRevoked(role_, addr_); } //============================================================================================// // VIEW FUNCTIONS // //============================================================================================// /// @inheritdoc ROLESv1 function requireRole(bytes32 role_, address caller_) external view override { if (!hasRole[caller_][role_]) revert ROLES_RequireRole(role_); } /// @inheritdoc ROLESv1 function ensureValidRole(bytes32 role_) public pure override { for (uint256 i = 0; i < 32; ) { bytes1 char = role_[i]; if ((char < 0x61 || char > 0x7A) && char != 0x5f && char != 0x00) { revert ROLES_InvalidRole(role_); // a-z only } unchecked { i++; } } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.15; import "src/Kernel.sol"; abstract contract ROLESv1 is Module { // ========= EVENTS ========= // event RoleGranted(bytes32 indexed role_, address indexed addr_); event RoleRevoked(bytes32 indexed role_, address indexed addr_); // ========= ERRORS ========= // error ROLES_InvalidRole(bytes32 role_); error ROLES_RequireRole(bytes32 role_); error ROLES_AddressAlreadyHasRole(address addr_, bytes32 role_); error ROLES_AddressDoesNotHaveRole(address addr_, bytes32 role_); error ROLES_RoleDoesNotExist(bytes32 role_); // ========= STATE ========= // /// @notice Mapping for if an address has a policy-defined role. mapping(address => mapping(bytes32 => bool)) public hasRole; // ========= FUNCTIONS ========= // /// @notice Function to grant policy-defined roles to some address. Can only be called by admin. function saveRole(bytes32 role_, address addr_) external virtual; /// @notice Function to revoke policy-defined roles from some address. Can only be called by admin. function removeRole(bytes32 role_, address addr_) external virtual; /// @notice "Modifier" to restrict policy function access to certain addresses with a role. /// @dev Roles are defined in the policy and granted by the ROLES admin. function requireRole(bytes32 role_, address caller_) external virtual; /// @notice Function that checks if role is valid (all lower case) function ensureValidRole(bytes32 role_) external pure virtual; }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.15; import {AggregatorV2V3Interface} from "interfaces/AggregatorV2V3Interface.sol"; import "src/Kernel.sol"; /// @notice Price oracle data storage /// @dev The Olympus Price Oracle contract provides a standard interface for OHM price data against a reserve asset. /// It also implements a moving average price calculation (same as a TWAP) on the price feed data over a configured /// duration and observation frequency. The data provided by this contract is used by the Olympus Range Operator to /// perform market operations. The Olympus Price Oracle is updated each epoch by the Olympus Heart contract. abstract contract PRICEv1 is Module { // ========= EVENTS ========= // event NewObservation(uint256 timestamp_, uint256 price_, uint256 movingAverage_); event MovingAverageDurationChanged(uint48 movingAverageDuration_); event ObservationFrequencyChanged(uint48 observationFrequency_); event UpdateThresholdsChanged(uint48 ohmEthUpdateThreshold_, uint48 reserveEthUpdateThreshold_); event MinimumTargetPriceChanged(uint256 minimumTargetPrice_); // ========= ERRORS ========= // error Price_InvalidParams(); error Price_NotInitialized(); error Price_AlreadyInitialized(); error Price_BadFeed(address priceFeed); // ========= STATE ========= // /// @dev Price feeds. Chainlink typically provides price feeds for an asset in ETH. Therefore, we use two price feeds against ETH, one for OHM and one for the Reserve asset, to calculate the relative price of OHM in the Reserve asset. /// @dev Update thresholds are the maximum amount of time that can pass between price feed updates before the price oracle is considered stale. These should be set based on the parameters of the price feed. /// @notice OHM/ETH price feed AggregatorV2V3Interface public ohmEthPriceFeed; /// @notice Maximum expected time between OHM/ETH price feed updates uint48 public ohmEthUpdateThreshold; /// @notice Reserve/ETH price feed AggregatorV2V3Interface public reserveEthPriceFeed; /// @notice Maximum expected time between OHM/ETH price feed updates uint48 public reserveEthUpdateThreshold; /// @notice Running sum of observations to calculate the moving average price from /// @dev See getMovingAverage() uint256 public cumulativeObs; /// @notice Array of price observations. Check nextObsIndex to determine latest data point. /// @dev Observations are stored in a ring buffer where the moving average is the sum of all observations divided by the number of observations. /// Observations can be cleared by changing the movingAverageDuration or observationFrequency and must be re-initialized. uint256[] public observations; /// @notice Index of the next observation to make. The current value at this index is the oldest observation. uint32 public nextObsIndex; /// @notice Number of observations used in the moving average calculation. Computed from movingAverageDuration / observationFrequency. uint32 public numObservations; /// @notice Frequency (in seconds) that observations should be stored. uint48 public observationFrequency; /// @notice Duration (in seconds) over which the moving average is calculated. uint48 public movingAverageDuration; /// @notice Unix timestamp of last observation (in seconds). uint48 public lastObservationTime; /// @notice Whether the price module is initialized (and therefore active). bool public initialized; /// @notice Number of decimals in the price values provided by the contract. uint8 public constant decimals = 18; /// @notice Minimum target price for RBS system. Set manually to correspond to the liquid backing of OHM. uint256 public minimumTargetPrice; // ========= FUNCTIONS ========= // /// @notice Trigger an update of the moving average. Permissioned. /// @dev This function does not have a time-gating on the observationFrequency on this contract. It is set on the Heart policy contract. /// The Heart beat frequency should be set to the same value as the observationFrequency. function updateMovingAverage() external virtual; /// @notice Initialize the price module /// @notice Access restricted to activated policies /// @param startObservations_ - Array of observations to initialize the moving average with. Must be of length numObservations. /// @param lastObservationTime_ - Unix timestamp of last observation being provided (in seconds). /// @dev This function must be called after the Price module is deployed to activate it and after updating the observationFrequency /// or movingAverageDuration (in certain cases) in order for the Price module to function properly. function initialize( uint256[] memory startObservations_, uint48 lastObservationTime_ ) external virtual; /// @notice Change the moving average window (duration) /// @param movingAverageDuration_ - Moving average duration in seconds, must be a multiple of observation frequency /// @dev Changing the moving average duration will erase the current observations array /// and require the initialize function to be called again. Ensure that you have saved /// the existing data and can re-populate before calling this function. function changeMovingAverageDuration(uint48 movingAverageDuration_) external virtual; /// @notice Change the observation frequency of the moving average (i.e. how often a new observation is taken) /// @param observationFrequency_ - Observation frequency in seconds, must be a divisor of the moving average duration /// @dev Changing the observation frequency clears existing observation data since it will not be taken at the right time intervals. /// Ensure that you have saved the existing data and/or can re-populate before calling this function. function changeObservationFrequency(uint48 observationFrequency_) external virtual; /// @notice Change the update thresholds for the price feeds /// @param ohmEthUpdateThreshold_ - Maximum allowed time between OHM/ETH price feed updates /// @param reserveEthUpdateThreshold_ - Maximum allowed time between Reserve/ETH price feed updates /// @dev The update thresholds should be set based on the update threshold of the chainlink oracles. function changeUpdateThresholds( uint48 ohmEthUpdateThreshold_, uint48 reserveEthUpdateThreshold_ ) external virtual; /// @notice Change the minimum target price /// @param minimumTargetPrice_ - Minimum target price for RBS system with 18 decimals, expressed as number of Reserve per OHM /// @dev The minimum target price should be set based on the liquid backing of OHM. function changeMinimumTargetPrice(uint256 minimumTargetPrice_) external virtual; /// @notice Get the current price of OHM in the Reserve asset from the price feeds function getCurrentPrice() external view virtual returns (uint256); /// @notice Get the last stored price observation of OHM in the Reserve asset function getLastPrice() external view virtual returns (uint256); /// @notice Get the moving average of OHM in the Reserve asset over the defined window (see movingAverageDuration and observationFrequency). function getMovingAverage() external view virtual returns (uint256); /// @notice Get target price of OHM in the Reserve asset for the RBS system /// @dev Returns the maximum of the moving average and the minimum target price function getTargetPrice() external view virtual returns (uint256); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity 0.8.15; // ███████ █████ █████ █████ ██████ ██████ ███████████ █████ █████ █████████ // ███░░░░░███ ░░███ ░░███ ░░███ ░░██████ ██████ ░░███░░░░░███░░███ ░░███ ███░░░░░███ // ███ ░░███ ░███ ░░███ ███ ░███░█████░███ ░███ ░███ ░███ ░███ ░███ ░░░ // ░███ ░███ ░███ ░░█████ ░███░░███ ░███ ░██████████ ░███ ░███ ░░█████████ // ░███ ░███ ░███ ░░███ ░███ ░░░ ░███ ░███░░░░░░ ░███ ░███ ░░░░░░░░███ // ░░███ ███ ░███ █ ░███ ░███ ░███ ░███ ░███ ░███ ███ ░███ // ░░░███████░ ███████████ █████ █████ █████ █████ ░░████████ ░░█████████ // ░░░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░ ░░░░░░░░░ //============================================================================================// // GLOBAL TYPES // //============================================================================================// /// @notice Actions to trigger state changes in the kernel. Passed by the executor enum Actions { InstallModule, UpgradeModule, ActivatePolicy, DeactivatePolicy, ChangeExecutor, MigrateKernel } /// @notice Used by executor to select an action and a target contract for a kernel action struct Instruction { Actions action; address target; } /// @notice Used to define which module functions a policy needs access to struct Permissions { Keycode keycode; bytes4 funcSelector; } type Keycode is bytes5; //============================================================================================// // UTIL FUNCTIONS // //============================================================================================// error TargetNotAContract(address target_); error InvalidKeycode(Keycode keycode_); // solhint-disable-next-line func-visibility function toKeycode(bytes5 keycode_) pure returns (Keycode) { return Keycode.wrap(keycode_); } // solhint-disable-next-line func-visibility function fromKeycode(Keycode keycode_) pure returns (bytes5) { return Keycode.unwrap(keycode_); } // solhint-disable-next-line func-visibility function ensureContract(address target_) view { if (target_.code.length == 0) revert TargetNotAContract(target_); } // solhint-disable-next-line func-visibility function ensureValidKeycode(Keycode keycode_) pure { bytes5 unwrapped = Keycode.unwrap(keycode_); for (uint256 i = 0; i < 5; ) { bytes1 char = unwrapped[i]; if (char < 0x41 || char > 0x5A) revert InvalidKeycode(keycode_); // A-Z only unchecked { i++; } } } //============================================================================================// // COMPONENTS // //============================================================================================// /// @notice Generic adapter interface for kernel access in modules and policies. abstract contract KernelAdapter { error KernelAdapter_OnlyKernel(address caller_); Kernel public kernel; constructor(Kernel kernel_) { kernel = kernel_; } /// @notice Modifier to restrict functions to be called only by kernel. modifier onlyKernel() { if (msg.sender != address(kernel)) revert KernelAdapter_OnlyKernel(msg.sender); _; } /// @notice Function used by kernel when migrating to a new kernel. function changeKernel(Kernel newKernel_) external onlyKernel { kernel = newKernel_; } } /// @notice Base level extension of the kernel. Modules act as independent state components to be /// interacted with and mutated through policies. /// @dev Modules are installed and uninstalled via the executor. abstract contract Module is KernelAdapter { error Module_PolicyNotPermitted(address policy_); constructor(Kernel kernel_) KernelAdapter(kernel_) {} /// @notice Modifier to restrict which policies have access to module functions. modifier permissioned() { if ( msg.sender == address(kernel) || !kernel.modulePermissions(KEYCODE(), Policy(msg.sender), msg.sig) ) revert Module_PolicyNotPermitted(msg.sender); _; } /// @notice 5 byte identifier for a module. function KEYCODE() public pure virtual returns (Keycode) {} /// @notice Returns which semantic version of a module is being implemented. /// @return major - Major version upgrade indicates breaking change to the interface. /// @return minor - Minor version change retains backward-compatible interface. function VERSION() external pure virtual returns (uint8 major, uint8 minor) {} /// @notice Initialization function for the module /// @dev This function is called when the module is installed or upgraded by the kernel. /// @dev MUST BE GATED BY onlyKernel. Used to encompass any initialization or upgrade logic. function INIT() external virtual onlyKernel {} } /// @notice Policies are application logic and external interface for the kernel and installed modules. /// @dev Policies are activated and deactivated in the kernel by the executor. /// @dev Module dependencies and function permissions must be defined in appropriate functions. abstract contract Policy is KernelAdapter { error Policy_ModuleDoesNotExist(Keycode keycode_); constructor(Kernel kernel_) KernelAdapter(kernel_) {} /// @notice Easily accessible indicator for if a policy is activated or not. function isActive() external view returns (bool) { return kernel.isPolicyActive(this); } /// @notice Function to grab module address from a given keycode. function getModuleAddress(Keycode keycode_) internal view returns (address) { address moduleForKeycode = address(kernel.getModuleForKeycode(keycode_)); if (moduleForKeycode == address(0)) revert Policy_ModuleDoesNotExist(keycode_); return moduleForKeycode; } /// @notice Define module dependencies for this policy. /// @return dependencies - Keycode array of module dependencies. function configureDependencies() external virtual returns (Keycode[] memory dependencies) {} /// @notice Function called by kernel to set module function permissions. /// @return requests - Array of keycodes and function selectors for requested permissions. function requestPermissions() external view virtual returns (Permissions[] memory requests) {} } /// @notice Main contract that acts as a central component registry for the protocol. /// @dev The kernel manages modules and policies. The kernel is mutated via predefined Actions, /// @dev which are input from any address assigned as the executor. The executor can be changed as needed. contract Kernel { // ========= EVENTS ========= // event PermissionsUpdated( Keycode indexed keycode_, Policy indexed policy_, bytes4 funcSelector_, bool granted_ ); event ActionExecuted(Actions indexed action_, address indexed target_); // ========= ERRORS ========= // error Kernel_OnlyExecutor(address caller_); error Kernel_ModuleAlreadyInstalled(Keycode module_); error Kernel_InvalidModuleUpgrade(Keycode module_); error Kernel_PolicyAlreadyActivated(address policy_); error Kernel_PolicyNotActivated(address policy_); // ========= PRIVILEGED ADDRESSES ========= // /// @notice Address that is able to initiate Actions in the kernel. Can be assigned to a multisig or governance contract. address public executor; // ========= MODULE MANAGEMENT ========= // /// @notice Array of all modules currently installed. Keycode[] public allKeycodes; /// @notice Mapping of module address to keycode. mapping(Keycode => Module) public getModuleForKeycode; /// @notice Mapping of keycode to module address. mapping(Module => Keycode) public getKeycodeForModule; /// @notice Mapping of a keycode to all of its policy dependents. Used to efficiently reconfigure policy dependencies. mapping(Keycode => Policy[]) public moduleDependents; /// @notice Helper for module dependent arrays. Prevents the need to loop through array. mapping(Keycode => mapping(Policy => uint256)) public getDependentIndex; /// @notice Module <> Policy Permissions. /// @dev Keycode -> Policy -> Function Selector -> bool for permission mapping(Keycode => mapping(Policy => mapping(bytes4 => bool))) public modulePermissions; // ========= POLICY MANAGEMENT ========= // /// @notice List of all active policies Policy[] public activePolicies; /// @notice Helper to get active policy quickly. Prevents need to loop through array. mapping(Policy => uint256) public getPolicyIndex; //============================================================================================// // CORE FUNCTIONS // //============================================================================================// constructor() { executor = msg.sender; } /// @notice Modifier to check if caller is the executor. modifier onlyExecutor() { if (msg.sender != executor) revert Kernel_OnlyExecutor(msg.sender); _; } function isPolicyActive(Policy policy_) public view returns (bool) { return activePolicies.length > 0 && activePolicies[getPolicyIndex[policy_]] == policy_; } /// @notice Main kernel function. Initiates state changes to kernel depending on Action passed in. function executeAction(Actions action_, address target_) external onlyExecutor { if (action_ == Actions.InstallModule) { ensureContract(target_); ensureValidKeycode(Module(target_).KEYCODE()); _installModule(Module(target_)); } else if (action_ == Actions.UpgradeModule) { ensureContract(target_); ensureValidKeycode(Module(target_).KEYCODE()); _upgradeModule(Module(target_)); } else if (action_ == Actions.ActivatePolicy) { ensureContract(target_); _activatePolicy(Policy(target_)); } else if (action_ == Actions.DeactivatePolicy) { ensureContract(target_); _deactivatePolicy(Policy(target_)); } else if (action_ == Actions.ChangeExecutor) { executor = target_; } else if (action_ == Actions.MigrateKernel) { ensureContract(target_); _migrateKernel(Kernel(target_)); } emit ActionExecuted(action_, target_); } function _installModule(Module newModule_) internal { Keycode keycode = newModule_.KEYCODE(); if (address(getModuleForKeycode[keycode]) != address(0)) revert Kernel_ModuleAlreadyInstalled(keycode); getModuleForKeycode[keycode] = newModule_; getKeycodeForModule[newModule_] = keycode; allKeycodes.push(keycode); newModule_.INIT(); } function _upgradeModule(Module newModule_) internal { Keycode keycode = newModule_.KEYCODE(); Module oldModule = getModuleForKeycode[keycode]; if (address(oldModule) == address(0) || oldModule == newModule_) revert Kernel_InvalidModuleUpgrade(keycode); getKeycodeForModule[oldModule] = Keycode.wrap(bytes5(0)); getKeycodeForModule[newModule_] = keycode; getModuleForKeycode[keycode] = newModule_; newModule_.INIT(); _reconfigurePolicies(keycode); } function _activatePolicy(Policy policy_) internal { if (isPolicyActive(policy_)) revert Kernel_PolicyAlreadyActivated(address(policy_)); // Add policy to list of active policies activePolicies.push(policy_); getPolicyIndex[policy_] = activePolicies.length - 1; // Record module dependencies Keycode[] memory dependencies = policy_.configureDependencies(); uint256 depLength = dependencies.length; for (uint256 i; i < depLength; ) { Keycode keycode = dependencies[i]; moduleDependents[keycode].push(policy_); getDependentIndex[keycode][policy_] = moduleDependents[keycode].length - 1; unchecked { ++i; } } // Grant permissions for policy to access restricted module functions Permissions[] memory requests = policy_.requestPermissions(); _setPolicyPermissions(policy_, requests, true); } function _deactivatePolicy(Policy policy_) internal { if (!isPolicyActive(policy_)) revert Kernel_PolicyNotActivated(address(policy_)); // Revoke permissions Permissions[] memory requests = policy_.requestPermissions(); _setPolicyPermissions(policy_, requests, false); // Remove policy from all policy data structures uint256 idx = getPolicyIndex[policy_]; Policy lastPolicy = activePolicies[activePolicies.length - 1]; activePolicies[idx] = lastPolicy; activePolicies.pop(); getPolicyIndex[lastPolicy] = idx; delete getPolicyIndex[policy_]; // Remove policy from module dependents _pruneFromDependents(policy_); } /// @notice All functionality will move to the new kernel. WARNING: ACTION WILL BRICK THIS KERNEL. /// @dev New kernel must add in all of the modules and policies via executeAction. /// @dev NOTE: Data does not get cleared from this kernel. function _migrateKernel(Kernel newKernel_) internal { uint256 keycodeLen = allKeycodes.length; for (uint256 i; i < keycodeLen; ) { Module module = Module(getModuleForKeycode[allKeycodes[i]]); module.changeKernel(newKernel_); unchecked { ++i; } } uint256 policiesLen = activePolicies.length; for (uint256 j; j < policiesLen; ) { Policy policy = activePolicies[j]; // Deactivate before changing kernel policy.changeKernel(newKernel_); unchecked { ++j; } } } function _reconfigurePolicies(Keycode keycode_) internal { Policy[] memory dependents = moduleDependents[keycode_]; uint256 depLength = dependents.length; for (uint256 i; i < depLength; ) { dependents[i].configureDependencies(); unchecked { ++i; } } } function _setPolicyPermissions( Policy policy_, Permissions[] memory requests_, bool grant_ ) internal { uint256 reqLength = requests_.length; for (uint256 i = 0; i < reqLength; ) { Permissions memory request = requests_[i]; modulePermissions[request.keycode][policy_][request.funcSelector] = grant_; emit PermissionsUpdated(request.keycode, policy_, request.funcSelector, grant_); unchecked { ++i; } } } function _pruneFromDependents(Policy policy_) internal { Keycode[] memory dependencies = policy_.configureDependencies(); uint256 depcLength = dependencies.length; for (uint256 i; i < depcLength; ) { Keycode keycode = dependencies[i]; Policy[] storage dependents = moduleDependents[keycode]; uint256 origIndex = getDependentIndex[keycode][policy_]; Policy lastPolicy = dependents[dependents.length - 1]; // Swap with last and pop dependents[origIndex] = lastPolicy; dependents.pop(); // Record new index and delete deactivated policy index getDependentIndex[keycode][lastPolicy] = origIndex; delete getDependentIndex[keycode][policy_]; unchecked { ++i; } } } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; import {IBondAuctioneer} from "../interfaces/IBondAuctioneer.sol"; interface IBondSDA is IBondAuctioneer { /// @notice Main information pertaining to bond market struct BondMarket { address owner; // market owner. sends payout tokens, receives quote tokens (defaults to creator) ERC20 payoutToken; // token to pay depositors with ERC20 quoteToken; // token to accept as payment address callbackAddr; // address to call for any operations on bond purchase. Must inherit to IBondCallback. bool capacityInQuote; // capacity limit is in payment token (true) or in payout (false, default) uint256 capacity; // capacity remaining uint256 totalDebt; // total payout token debt from market uint256 minPrice; // minimum price (hard floor for the market) uint256 maxPayout; // max payout tokens out in one order uint256 sold; // payout tokens out uint256 purchased; // quote tokens in uint256 scale; // scaling factor for the market (see MarketParams struct) } /// @notice Information used to control how a bond market changes struct BondTerms { uint256 controlVariable; // scaling variable for price uint256 maxDebt; // max payout token debt accrued uint48 vesting; // length of time from deposit to expiry if fixed-term, vesting timestamp if fixed-expiry uint48 conclusion; // timestamp when market no longer offered } /// @notice Data needed for tuning bond market /// @dev Durations are stored in uint32 (not int32) and timestamps are stored in uint48, so is not subject to Y2K38 overflow struct BondMetadata { uint48 lastTune; // last timestamp when control variable was tuned uint48 lastDecay; // last timestamp when market was created and debt was decayed uint32 length; // time from creation to conclusion. uint32 depositInterval; // target frequency of deposits uint32 tuneInterval; // frequency of tuning uint32 tuneAdjustmentDelay; // time to implement downward tuning adjustments uint32 debtDecayInterval; // interval over which debt should decay completely uint256 tuneIntervalCapacity; // capacity expected to be used during a tuning interval uint256 tuneBelowCapacity; // capacity that the next tuning will occur at uint256 lastTuneDebt; // target debt calculated at last tuning } /// @notice Control variable adjustment data struct Adjustment { uint256 change; uint48 lastAdjustment; uint48 timeToAdjusted; // how long until adjustment happens bool active; } /// @notice Parameters to create a new bond market /// @dev Note price should be passed in a specific format: /// formatted price = (payoutPriceCoefficient / quotePriceCoefficient) /// * 10**(36 + scaleAdjustment + quoteDecimals - payoutDecimals + payoutPriceDecimals - quotePriceDecimals) /// where: /// payoutDecimals - Number of decimals defined for the payoutToken in its ERC20 contract /// quoteDecimals - Number of decimals defined for the quoteToken in its ERC20 contract /// payoutPriceCoefficient - The coefficient of the payoutToken price in scientific notation (also known as the significant digits) /// payoutPriceDecimals - The significand of the payoutToken price in scientific notation (also known as the base ten exponent) /// quotePriceCoefficient - The coefficient of the quoteToken price in scientific notation (also known as the significant digits) /// quotePriceDecimals - The significand of the quoteToken price in scientific notation (also known as the base ten exponent) /// scaleAdjustment - see below /// * In the above definitions, the "prices" need to have the same unit of account (i.e. both in OHM, $, ETH, etc.) /// If price is not provided in this format, the market will not behave as intended. /// @param params_ Encoded bytes array, with the following elements /// @dev 0. Payout Token (token paid out) /// @dev 1. Quote Token (token to be received) /// @dev 2. Callback contract address, should conform to IBondCallback. If 0x00, tokens will be transferred from market.owner /// @dev 3. Is Capacity in Quote Token? /// @dev 4. Capacity (amount in quoteDecimals or amount in payoutDecimals) /// @dev 5. Formatted initial price (see note above) /// @dev 6. Formatted minimum price (see note above) /// @dev 7. Debt buffer. Percent with 3 decimals. Percentage over the initial debt to allow the market to accumulate at anyone time. /// @dev Works as a circuit breaker for the market in case external conditions incentivize massive buying (e.g. stablecoin depeg). /// @dev Minimum is the greater of 10% or initial max payout as a percentage of capacity. /// @dev If the value is too small, the market will not be able function normally and close prematurely. /// @dev If the value is too large, the market will not circuit break when intended. The value must be > 10% but can exceed 100% if desired. /// @dev A good heuristic to calculate a debtBuffer with is to determine the amount of capacity that you think is reasonable to be expended /// @dev in a short duration as a percent, e.g. 25%. Then a reasonable debtBuffer would be: 0.25 * 1e3 * decayInterval / marketDuration /// @dev where decayInterval = max(3 days, 5 * depositInterval) and marketDuration = conclusion - creation time. /// @dev 8. Is fixed term ? Vesting length (seconds) : Vesting expiry (timestamp). /// @dev A 'vesting' param longer than 50 years is considered a timestamp for fixed expiry. /// @dev 9. Conclusion (timestamp) /// @dev 10. Deposit interval (seconds) /// @dev 11. Market scaling factor adjustment, ranges from -24 to +24 within the configured market bounds. /// @dev Should be calculated as: (payoutDecimals - quoteDecimals) - ((payoutPriceDecimals - quotePriceDecimals) / 2) /// @dev Providing a scaling factor adjustment that doesn't follow this formula could lead to under or overflow errors in the market. /// @return ID of new bond market struct MarketParams { ERC20 payoutToken; ERC20 quoteToken; address callbackAddr; bool capacityInQuote; uint256 capacity; uint256 formattedInitialPrice; uint256 formattedMinimumPrice; uint32 debtBuffer; uint48 vesting; uint48 conclusion; uint32 depositInterval; int8 scaleAdjustment; } /* ========== VIEW FUNCTIONS ========== */ /// @notice Calculate current market price of payout token in quote tokens /// @dev Accounts for debt and control variable decay since last deposit (vs _marketPrice()) /// @param id_ ID of market /// @return Price for market in configured decimals (see MarketParams) // // price is derived from the equation // // p = c * d // // where // p = price // c = control variable // d = debt // // d -= ( d * (dt / l) ) // // where // dt = change in time // l = length of program // // if price is below minimum price, minimum price is returned // this is enforced on deposits by manipulating total debt (see _decay()) function marketPrice(uint256 id_) external view override returns (uint256); /// @notice Calculate debt factoring in decay /// @dev Accounts for debt decay since last deposit /// @param id_ ID of market /// @return Current debt for market in payout token decimals function currentDebt(uint256 id_) external view returns (uint256); /// @notice Up to date control variable /// @dev Accounts for control variable adjustment /// @param id_ ID of market /// @return Control variable for market in payout token decimals function currentControlVariable(uint256 id_) external view returns (uint256); }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; interface IBondCallback { /// @notice Send payout tokens to Teller while allowing market owners to perform custom logic on received or paid out tokens /// @notice Market ID on Teller must be whitelisted /// @param id_ ID of the market /// @param inputAmount_ Amount of quote tokens bonded to the market /// @param outputAmount_ Amount of payout tokens to be paid out to the market /// @dev Must transfer the output amount of payout tokens back to the Teller /// @dev Should check that the quote tokens have been transferred to the contract in the _callback function function callback(uint256 id_, uint256 inputAmount_, uint256 outputAmount_) external; /// @notice Returns the number of quote tokens received and payout tokens paid out for a market /// @param id_ ID of the market /// @return in_ Amount of quote tokens bonded to the market /// @return out_ Amount of payout tokens paid out to the market function amountsForMarket(uint256 id_) external view returns (uint256 in_, uint256 out_); /// @notice Whitelist a teller and market ID combination /// @notice Must be callback owner /// @param teller_ Address of the Teller contract which serves the market /// @param id_ ID of the market function whitelist(address teller_, uint256 id_) external; /// @notice Remove a market ID on a teller from the whitelist /// @dev Shutdown function in case there's an issue with the teller /// @param teller_ Address of the Teller contract which serves the market /// @param id_ ID of the market to remove from whitelist function blacklist(address teller_, uint256 id_) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorInterface { function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external view returns (int256); function getTimestamp(uint256 roundId) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); } interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData( uint80 _roundId ) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); } interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; import {IBondTeller} from "../interfaces/IBondTeller.sol"; import {IBondAggregator} from "../interfaces/IBondAggregator.sol"; interface IBondAuctioneer { /// @notice Creates a new bond market /// @param params_ Configuration data needed for market creation, encoded in a bytes array /// @dev See specific auctioneer implementations for details on encoding the parameters. /// @return id ID of new bond market function createMarket(bytes memory params_) external returns (uint256); /// @notice Disable existing bond market /// @notice Must be market owner /// @param id_ ID of market to close function closeMarket(uint256 id_) external; /// @notice Exchange quote tokens for a bond in a specified market /// @notice Must be teller /// @param id_ ID of the Market the bond is being purchased from /// @param amount_ Amount to deposit in exchange for bond (after fee has been deducted) /// @param minAmountOut_ Minimum acceptable amount of bond to receive. Prevents frontrunning /// @return payout Amount of payout token to be received from the bond function purchaseBond( uint256 id_, uint256 amount_, uint256 minAmountOut_ ) external returns (uint256 payout); /// @notice Set market intervals to different values than the defaults /// @notice Must be market owner /// @dev Changing the intervals could cause markets to behave in unexpected way /// tuneInterval should be greater than tuneAdjustmentDelay /// @param id_ Market ID /// @param intervals_ Array of intervals (3) /// 1. Tune interval - Frequency of tuning /// 2. Tune adjustment delay - Time to implement downward tuning adjustments /// 3. Debt decay interval - Interval over which debt should decay completely function setIntervals(uint256 id_, uint32[3] calldata intervals_) external; /// @notice Designate a new owner of a market /// @notice Must be market owner /// @dev Doesn't change permissions until newOwner calls pullOwnership /// @param id_ Market ID /// @param newOwner_ New address to give ownership to function pushOwnership(uint256 id_, address newOwner_) external; /// @notice Accept ownership of a market /// @notice Must be market newOwner /// @dev The existing owner must call pushOwnership prior to the newOwner calling this function /// @param id_ Market ID function pullOwnership(uint256 id_) external; /// @notice Set the auctioneer defaults /// @notice Must be policy /// @param defaults_ Array of default values /// 1. Tune interval - amount of time between tuning adjustments /// 2. Tune adjustment delay - amount of time to apply downward tuning adjustments /// 3. Minimum debt decay interval - minimum amount of time to let debt decay to zero /// 4. Minimum deposit interval - minimum amount of time to wait between deposits /// 5. Minimum market duration - minimum amount of time a market can be created for /// 6. Minimum debt buffer - the minimum amount of debt over the initial debt to trigger a market shutdown /// @dev The defaults set here are important to avoid edge cases in market behavior, e.g. a very short market reacts doesn't tune well /// @dev Only applies to new markets that are created after the change function setDefaults(uint32[6] memory defaults_) external; /// @notice Change the status of the auctioneer to allow creation of new markets /// @dev Setting to false and allowing active markets to end will sunset the auctioneer /// @param status_ Allow market creation (true) : Disallow market creation (false) function setAllowNewMarkets(bool status_) external; /// @notice Change whether a market creator is allowed to use a callback address in their markets or not /// @notice Must be guardian /// @dev Callback is believed to be safe, but a whitelist is implemented to prevent abuse /// @param creator_ Address of market creator /// @param status_ Allow callback (true) : Disallow callback (false) function setCallbackAuthStatus(address creator_, bool status_) external; /* ========== VIEW FUNCTIONS ========== */ /// @notice Provides information for the Teller to execute purchases on a Market /// @param id_ Market ID /// @return owner Address of the market owner (tokens transferred from this address if no callback) /// @return callbackAddr Address of the callback contract to get tokens for payouts /// @return payoutToken Payout Token (token paid out) for the Market /// @return quoteToken Quote Token (token received) for the Market /// @return vesting Timestamp or duration for vesting, implementation-dependent /// @return maxPayout Maximum amount of payout tokens you can purchase in one transaction function getMarketInfoForPurchase( uint256 id_ ) external view returns ( address owner, address callbackAddr, ERC20 payoutToken, ERC20 quoteToken, uint48 vesting, uint256 maxPayout ); /// @notice Calculate current market price of payout token in quote tokens /// @param id_ ID of market /// @return Price for market in configured decimals // // if price is below minimum price, minimum price is returned function marketPrice(uint256 id_) external view returns (uint256); /// @notice Scale value to use when converting between quote token and payout token amounts with marketPrice() /// @param id_ ID of market /// @return Scaling factor for market in configured decimals function marketScale(uint256 id_) external view returns (uint256); /// @notice Payout due for amount of quote tokens /// @dev Accounts for debt and control variable decay so it is up to date /// @param amount_ Amount of quote tokens to spend /// @param id_ ID of market /// @param referrer_ Address of referrer, used to get fees to calculate accurate payout amount. /// Inputting the zero address will take into account just the protocol fee. /// @return amount of payout tokens to be paid function payoutFor( uint256 amount_, uint256 id_, address referrer_ ) external view returns (uint256); /// @notice Returns maximum amount of quote token accepted by the market /// @param id_ ID of market /// @param referrer_ Address of referrer, used to get fees to calculate accurate payout amount. /// Inputting the zero address will take into account just the protocol fee. function maxAmountAccepted(uint256 id_, address referrer_) external view returns (uint256); /// @notice Does market send payout immediately /// @param id_ Market ID to search for function isInstantSwap(uint256 id_) external view returns (bool); /// @notice Is a given market accepting deposits /// @param id_ ID of market function isLive(uint256 id_) external view returns (bool); /// @notice Returns the address of the market owner /// @param id_ ID of market function ownerOf(uint256 id_) external view returns (address); /// @notice Returns the Teller that services the Auctioneer function getTeller() external view returns (IBondTeller); /// @notice Returns the Aggregator that services the Auctioneer function getAggregator() external view returns (IBondAggregator); /// @notice Returns current capacity of a market function currentCapacity(uint256 id_) external view returns (uint256); }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; interface IBondTeller { /// @notice Exchange quote tokens for a bond in a specified market /// @param recipient_ Address of recipient of bond. Allows deposits for other addresses /// @param referrer_ Address of referrer who will receive referral fee. For frontends to fill. /// Direct calls can use the zero address for no referrer fee. /// @param id_ ID of the Market the bond is being purchased from /// @param amount_ Amount to deposit in exchange for bond /// @param minAmountOut_ Minimum acceptable amount of bond to receive. Prevents frontrunning /// @return Amount of payout token to be received from the bond /// @return Timestamp at which the bond token can be redeemed for the underlying token function purchase( address recipient_, address referrer_, uint256 id_, uint256 amount_, uint256 minAmountOut_ ) external returns (uint256, uint48); /// @notice Get current fee charged by the teller based on the combined protocol and referrer fee /// @param referrer_ Address of the referrer /// @return Fee in basis points (3 decimal places) function getFee(address referrer_) external view returns (uint48); /// @notice Set protocol fee /// @notice Must be guardian /// @param fee_ Protocol fee in basis points (3 decimal places) function setProtocolFee(uint48 fee_) external; /// @notice Set the discount for creating bond tokens from the base protocol fee /// @dev The discount is subtracted from the protocol fee to determine the fee /// when using create() to mint bond tokens without using an Auctioneer /// @param discount_ Create Fee Discount in basis points (3 decimal places) function setCreateFeeDiscount(uint48 discount_) external; /// @notice Set your fee as a referrer to the protocol /// @notice Fee is set for sending address /// @param fee_ Referrer fee in basis points (3 decimal places) function setReferrerFee(uint48 fee_) external; /// @notice Claim fees accrued by sender in the input tokens and sends them to the provided address /// @param tokens_ Array of tokens to claim fees for /// @param to_ Address to send fees to function claimFees(ERC20[] memory tokens_, address to_) external; }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; import {ERC20} from "solmate/tokens/ERC20.sol"; import {IBondAuctioneer} from "../interfaces/IBondAuctioneer.sol"; import {IBondTeller} from "../interfaces/IBondTeller.sol"; interface IBondAggregator { /// @notice Register a auctioneer with the aggregator /// @notice Only Guardian /// @param auctioneer_ Address of the Auctioneer to register /// @dev A auctioneer must be registered with an aggregator to create markets function registerAuctioneer(IBondAuctioneer auctioneer_) external; /// @notice Register a new market with the aggregator /// @notice Only registered depositories /// @param payoutToken_ Token to be paid out by the market /// @param quoteToken_ Token to be accepted by the market /// @param marketId ID of the market being created function registerMarket( ERC20 payoutToken_, ERC20 quoteToken_ ) external returns (uint256 marketId); /// @notice Get the auctioneer for the provided market ID /// @param id_ ID of Market function getAuctioneer(uint256 id_) external view returns (IBondAuctioneer); /// @notice Calculate current market price of payout token in quote tokens /// @dev Accounts for debt and control variable decay since last deposit (vs _marketPrice()) /// @param id_ ID of market /// @return Price for market (see the specific auctioneer for units) // // if price is below minimum price, minimum price is returned // this is enforced on deposits by manipulating total debt (see _decay()) function marketPrice(uint256 id_) external view returns (uint256); /// @notice Scale value to use when converting between quote token and payout token amounts with marketPrice() /// @param id_ ID of market /// @return Scaling factor for market in configured decimals function marketScale(uint256 id_) external view returns (uint256); /// @notice Payout due for amount of quote tokens /// @dev Accounts for debt and control variable decay so it is up to date /// @param amount_ Amount of quote tokens to spend /// @param id_ ID of market /// @param referrer_ Address of referrer, used to get fees to calculate accurate payout amount. /// Inputting the zero address will take into account just the protocol fee. /// @return amount of payout tokens to be paid function payoutFor( uint256 amount_, uint256 id_, address referrer_ ) external view returns (uint256); /// @notice Returns maximum amount of quote token accepted by the market /// @param id_ ID of market /// @param referrer_ Address of referrer, used to get fees to calculate accurate payout amount. /// Inputting the zero address will take into account just the protocol fee. function maxAmountAccepted(uint256 id_, address referrer_) external view returns (uint256); /// @notice Does market send payout immediately /// @param id_ Market ID to search for function isInstantSwap(uint256 id_) external view returns (bool); /// @notice Is a given market accepting deposits /// @param id_ ID of market function isLive(uint256 id_) external view returns (bool); /// @notice Returns array of active market IDs within a range /// @dev Should be used if length exceeds max to query entire array function liveMarketsBetween( uint256 firstIndex_, uint256 lastIndex_ ) external view returns (uint256[] memory); /// @notice Returns an array of all active market IDs for a given quote token /// @param token_ Address of token to query by /// @param isPayout_ If true, search by payout token, else search for quote token function liveMarketsFor( address token_, bool isPayout_ ) external view returns (uint256[] memory); /// @notice Returns an array of all active market IDs for a given owner /// @param owner_ Address of owner to query by /// @param firstIndex_ Market ID to start at /// @param lastIndex_ Market ID to end at (non-inclusive) function liveMarketsBy( address owner_, uint256 firstIndex_, uint256 lastIndex_ ) external view returns (uint256[] memory); /// @notice Returns an array of all active market IDs for a given payout and quote token /// @param payout_ Address of payout token /// @param quote_ Address of quote token function marketsFor(address payout_, address quote_) external view returns (uint256[] memory); /// @notice Returns the market ID with the highest current payoutToken payout for depositing quoteToken /// @param payout_ Address of payout token /// @param quote_ Address of quote token /// @param amountIn_ Amount of quote tokens to deposit /// @param minAmountOut_ Minimum amount of payout tokens to receive as payout /// @param maxExpiry_ Latest acceptable vesting timestamp for bond /// Inputting the zero address will take into account just the protocol fee. function findMarketFor( address payout_, address quote_, uint256 amountIn_, uint256 minAmountOut_, uint256 maxExpiry_ ) external view returns (uint256 id); /// @notice Returns the Teller that services the market ID function getTeller(uint256 id_) external view returns (IBondTeller); /// @notice Returns current capacity of a market function currentCapacity(uint256 id_) external view returns (uint256); }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "balancer-v2/=lib/balancer-v2/", "bonds/=lib/bonds/src/", "clones-with-immutable-args/=lib/clones-with-immutable-args/src/", "clones/=lib/clones-with-immutable-args/src/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "interfaces/=src/interfaces/", "layer-zero/=lib/solidity-examples/contracts/", "libraries/=src/libraries/", "modules/=src/modules/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "policies/=src/policies/", "solidity-examples/=lib/solidity-examples/contracts/", "solmate/=lib/solmate/src/", "test/=src/test/" ], "optimizer": { "enabled": true, "runs": 10 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract Kernel","name":"kernel_","type":"address"},{"internalType":"contract IOperator","name":"operator_","type":"address"},{"internalType":"contract ERC20","name":"rewardToken_","type":"address"},{"internalType":"uint256","name":"maxReward_","type":"uint256"},{"internalType":"uint48","name":"auctionDuration_","type":"uint48"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Heart_BeatAvailable","type":"error"},{"inputs":[],"name":"Heart_BeatStopped","type":"error"},{"inputs":[],"name":"Heart_InvalidParams","type":"error"},{"inputs":[],"name":"Heart_OutOfCycle","type":"error"},{"inputs":[{"internalType":"address","name":"caller_","type":"address"}],"name":"KernelAdapter_OnlyKernel","type":"error"},{"inputs":[{"internalType":"Keycode","name":"keycode_","type":"bytes5"}],"name":"Policy_ModuleDoesNotExist","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp_","type":"uint256"}],"name":"Beat","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to_","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount_","type":"uint256"}],"name":"RewardIssued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ERC20","name":"token_","type":"address"},{"indexed":false,"internalType":"uint256","name":"maxRewardAmount_","type":"uint256"},{"indexed":false,"internalType":"uint48","name":"auctionDuration_","type":"uint48"}],"name":"RewardUpdated","type":"event"},{"inputs":[],"name":"ROLES","outputs":[{"internalType":"contract ROLESv1","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"active","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionDuration","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Kernel","name":"newKernel_","type":"address"}],"name":"changeKernel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"configureDependencies","outputs":[{"internalType":"Keycode[]","name":"dependencies","type":"bytes5[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deactivate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"frequency","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kernel","outputs":[{"internalType":"contract Kernel","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastBeat","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"contract IOperator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestPermissions","outputs":[{"components":[{"internalType":"Keycode","name":"keycode","type":"bytes5"},{"internalType":"bytes4","name":"funcSelector","type":"bytes4"}],"internalType":"struct Permissions[]","name":"permissions","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"resetBeat","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator_","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token_","type":"address"},{"internalType":"uint256","name":"maxReward_","type":"uint256"},{"internalType":"uint48","name":"auctionDuration_","type":"uint48"}],"name":"setRewardAuctionParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token_","type":"address"}],"name":"withdrawUnspentRewards","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405260016002553480156200001657600080fd5b50604051620015f7380380620015f783398101604081905262000039916200012b565b600080546001600160a01b03199081166001600160a01b0388811691909117909255600680549091168683161790556005805460ff19166001179055600380544265ffffffffffff9081166001600160601b0319909216919091176601000000000000918516918202176001600160601b03166c0100000000000000000000000093871693840217909155600484905560408051928352602083018590528201527f65fc47e037dffbfe0f2c76bf2ca96c2104c10473c3862878b7190449b6416fd69060600160405180910390a15050505050620001a9565b6001600160a01b03811681146200012857600080fd5b50565b600080600080600060a086880312156200014457600080fd5b8551620001518162000112565b6020870151909550620001648162000112565b6040870151909450620001778162000112565b60608701516080880151919450925065ffffffffffff811681146200019b57600080fd5b809150509295509295909350565b61143e80620001b96000396000f3fe608060405234801561001057600080fd5b50600436106101075760003560e01c806302fb0c5e1461010c57806307621eca1461012e5780630cbf54c8146101445780630f15f4c01461017457806322f3e2d41461017e5780634657b36c1461018657806351b42b0014610199578063570ca735146101a15780635924be70146101c157806366a78e6c146101d65780636911bb58146101df5780637a259dba146101f2578063923cb952146101fa5780639459b8751461020d5780639ab7d7e714610222578063b3ab15fb14610235578063d3a7b7d314610248578063d4aae0c41461025a578063ead50da31461026d578063ef68b87d14610275578063f7c618c11461027d575b600080fd5b6005546101199060ff1681565b60405190151581526020015b60405180910390f35b610136610297565b604051908152602001610125565b60035461015d90600160301b900465ffffffffffff1681565b60405165ffffffffffff9091168152602001610125565b61017c610415565b005b6101196104a0565b61017c6101943660046110bf565b610517565b61017c61056f565b6006546101b4906001600160a01b031681565b60405161012591906110e3565b6101c96105ee565b60405161012591906110f7565b61013660045481565b61017c6101ed36600461116e565b6106eb565b61017c610869565b6001546101b4906001600160a01b031681565b610215610ada565b60405161012591906111b0565b61017c6102303660046110bf565b610bf5565b61017c6102433660046110bf565b610d39565b60035461015d9065ffffffffffff1681565b6000546101b4906001600160a01b031681565b61015d610dcf565b61017c610e48565b6003546101b490600160601b90046001600160a01b031681565b6000806102a2610dcf565b6003549091506000906102be90839065ffffffffffff16611214565b600354909150429060009065ffffffffffff808616600160301b90920416116102f857600354600160301b900465ffffffffffff166102fa565b835b90508265ffffffffffff168265ffffffffffff161161031e57600094505050505090565b600065ffffffffffff8216610333858561123e565b65ffffffffffff16116103785760045465ffffffffffff831690610357868661123e565b65ffffffffffff166103699190611265565b610373919061129a565b61037c565b6004545b6003546040516370a0823160e01b8152919250600091600160601b9091046001600160a01b0316906370a08231906103b89030906004016110e3565b602060405180830381865afa1580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f991906112ae565b9050808211610408578161040a565b805b965050505050505090565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c59061045590849033906004016112c7565b600060405180830381600087803b15801561046f57600080fd5b505af1158015610483573d6000803e3d6000fd5b50506005805460ff191660011790555061049d9050610ebe565b50565b6000805460405163e52223bb60e01b81526001600160a01b039091169063e52223bb906104d19030906004016110e3565b602060405180830381865afa1580156104ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051291906112de565b905090565b6000546001600160a01b0316331461054d573360405163053e900f60e21b815260040161054491906110e3565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c5906105af90849033906004016112c7565b600060405180830381600087803b1580156105c957600080fd5b505af11580156105dd573d6000803e3d6000fd5b50506005805460ff19169055505050565b604080516001808252818301909252606091816020015b60408051808201909152600080825260208201528152602001906001900390816106055790505090506040518060400160405280600560019054906101000a90046001600160a01b03166001600160a01b0316631ae7ec2e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561068c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b09190611300565b6001600160d81b031916815263086db7df60e41b602090910152815182906000906106dd576106dd61132a565b602002602001018190525090565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c59061072b90849033906004016112c7565b600060405180830381600087803b15801561074557600080fd5b505af1158015610759573d6000803e3d6000fd5b50505050610765610dcf565b60035461077a919065ffffffffffff16611214565b65ffffffffffff164265ffffffffffff16106107a957604051630bcdbe2960e21b815260040160405180910390fd5b6107b1610dcf565b65ffffffffffff168265ffffffffffff1611156107e1576040516325d1032760e21b815260040160405180910390fd5b60038054600485905565ffffffffffff908116600160601b6001600160a01b03881690810265ffffffffffff60301b191691909117600160301b9286169283021790925560408051928352602083018690528201527f65fc47e037dffbfe0f2c76bf2ca96c2104c10473c3862878b7190449b6416fd69060600160405180910390a150505050565b6002546001146108a85760405162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b6044820152606401610544565b6002805560055460ff166108cf57604051630137efe360e71b815260040160405180910390fd5b426108d8610dcf565b6003546108ed919065ffffffffffff16611214565b65ffffffffffff168165ffffffffffff16101561091d5760405163461bbb8360e11b815260040160405180910390fd5b600560019054906101000a90046001600160a01b03166001600160a01b03166386db7df06040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561096d57600080fd5b505af1158015610981573d6000803e3d6000fd5b50505050600660009054906101000a90046001600160a01b03166001600160a01b0316637159a6186040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156109d557600080fd5b505af11580156109e9573d6000803e3d6000fd5b5050505060006109f7610297565b9050610a01610dcf565b600354610a169065ffffffffffff168461123e565b610a209190611340565b610a2a908361123e565b6003805465ffffffffffff191665ffffffffffff929092169190911790819055610a6590600160601b90046001600160a01b03163383610ef0565b7ff9b6ec770c96c3a6f9225bf3a8463a8ad03e884448af07b4ecd4d19d628946ee3382604051610a96929190611365565b60405180910390a16040514281527fd5215e0661831421a9ebc79f9d2848dbfc61213cf6ae3c92b45e17ea50be19109060200160405180910390a150506001600255565b604080516002808252606080830184529260208301908036833701905050905064505249434560d81b81600081518110610b1657610b1661132a565b6001600160d81b031990921660209283029190910190910152610b3e64524f4c455360d81b90565b81600181518110610b5157610b5161132a565b60200260200101906001600160d81b03191690816001600160d81b03191681525050610b9681600081518110610b8957610b8961132a565b6020026020010151611007565b600560016101000a8154816001600160a01b0302191690836001600160a01b03160217905550610bd281600181518110610b8957610b8961132a565b600180546001600160a01b0319166001600160a01b039290921691909117905590565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c590610c3590849033906004016112c7565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050610c6f610dcf565b600354610c84919065ffffffffffff16611214565b65ffffffffffff164265ffffffffffff1610610cb357604051630bcdbe2960e21b815260040160405180910390fd5b610d3533836001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610ce391906110e3565b602060405180830381865afa158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2491906112ae565b6001600160a01b0385169190610ef0565b5050565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c590610d7990849033906004016112c7565b600060405180830381600087803b158015610d9357600080fd5b505af1158015610da7573d6000803e3d6000fd5b5050600680546001600160a01b0319166001600160a01b039590951694909417909355505050565b6000600560019054906101000a90046001600160a01b03166001600160a01b0316637321f1006040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610512919061137e565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c590610e8890849033906004016112c7565b600060405180830381600087803b158015610ea257600080fd5b505af1158015610eb6573d6000803e3d6000fd5b5050505061049d5b610ec6610dcf565b610ed0904261123e565b6003805465ffffffffffff191665ffffffffffff92909216919091179055565b600080846001600160a01b031663a9059cbb60e01b8585604051602401610f18929190611365565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610f56919061139b565b6000604051808303816000865af19150503d8060008114610f93576040519150601f19603f3d011682016040523d82523d6000602084013e610f98565b606091505b5091509150818015610fc2575080511580610fc2575080806020019051810190610fc291906112de565b6110005760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610544565b5050505050565b60008054604051632d37002d60e21b815282916001600160a01b03169063b4dc00b4906110389086906004016113d6565b602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107991906113eb565b90506001600160a01b0381166110a45782604051635c3fa9cd60e01b815260040161054491906113d6565b92915050565b6001600160a01b038116811461049d57600080fd5b6000602082840312156110d157600080fd5b81356110dc816110aa565b9392505050565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b8281101561114d57815180516001600160d81b03191685528601516001600160e01b031916868501529284019290850190600101611114565b5091979650505050505050565b65ffffffffffff8116811461049d57600080fd5b60008060006060848603121561118357600080fd5b833561118e816110aa565b92506020840135915060408401356111a58161115a565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156111f25783516001600160d81b031916835292840192918401916001016111cc565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600065ffffffffffff808316818516808303821115611235576112356111fe565b01949350505050565b600065ffffffffffff8381169083168181101561125d5761125d6111fe565b039392505050565b600081600019048311821515161561127f5761127f6111fe565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826112a9576112a9611284565b500490565b6000602082840312156112c057600080fd5b5051919050565b9182526001600160a01b0316602082015260400190565b6000602082840312156112f057600080fd5b815180151581146110dc57600080fd5b60006020828403121561131257600080fd5b81516001600160d81b0319811681146110dc57600080fd5b634e487b7160e01b600052603260045260246000fd5b600065ffffffffffff8084168061135957611359611284565b92169190910692915050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561139057600080fd5b81516110dc8161115a565b6000825160005b818110156113bc57602081860181015185830152016113a2565b818111156113cb576000828501525b509190910192915050565b6001600160d81b031991909116815260200190565b6000602082840312156113fd57600080fd5b81516110dc816110aa56fea264697066735822122024fc661f763f61af102e13d7401957db6c2aa37bd29a2750ea85f4d739aa4b4164736f6c634300080f00330000000000000000000000002286d7f9639e8158fad1169e76d1fbc38247f54b0000000000000000000000005f15b91b59ad65d490921016d4134c230119748500000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d500000000000000000000000000000000000000000000000000000009502f900000000000000000000000000000000000000000000000000000000000000004b0
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101075760003560e01c806302fb0c5e1461010c57806307621eca1461012e5780630cbf54c8146101445780630f15f4c01461017457806322f3e2d41461017e5780634657b36c1461018657806351b42b0014610199578063570ca735146101a15780635924be70146101c157806366a78e6c146101d65780636911bb58146101df5780637a259dba146101f2578063923cb952146101fa5780639459b8751461020d5780639ab7d7e714610222578063b3ab15fb14610235578063d3a7b7d314610248578063d4aae0c41461025a578063ead50da31461026d578063ef68b87d14610275578063f7c618c11461027d575b600080fd5b6005546101199060ff1681565b60405190151581526020015b60405180910390f35b610136610297565b604051908152602001610125565b60035461015d90600160301b900465ffffffffffff1681565b60405165ffffffffffff9091168152602001610125565b61017c610415565b005b6101196104a0565b61017c6101943660046110bf565b610517565b61017c61056f565b6006546101b4906001600160a01b031681565b60405161012591906110e3565b6101c96105ee565b60405161012591906110f7565b61013660045481565b61017c6101ed36600461116e565b6106eb565b61017c610869565b6001546101b4906001600160a01b031681565b610215610ada565b60405161012591906111b0565b61017c6102303660046110bf565b610bf5565b61017c6102433660046110bf565b610d39565b60035461015d9065ffffffffffff1681565b6000546101b4906001600160a01b031681565b61015d610dcf565b61017c610e48565b6003546101b490600160601b90046001600160a01b031681565b6000806102a2610dcf565b6003549091506000906102be90839065ffffffffffff16611214565b600354909150429060009065ffffffffffff808616600160301b90920416116102f857600354600160301b900465ffffffffffff166102fa565b835b90508265ffffffffffff168265ffffffffffff161161031e57600094505050505090565b600065ffffffffffff8216610333858561123e565b65ffffffffffff16116103785760045465ffffffffffff831690610357868661123e565b65ffffffffffff166103699190611265565b610373919061129a565b61037c565b6004545b6003546040516370a0823160e01b8152919250600091600160601b9091046001600160a01b0316906370a08231906103b89030906004016110e3565b602060405180830381865afa1580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f991906112ae565b9050808211610408578161040a565b805b965050505050505090565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c59061045590849033906004016112c7565b600060405180830381600087803b15801561046f57600080fd5b505af1158015610483573d6000803e3d6000fd5b50506005805460ff191660011790555061049d9050610ebe565b50565b6000805460405163e52223bb60e01b81526001600160a01b039091169063e52223bb906104d19030906004016110e3565b602060405180830381865afa1580156104ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051291906112de565b905090565b6000546001600160a01b0316331461054d573360405163053e900f60e21b815260040161054491906110e3565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c5906105af90849033906004016112c7565b600060405180830381600087803b1580156105c957600080fd5b505af11580156105dd573d6000803e3d6000fd5b50506005805460ff19169055505050565b604080516001808252818301909252606091816020015b60408051808201909152600080825260208201528152602001906001900390816106055790505090506040518060400160405280600560019054906101000a90046001600160a01b03166001600160a01b0316631ae7ec2e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561068c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b09190611300565b6001600160d81b031916815263086db7df60e41b602090910152815182906000906106dd576106dd61132a565b602002602001018190525090565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c59061072b90849033906004016112c7565b600060405180830381600087803b15801561074557600080fd5b505af1158015610759573d6000803e3d6000fd5b50505050610765610dcf565b60035461077a919065ffffffffffff16611214565b65ffffffffffff164265ffffffffffff16106107a957604051630bcdbe2960e21b815260040160405180910390fd5b6107b1610dcf565b65ffffffffffff168265ffffffffffff1611156107e1576040516325d1032760e21b815260040160405180910390fd5b60038054600485905565ffffffffffff908116600160601b6001600160a01b03881690810265ffffffffffff60301b191691909117600160301b9286169283021790925560408051928352602083018690528201527f65fc47e037dffbfe0f2c76bf2ca96c2104c10473c3862878b7190449b6416fd69060600160405180910390a150505050565b6002546001146108a85760405162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b6044820152606401610544565b6002805560055460ff166108cf57604051630137efe360e71b815260040160405180910390fd5b426108d8610dcf565b6003546108ed919065ffffffffffff16611214565b65ffffffffffff168165ffffffffffff16101561091d5760405163461bbb8360e11b815260040160405180910390fd5b600560019054906101000a90046001600160a01b03166001600160a01b03166386db7df06040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561096d57600080fd5b505af1158015610981573d6000803e3d6000fd5b50505050600660009054906101000a90046001600160a01b03166001600160a01b0316637159a6186040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156109d557600080fd5b505af11580156109e9573d6000803e3d6000fd5b5050505060006109f7610297565b9050610a01610dcf565b600354610a169065ffffffffffff168461123e565b610a209190611340565b610a2a908361123e565b6003805465ffffffffffff191665ffffffffffff929092169190911790819055610a6590600160601b90046001600160a01b03163383610ef0565b7ff9b6ec770c96c3a6f9225bf3a8463a8ad03e884448af07b4ecd4d19d628946ee3382604051610a96929190611365565b60405180910390a16040514281527fd5215e0661831421a9ebc79f9d2848dbfc61213cf6ae3c92b45e17ea50be19109060200160405180910390a150506001600255565b604080516002808252606080830184529260208301908036833701905050905064505249434560d81b81600081518110610b1657610b1661132a565b6001600160d81b031990921660209283029190910190910152610b3e64524f4c455360d81b90565b81600181518110610b5157610b5161132a565b60200260200101906001600160d81b03191690816001600160d81b03191681525050610b9681600081518110610b8957610b8961132a565b6020026020010151611007565b600560016101000a8154816001600160a01b0302191690836001600160a01b03160217905550610bd281600181518110610b8957610b8961132a565b600180546001600160a01b0319166001600160a01b039290921691909117905590565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c590610c3590849033906004016112c7565b600060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b50505050610c6f610dcf565b600354610c84919065ffffffffffff16611214565b65ffffffffffff164265ffffffffffff1610610cb357604051630bcdbe2960e21b815260040160405180910390fd5b610d3533836001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610ce391906110e3565b602060405180830381865afa158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2491906112ae565b6001600160a01b0385169190610ef0565b5050565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c590610d7990849033906004016112c7565b600060405180830381600087803b158015610d9357600080fd5b505af1158015610da7573d6000803e3d6000fd5b5050600680546001600160a01b0319166001600160a01b039590951694909417909355505050565b6000600560019054906101000a90046001600160a01b03166001600160a01b0316637321f1006040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610512919061137e565b60015460405163d09a20c560e01b81526a3432b0b93a2fb0b236b4b760a91b916001600160a01b03169063d09a20c590610e8890849033906004016112c7565b600060405180830381600087803b158015610ea257600080fd5b505af1158015610eb6573d6000803e3d6000fd5b5050505061049d5b610ec6610dcf565b610ed0904261123e565b6003805465ffffffffffff191665ffffffffffff92909216919091179055565b600080846001600160a01b031663a9059cbb60e01b8585604051602401610f18929190611365565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610f56919061139b565b6000604051808303816000865af19150503d8060008114610f93576040519150601f19603f3d011682016040523d82523d6000602084013e610f98565b606091505b5091509150818015610fc2575080511580610fc2575080806020019051810190610fc291906112de565b6110005760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610544565b5050505050565b60008054604051632d37002d60e21b815282916001600160a01b03169063b4dc00b4906110389086906004016113d6565b602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107991906113eb565b90506001600160a01b0381166110a45782604051635c3fa9cd60e01b815260040161054491906113d6565b92915050565b6001600160a01b038116811461049d57600080fd5b6000602082840312156110d157600080fd5b81356110dc816110aa565b9392505050565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b8281101561114d57815180516001600160d81b03191685528601516001600160e01b031916868501529284019290850190600101611114565b5091979650505050505050565b65ffffffffffff8116811461049d57600080fd5b60008060006060848603121561118357600080fd5b833561118e816110aa565b92506020840135915060408401356111a58161115a565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156111f25783516001600160d81b031916835292840192918401916001016111cc565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b600065ffffffffffff808316818516808303821115611235576112356111fe565b01949350505050565b600065ffffffffffff8381169083168181101561125d5761125d6111fe565b039392505050565b600081600019048311821515161561127f5761127f6111fe565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826112a9576112a9611284565b500490565b6000602082840312156112c057600080fd5b5051919050565b9182526001600160a01b0316602082015260400190565b6000602082840312156112f057600080fd5b815180151581146110dc57600080fd5b60006020828403121561131257600080fd5b81516001600160d81b0319811681146110dc57600080fd5b634e487b7160e01b600052603260045260246000fd5b600065ffffffffffff8084168061135957611359611284565b92169190910692915050565b6001600160a01b03929092168252602082015260400190565b60006020828403121561139057600080fd5b81516110dc8161115a565b6000825160005b818110156113bc57602081860181015185830152016113a2565b818111156113cb576000828501525b509190910192915050565b6001600160d81b031991909116815260200190565b6000602082840312156113fd57600080fd5b81516110dc816110aa56fea264697066735822122024fc661f763f61af102e13d7401957db6c2aa37bd29a2750ea85f4d739aa4b4164736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002286d7f9639e8158fad1169e76d1fbc38247f54b0000000000000000000000005f15b91b59ad65d490921016d4134c230119748500000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d500000000000000000000000000000000000000000000000000000009502f900000000000000000000000000000000000000000000000000000000000000004b0
-----Decoded View---------------
Arg [0] : kernel_ (address): 0x2286d7f9639e8158FaD1169e76d1FbC38247f54b
Arg [1] : operator_ (address): 0x5F15b91B59AD65D490921016d4134c2301197485
Arg [2] : rewardToken_ (address): 0x64aa3364F17a4D01c6f1751Fd97C2BD3D7e7f1D5
Arg [3] : maxReward_ (uint256): 40000000000
Arg [4] : auctionDuration_ (uint48): 1200
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000002286d7f9639e8158fad1169e76d1fbc38247f54b
Arg [1] : 0000000000000000000000005f15b91b59ad65d490921016d4134c2301197485
Arg [2] : 00000000000000000000000064aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5
Arg [3] : 00000000000000000000000000000000000000000000000000000009502f9000
Arg [4] : 00000000000000000000000000000000000000000000000000000000000004b0
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.