More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 9,032 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim | 70630726 | 7 hrs ago | IN | 0 POL | 0.00335176 | ||||
Claim | 70623829 | 11 hrs ago | IN | 0 POL | 0.00541192 | ||||
Claim | 70616569 | 16 hrs ago | IN | 0 POL | 0.01165678 | ||||
Claim | 70616193 | 16 hrs ago | IN | 0 POL | 0.00678952 | ||||
Claim | 70596859 | 27 hrs ago | IN | 0 POL | 0.00386058 | ||||
Claim | 70589747 | 32 hrs ago | IN | 0 POL | 0.00386469 | ||||
Claim | 70588241 | 33 hrs ago | IN | 0 POL | 0.00386433 | ||||
Claim | 70583114 | 36 hrs ago | IN | 0 POL | 0.00399351 | ||||
Claim | 70583026 | 36 hrs ago | IN | 0 POL | 0.00386022 | ||||
Claim | 70577169 | 39 hrs ago | IN | 0 POL | 0.00386058 | ||||
Claim | 70575458 | 40 hrs ago | IN | 0 POL | 0.00334758 | ||||
Claim | 70574481 | 41 hrs ago | IN | 0 POL | 0.00202401 | ||||
Claim | 70574454 | 41 hrs ago | IN | 0 POL | 0.00334758 | ||||
Claim | 70573672 | 41 hrs ago | IN | 0 POL | 0.00386058 | ||||
Claim | 70571135 | 43 hrs ago | IN | 0 POL | 0.00334758 | ||||
Claim To | 70548481 | 2 days ago | IN | 0 POL | 0.00344604 | ||||
Claim | 70546959 | 2 days ago | IN | 0 POL | 0.00283458 | ||||
Claim | 70546843 | 2 days ago | IN | 0 POL | 0.00334758 | ||||
Claim | 70507728 | 3 days ago | IN | 0 POL | 0.00334758 | ||||
Claim | 70507149 | 3 days ago | IN | 0 POL | 0.00334722 | ||||
Claim | 70505917 | 3 days ago | IN | 0 POL | 0.00202401 | ||||
Claim | 70505883 | 3 days ago | IN | 0 POL | 0.00202401 | ||||
Claim | 70505874 | 3 days ago | IN | 0 POL | 0.00386058 | ||||
Claim | 70489955 | 3 days ago | IN | 0 POL | 0.00386058 | ||||
Claim | 70488765 | 3 days ago | IN | 0 POL | 0.00335169 |
Loading...
Loading
Contract Name:
CometRewards
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; import "./CometInterface.sol"; import "./ERC20.sol"; /** * @title Compound's CometRewards Contract * @notice Hold and claim token rewards * @author Compound */ contract CometRewards { struct RewardConfig { address token; uint64 rescaleFactor; bool shouldUpscale; } struct RewardOwed { address token; uint owed; } /// @notice The governor address which controls the contract address public governor; /// @notice Reward token address per Comet instance mapping(address => RewardConfig) public rewardConfig; /// @notice Rewards claimed per Comet instance and user account mapping(address => mapping(address => uint)) public rewardsClaimed; /** Custom events **/ event GovernorTransferred(address indexed oldGovernor, address indexed newGovernor); event RewardClaimed(address indexed src, address indexed recipient, address indexed token, uint256 amount); /** Custom errors **/ error AlreadyConfigured(address); error InvalidUInt64(uint); error NotPermitted(address); error NotSupported(address); error TransferOutFailed(address, uint); /** * @notice Construct a new rewards pool * @param governor_ The governor who will control the contract */ constructor(address governor_) { governor = governor_; } /** * @notice Set the reward token for a Comet instance * @param comet The protocol instance * @param token The reward token address */ function setRewardConfig(address comet, address token) external { if (msg.sender != governor) revert NotPermitted(msg.sender); if (rewardConfig[comet].token != address(0)) revert AlreadyConfigured(comet); uint64 accrualScale = CometInterface(comet).baseAccrualScale(); uint8 tokenDecimals = ERC20(token).decimals(); uint64 tokenScale = safe64(10 ** tokenDecimals); if (accrualScale > tokenScale) { rewardConfig[comet] = RewardConfig({ token: token, rescaleFactor: accrualScale / tokenScale, shouldUpscale: false }); } else { rewardConfig[comet] = RewardConfig({ token: token, rescaleFactor: tokenScale / accrualScale, shouldUpscale: true }); } } /** * @notice Withdraw tokens from the contract * @param token The reward token address * @param to Where to send the tokens * @param amount The number of tokens to withdraw */ function withdrawToken(address token, address to, uint amount) external { if (msg.sender != governor) revert NotPermitted(msg.sender); doTransferOut(token, to, amount); } /** * @notice Transfers the governor rights to a new address * @param newGovernor The address of the new governor */ function transferGovernor(address newGovernor) external { if (msg.sender != governor) revert NotPermitted(msg.sender); address oldGovernor = governor; governor = newGovernor; emit GovernorTransferred(oldGovernor, newGovernor); } /** * @notice Calculates the amount of a reward token owed to an account * @param comet The protocol instance * @param account The account to check rewards for */ function getRewardOwed(address comet, address account) external returns (RewardOwed memory) { RewardConfig memory config = rewardConfig[comet]; if (config.token == address(0)) revert NotSupported(comet); CometInterface(comet).accrueAccount(account); uint claimed = rewardsClaimed[comet][account]; uint accrued = getRewardAccrued(comet, account, config); uint owed = accrued > claimed ? accrued - claimed : 0; return RewardOwed(config.token, owed); } /** * @notice Claim rewards of token type from a comet instance to owner address * @param comet The protocol instance * @param src The owner to claim for * @param shouldAccrue Whether or not to call accrue first */ function claim(address comet, address src, bool shouldAccrue) external { claimInternal(comet, src, src, shouldAccrue); } /** * @notice Claim rewards of token type from a comet instance to a target address * @param comet The protocol instance * @param src The owner to claim for * @param to The address to receive the rewards */ function claimTo(address comet, address src, address to, bool shouldAccrue) external { if (!CometInterface(comet).hasPermission(src, msg.sender)) revert NotPermitted(msg.sender); claimInternal(comet, src, to, shouldAccrue); } /** * @dev Claim to, assuming permitted */ function claimInternal(address comet, address src, address to, bool shouldAccrue) internal { RewardConfig memory config = rewardConfig[comet]; if (config.token == address(0)) revert NotSupported(comet); if (shouldAccrue) { CometInterface(comet).accrueAccount(src); } uint claimed = rewardsClaimed[comet][src]; uint accrued = getRewardAccrued(comet, src, config); if (accrued > claimed) { uint owed = accrued - claimed; rewardsClaimed[comet][src] = accrued; doTransferOut(config.token, to, owed); emit RewardClaimed(src, to, config.token, owed); } } /** * @dev Calculates the reward accrued for an account on a Comet deployment */ function getRewardAccrued(address comet, address account, RewardConfig memory config) internal view returns (uint) { uint accrued = CometInterface(comet).baseTrackingAccrued(account); if (config.shouldUpscale) { accrued *= config.rescaleFactor; } else { accrued /= config.rescaleFactor; } return accrued; } /** * @dev Safe ERC20 transfer out */ function doTransferOut(address token, address to, uint amount) internal { bool success = ERC20(token).transfer(to, amount); if (!success) revert TransferOutFailed(to, amount); } /** * @dev Safe cast to uint64 */ function safe64(uint n) internal pure returns (uint64) { if (n > type(uint64).max) revert InvalidUInt64(n); return uint64(n); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; import "./CometMainInterface.sol"; import "./CometExtInterface.sol"; /** * @title Compound's Comet Interface * @notice An efficient monolithic money market protocol * @author Compound */ abstract contract CometInterface is CometMainInterface, CometExtInterface {}
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; /** * @title ERC 20 Token Standard Interface * https://eips.ethereum.org/EIPS/eip-20 */ interface ERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); /** * @notice Get the total number of tokens in circulation * @return The supply of tokens */ function totalSupply() external view returns (uint256); /** * @notice Gets the balance of the specified address * @param owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address owner) external view returns (uint256); /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint256 amount) external returns (bool); /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint256 amount) external returns (bool); /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint256 amount) external returns (bool); /** * @notice Get the current allowance from `owner` for `spender` * @param owner The address of the account which owns the tokens to be spent * @param spender The address of the account which may transfer tokens * @return The number of tokens allowed to be spent (-1 means infinite) */ function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; import "./CometCore.sol"; /** * @title Compound's Comet Main Interface (without Ext) * @notice An efficient monolithic money market protocol * @author Compound */ abstract contract CometMainInterface is CometCore { error Absurd(); error AlreadyInitialized(); error BadAsset(); error BadDecimals(); error BadDiscount(); error BadMinimum(); error BadPrice(); error BorrowTooSmall(); error BorrowCFTooLarge(); error InsufficientReserves(); error LiquidateCFTooLarge(); error NoSelfTransfer(); error NotCollateralized(); error NotForSale(); error NotLiquidatable(); error Paused(); error SupplyCapExceeded(); error TimestampTooLarge(); error TooManyAssets(); error TooMuchSlippage(); error TransferInFailed(); error TransferOutFailed(); error Unauthorized(); event Supply(address indexed from, address indexed dst, uint amount); event Transfer(address indexed from, address indexed to, uint amount); event Withdraw(address indexed src, address indexed to, uint amount); event SupplyCollateral(address indexed from, address indexed dst, address indexed asset, uint amount); event TransferCollateral(address indexed from, address indexed to, address indexed asset, uint amount); event WithdrawCollateral(address indexed src, address indexed to, address indexed asset, uint amount); /// @notice Event emitted when a borrow position is absorbed by the protocol event AbsorbDebt(address indexed absorber, address indexed borrower, uint basePaidOut, uint usdValue); /// @notice Event emitted when a user's collateral is absorbed by the protocol event AbsorbCollateral(address indexed absorber, address indexed borrower, address indexed asset, uint collateralAbsorbed, uint usdValue); /// @notice Event emitted when a collateral asset is purchased from the protocol event BuyCollateral(address indexed buyer, address indexed asset, uint baseAmount, uint collateralAmount); /// @notice Event emitted when an action is paused/unpaused event PauseAction(bool supplyPaused, bool transferPaused, bool withdrawPaused, bool absorbPaused, bool buyPaused); /// @notice Event emitted when reserves are withdrawn by the governor event WithdrawReserves(address indexed to, uint amount); function supply(address asset, uint amount) virtual external; function supplyTo(address dst, address asset, uint amount) virtual external; function supplyFrom(address from, address dst, address asset, uint amount) virtual external; function transfer(address dst, uint amount) virtual external returns (bool); function transferFrom(address src, address dst, uint amount) virtual external returns (bool); function transferAsset(address dst, address asset, uint amount) virtual external; function transferAssetFrom(address src, address dst, address asset, uint amount) virtual external; function withdraw(address asset, uint amount) virtual external; function withdrawTo(address to, address asset, uint amount) virtual external; function withdrawFrom(address src, address to, address asset, uint amount) virtual external; function approveThis(address manager, address asset, uint amount) virtual external; function withdrawReserves(address to, uint amount) virtual external; function absorb(address absorber, address[] calldata accounts) virtual external; function buyCollateral(address asset, uint minAmount, uint baseAmount, address recipient) virtual external; function quoteCollateral(address asset, uint baseAmount) virtual public view returns (uint); function getAssetInfo(uint8 i) virtual public view returns (AssetInfo memory); function getAssetInfoByAddress(address asset) virtual public view returns (AssetInfo memory); function getCollateralReserves(address asset) virtual public view returns (uint); function getReserves() virtual public view returns (int); function getPrice(address priceFeed) virtual public view returns (uint); function isBorrowCollateralized(address account) virtual public view returns (bool); function isLiquidatable(address account) virtual public view returns (bool); function totalSupply() virtual external view returns (uint256); function totalBorrow() virtual external view returns (uint256); function balanceOf(address owner) virtual public view returns (uint256); function borrowBalanceOf(address account) virtual public view returns (uint256); function pause(bool supplyPaused, bool transferPaused, bool withdrawPaused, bool absorbPaused, bool buyPaused) virtual external; function isSupplyPaused() virtual public view returns (bool); function isTransferPaused() virtual public view returns (bool); function isWithdrawPaused() virtual public view returns (bool); function isAbsorbPaused() virtual public view returns (bool); function isBuyPaused() virtual public view returns (bool); function accrueAccount(address account) virtual external; function getSupplyRate(uint utilization) virtual public view returns (uint64); function getBorrowRate(uint utilization) virtual public view returns (uint64); function getUtilization() virtual public view returns (uint); function governor() virtual external view returns (address); function pauseGuardian() virtual external view returns (address); function baseToken() virtual external view returns (address); function baseTokenPriceFeed() virtual external view returns (address); function extensionDelegate() virtual external view returns (address); /// @dev uint64 function supplyKink() virtual external view returns (uint); /// @dev uint64 function supplyPerSecondInterestRateSlopeLow() virtual external view returns (uint); /// @dev uint64 function supplyPerSecondInterestRateSlopeHigh() virtual external view returns (uint); /// @dev uint64 function supplyPerSecondInterestRateBase() virtual external view returns (uint); /// @dev uint64 function borrowKink() virtual external view returns (uint); /// @dev uint64 function borrowPerSecondInterestRateSlopeLow() virtual external view returns (uint); /// @dev uint64 function borrowPerSecondInterestRateSlopeHigh() virtual external view returns (uint); /// @dev uint64 function borrowPerSecondInterestRateBase() virtual external view returns (uint); /// @dev uint64 function storeFrontPriceFactor() virtual external view returns (uint); /// @dev uint64 function baseScale() virtual external view returns (uint); /// @dev uint64 function trackingIndexScale() virtual external view returns (uint); /// @dev uint64 function baseTrackingSupplySpeed() virtual external view returns (uint); /// @dev uint64 function baseTrackingBorrowSpeed() virtual external view returns (uint); /// @dev uint104 function baseMinForRewards() virtual external view returns (uint); /// @dev uint104 function baseBorrowMin() virtual external view returns (uint); /// @dev uint104 function targetReserves() virtual external view returns (uint); function numAssets() virtual external view returns (uint8); function decimals() virtual external view returns (uint8); function initializeStorage() virtual external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; import "./CometCore.sol"; /** * @title Compound's Comet Ext Interface * @notice An efficient monolithic money market protocol * @author Compound */ abstract contract CometExtInterface is CometCore { error BadAmount(); error BadNonce(); error BadSignatory(); error InvalidValueS(); error InvalidValueV(); error SignatureExpired(); function allow(address manager, bool isAllowed) virtual external; function allowBySig(address owner, address manager, bool isAllowed, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) virtual external; function collateralBalanceOf(address account, address asset) virtual external view returns (uint128); function baseTrackingAccrued(address account) virtual external view returns (uint64); function baseAccrualScale() virtual external view returns (uint64); function baseIndexScale() virtual external view returns (uint64); function factorScale() virtual external view returns (uint64); function priceScale() virtual external view returns (uint64); function maxAssets() virtual external view returns (uint8); function totalsBasic() virtual external view returns (TotalsBasic memory); function version() virtual external view returns (string memory); /** * ===== ERC20 interfaces ===== * Does not include the following functions/events, which are defined in `CometMainInterface` instead: * - function decimals() virtual external view returns (uint8) * - function totalSupply() virtual external view returns (uint256) * - function transfer(address dst, uint amount) virtual external returns (bool) * - function transferFrom(address src, address dst, uint amount) virtual external returns (bool) * - function balanceOf(address owner) virtual external view returns (uint256) * - event Transfer(address indexed from, address indexed to, uint256 amount) */ function name() virtual external view returns (string memory); function symbol() virtual external view returns (string memory); /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint256 amount) virtual external returns (bool); /** * @notice Get the current allowance from `owner` for `spender` * @param owner The address of the account which owns the tokens to be spent * @param spender The address of the account which may transfer tokens * @return The number of tokens allowed to be spent (-1 means infinite) */ function allowance(address owner, address spender) virtual external view returns (uint256); event Approval(address indexed owner, address indexed spender, uint256 amount); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; import "./CometConfiguration.sol"; import "./CometStorage.sol"; import "./CometMath.sol"; abstract contract CometCore is CometConfiguration, CometStorage, CometMath { struct AssetInfo { uint8 offset; address asset; address priceFeed; uint64 scale; uint64 borrowCollateralFactor; uint64 liquidateCollateralFactor; uint64 liquidationFactor; uint128 supplyCap; } /** Internal constants **/ /// @dev The max number of assets this contract is hardcoded to support /// Do not change this variable without updating all the fields throughout the contract, // including the size of UserBasic.assetsIn and corresponding integer conversions. uint8 internal constant MAX_ASSETS = 15; /// @dev The max number of decimals base token can have /// Note this cannot just be increased arbitrarily. uint8 internal constant MAX_BASE_DECIMALS = 18; /// @dev The max value for a collateral factor (1) uint64 internal constant MAX_COLLATERAL_FACTOR = FACTOR_SCALE; /// @dev Offsets for specific actions in the pause flag bit array uint8 internal constant PAUSE_SUPPLY_OFFSET = 0; uint8 internal constant PAUSE_TRANSFER_OFFSET = 1; uint8 internal constant PAUSE_WITHDRAW_OFFSET = 2; uint8 internal constant PAUSE_ABSORB_OFFSET = 3; uint8 internal constant PAUSE_BUY_OFFSET = 4; /// @dev The decimals required for a price feed uint8 internal constant PRICE_FEED_DECIMALS = 8; /// @dev 365 days * 24 hours * 60 minutes * 60 seconds uint64 internal constant SECONDS_PER_YEAR = 31_536_000; /// @dev The scale for base tracking accrual uint64 internal constant BASE_ACCRUAL_SCALE = 1e6; /// @dev The scale for base index (depends on time/rate scales, not base token) uint64 internal constant BASE_INDEX_SCALE = 1e15; /// @dev The scale for prices (in USD) uint64 internal constant PRICE_SCALE = uint64(10 ** PRICE_FEED_DECIMALS); /// @dev The scale for factors uint64 internal constant FACTOR_SCALE = 1e18; /** * @notice Determine if the manager has permission to act on behalf of the owner * @param owner The owner account * @param manager The manager account * @return Whether or not the manager has permission */ function hasPermission(address owner, address manager) public view returns (bool) { return owner == manager || isAllowed[owner][manager]; } /** * @dev The positive present supply balance if positive or the negative borrow balance if negative */ function presentValue(int104 principalValue_) internal view returns (int256) { if (principalValue_ >= 0) { return signed256(presentValueSupply(baseSupplyIndex, uint104(principalValue_))); } else { return -signed256(presentValueBorrow(baseBorrowIndex, uint104(-principalValue_))); } } /** * @dev The principal amount projected forward by the supply index */ function presentValueSupply(uint64 baseSupplyIndex_, uint104 principalValue_) internal pure returns (uint256) { return uint256(principalValue_) * baseSupplyIndex_ / BASE_INDEX_SCALE; } /** * @dev The principal amount projected forward by the borrow index */ function presentValueBorrow(uint64 baseBorrowIndex_, uint104 principalValue_) internal pure returns (uint256) { return uint256(principalValue_) * baseBorrowIndex_ / BASE_INDEX_SCALE; } /** * @dev The positive principal if positive or the negative principal if negative */ function principalValue(int256 presentValue_) internal view returns (int104) { if (presentValue_ >= 0) { return signed104(principalValueSupply(baseSupplyIndex, uint256(presentValue_))); } else { return -signed104(principalValueBorrow(baseBorrowIndex, uint256(-presentValue_))); } } /** * @dev The present value projected backward by the supply index (rounded down) * Note: This will overflow (revert) at 2^104/1e18=~20 trillion principal for assets with 18 decimals. */ function principalValueSupply(uint64 baseSupplyIndex_, uint256 presentValue_) internal pure returns (uint104) { return safe104((presentValue_ * BASE_INDEX_SCALE) / baseSupplyIndex_); } /** * @dev The present value projected backward by the borrow index (rounded up) * Note: This will overflow (revert) at 2^104/1e18=~20 trillion principal for assets with 18 decimals. */ function principalValueBorrow(uint64 baseBorrowIndex_, uint256 presentValue_) internal pure returns (uint104) { return safe104((presentValue_ * BASE_INDEX_SCALE + baseBorrowIndex_ - 1) / baseBorrowIndex_); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; /** * @title Compound's Comet Configuration Interface * @author Compound */ contract CometConfiguration { struct ExtConfiguration { bytes32 name32; bytes32 symbol32; } struct Configuration { address governor; address pauseGuardian; address baseToken; address baseTokenPriceFeed; address extensionDelegate; uint64 supplyKink; uint64 supplyPerYearInterestRateSlopeLow; uint64 supplyPerYearInterestRateSlopeHigh; uint64 supplyPerYearInterestRateBase; uint64 borrowKink; uint64 borrowPerYearInterestRateSlopeLow; uint64 borrowPerYearInterestRateSlopeHigh; uint64 borrowPerYearInterestRateBase; uint64 storeFrontPriceFactor; uint64 trackingIndexScale; uint64 baseTrackingSupplySpeed; uint64 baseTrackingBorrowSpeed; uint104 baseMinForRewards; uint104 baseBorrowMin; uint104 targetReserves; AssetConfig[] assetConfigs; } struct AssetConfig { address asset; address priceFeed; uint8 decimals; uint64 borrowCollateralFactor; uint64 liquidateCollateralFactor; uint64 liquidationFactor; uint128 supplyCap; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; /** * @title Compound's Comet Math Contract * @dev Pure math functions * @author Compound */ contract CometMath { /** Custom errors **/ error InvalidUInt64(); error InvalidUInt104(); error InvalidUInt128(); error InvalidInt104(); error InvalidInt256(); error NegativeNumber(); function safe64(uint n) internal pure returns (uint64) { if (n > type(uint64).max) revert InvalidUInt64(); return uint64(n); } function safe104(uint n) internal pure returns (uint104) { if (n > type(uint104).max) revert InvalidUInt104(); return uint104(n); } function safe128(uint n) internal pure returns (uint128) { if (n > type(uint128).max) revert InvalidUInt128(); return uint128(n); } function signed104(uint104 n) internal pure returns (int104) { if (n > uint104(type(int104).max)) revert InvalidInt104(); return int104(n); } function signed256(uint256 n) internal pure returns (int256) { if (n > uint256(type(int256).max)) revert InvalidInt256(); return int256(n); } function unsigned104(int104 n) internal pure returns (uint104) { if (n < 0) revert NegativeNumber(); return uint104(n); } function unsigned256(int256 n) internal pure returns (uint256) { if (n < 0) revert NegativeNumber(); return uint256(n); } function toUInt8(bool x) internal pure returns (uint8) { return x ? 1 : 0; } function toBool(uint8 x) internal pure returns (bool) { return x != 0; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.15; /** * @title Compound's Comet Storage Interface * @dev Versions can enforce append-only storage slots via inheritance. * @author Compound */ contract CometStorage { // 512 bits total = 2 slots struct TotalsBasic { // 1st slot uint64 baseSupplyIndex; uint64 baseBorrowIndex; uint64 trackingSupplyIndex; uint64 trackingBorrowIndex; // 2nd slot uint104 totalSupplyBase; uint104 totalBorrowBase; uint40 lastAccrualTime; uint8 pauseFlags; } struct TotalsCollateral { uint128 totalSupplyAsset; uint128 _reserved; } struct UserBasic { int104 principal; uint64 baseTrackingIndex; uint64 baseTrackingAccrued; uint16 assetsIn; uint8 _reserved; } struct UserCollateral { uint128 balance; uint128 _reserved; } struct LiquidatorPoints { uint32 numAbsorbs; uint64 numAbsorbed; uint128 approxSpend; uint32 _reserved; } /// @dev Aggregate variables tracked for the entire market uint64 internal baseSupplyIndex; uint64 internal baseBorrowIndex; uint64 internal trackingSupplyIndex; uint64 internal trackingBorrowIndex; uint104 internal totalSupplyBase; uint104 internal totalBorrowBase; uint40 internal lastAccrualTime; uint8 internal pauseFlags; /// @notice Aggregate variables tracked for each collateral asset mapping(address => TotalsCollateral) public totalsCollateral; /// @notice Mapping of users to accounts which may be permitted to manage the user account mapping(address => mapping(address => bool)) public isAllowed; /// @notice The next expected nonce for an address, for validating authorizations via signature mapping(address => uint) public userNonce; /// @notice Mapping of users to base principal and other basic data mapping(address => UserBasic) public userBasic; /// @notice Mapping of users to collateral data per collateral asset mapping(address => mapping(address => UserCollateral)) public userCollateral; /// @notice Mapping of magic liquidator points mapping(address => LiquidatorPoints) public liquidatorPoints; }
{ "optimizer": { "enabled": true, "runs": 1, "details": { "yulDetails": { "optimizerSteps": "dhfoDgvulfnTUtnIf [xa[r]scLM cCTUtTOntnfDIul Lcul Vcul [j] Tpeul xa[rul] xa[r]cL gvif CTUca[r]LsTOtfDnca[r]Iulc] jmul[jul] VcTOcul jmul" } } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"governor_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"AlreadyConfigured","type":"error"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"InvalidUInt64","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"NotPermitted","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"NotSupported","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"TransferOutFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldGovernor","type":"address"},{"indexed":true,"internalType":"address","name":"newGovernor","type":"address"}],"name":"GovernorTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"inputs":[{"internalType":"address","name":"comet","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"bool","name":"shouldAccrue","type":"bool"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"comet","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"shouldAccrue","type":"bool"}],"name":"claimTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"comet","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getRewardOwed","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"owed","type":"uint256"}],"internalType":"struct CometRewards.RewardOwed","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardConfig","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint64","name":"rescaleFactor","type":"uint64"},{"internalType":"bool","name":"shouldUpscale","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewardsClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"comet","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"setRewardConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newGovernor","type":"address"}],"name":"transferGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080806040523461007857601f610b9a38819003918201601f19168301916001600160401b0383118484101761007d5780849260209460405283398101031261007857516001600160a01b0381169081900361007857600080546001600160a01b031916919091179055604051610b0690816100948239f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe608060408181526004908136101561001657600080fd5b600092833560e01c90816301e33667146106f8575080630c340a24146106d05780632289b6b81461066f57806341e0cad61461050a5780634ff85d941461042457806365e12392146103d257806395e36d2c1461015d578063b7034f7e146101125763b8cc9ce61461008757600080fd5b3461010e57602036600319011261010e5781356001600160a01b038181169291839003610109578454908116938433036100f257506001600160a01b0319168217845551917f6fadb1c244276388aee22be93b919985a18748c021e5d48553957a48101a25608484a3f35b6024908351906319b1d90760e31b82523390820152fd5b600080fd5b8280fd5b50903461010e57606036600319011261010e57356001600160a01b03808216820361010957602435908116810361010957604435908115158203610109578061015a93610824565b51f35b50903461010e578160031936011261010e576001600160a01b03908035828116908190036101095760243592808416809403610109578086541633036103bc578186526020600181528186882054166103a55785516351076acb60e11b815281818681875afa90811561039b57889161036e575b50865163313ce56760e01b8152828187818a5afa8015610364578990610328575b60ff915016604d811161031557600a0a60018060401b03958682116103015750908560019392169081878216116000146102945790610230916107bd565b9487519661023f606089610765565b8752909416848601908152868601888152938852935284862093518454935192516001600160e81b031990941691161760a09190911b600160a01b600160e01b03161790151560e01b60ff60e01b1617905551f35b61029d916107bd565b948751966102ac606089610765565b8752909416848601908152868601828152938852935284862093518454935192516001600160e81b031990941691161760a09190911b600160a01b600160e01b03161790151560e01b60ff60e01b1617905551f35b602491895191624809a360e21b8352820152fd5b634e487b7160e01b895260118652602489fd5b508281813d831161035d575b61033e8183610765565b81010312610359575160ff811681036103595760ff906101f2565b8880fd5b503d610334565b88513d8b823e3d90fd5b61038e9150823d8411610394575b6103868183610765565b81019061079e565b386101d1565b503d61037c565b87513d8a823e3d90fd5b8551633a4406b560e01b8152808501849052602490fd5b84516319b1d90760e31b81523381850152602490fd5b50903461010e578160031936011261010e576001600160a01b03903581811690819003610109576024359182168092036101095783839160209552600285522090600052825280600020549051908152f35b50829034610506576080366003190112610506578235926001600160a01b03808516918286036101095760243590828216938483036101095760443593841684036101095760643594851515860361010957602090604488518094819363cde6804160e01b8352878301523360248301525afa9081156104fc5787916104ce575b50156104b7575061015a939495610824565b6024908551906319b1d90760e31b82523390820152fd5b6104ef915060203d81116104f5575b6104e78183610765565b81019061080c565b886104a5565b503d6104dd565b86513d89823e3d90fd5b5080fd5b50913461066c578260031936011261066c578135906001600160a01b03908183169081840361066c57602435938385169485810361010e5787519561054f8988610765565b83875283602080980152848452600187528884209789519861057260608b610765565b54878116808b5260a082901c6001600160401b03168a8c015260e09190911c60ff1615158b8b01521561065557853b1561065157895163bfe69c8d60e01b81529081018290528481602481838a5af18015610647579089939291610631575b5084956105f29495526002885289862090600052875288600020549361098b565b818111156106295761060492506107eb565b925b5116918184516106168682610765565b8481520190815283519283525190820152f35b505092610606565b94610640816105f29697610765565b94936105d1565b8a513d87823e3d90fd5b8480fd5b8951634e2c71db60e11b8152908101869052602490fd5b80fd5b50903461010e57602036600319011261010e576001600160a01b03919035828116908190036106cc57818460ff9260609652600160205220548251938116845260018060401b038160a01c16602085015260e01c16151590820152f35b8380fd5b838234610506578160031936011261050657905490516001600160a01b039091168152602090f35b91929050346106cc5760603660031901126106cc578035916001600160a01b039182841684036107615760243592808416840361075d5786541633036107485750509061015a9160443591610a49565b6319b1d90760e31b8252339082015260249150fd5b8680fd5b8580fd5b601f909101601f19168101906001600160401b0382119082101761078857604052565b634e487b7160e01b600052604160045260246000fd5b9081602091031261010957516001600160401b03811681036101095790565b6001600160401b03918216919082156107d557160490565b634e487b7160e01b600052601260045260246000fd5b8181106107f6570390565b634e487b7160e01b600052601160045260246000fd5b90816020910312610109575180151581036101095790565b600060018060a01b03808316948583526020926001845260409788822090895191610850606084610765565b5485811680845260a082901c6001600160401b03168885015260e09190911c60ff1615158b8401521561097357610922575b878252600285526108a6818a842098868116998a60005288528b600020549861098b565b8681116108ba575b50505050505050505050565b8985936108e87f2422cac5e23c46c890fdcf42d0c64757409df6832174df639337558f09d99c6899846107eb565b9a815260028852208860005286528960002055610909888484845116610a49565b511696519586521693a4388080808080808080806108ae565b90873b1561066c57885163bfe69c8d60e01b815287851660048201528181602481838d5af1801561096957610959575b5090610882565b8161096391610765565b38610952565b8a513d84823e3d90fd5b8951634e2c71db60e11b8152600481018a9052602490fd5b604051632ae6e9fd60e21b81526001600160a01b0392831660048201529160209183916024918391165afa908115610a2257600091610a04575b5060408201516001600160401b0391821692602091156109f6570151169080600019048211811515166107f6570290565b0151169081156107d5570490565b610a1c915060203d8111610394576103868183610765565b386109c5565b6040513d6000823e3d90fd5b6001600160a01b039091168152602081019190915260400190565b6020604051809263a9059cbb60e01b825281600081610a6c898960048401610a2e565b03926001600160a01b03165af1908115610a2257600091610ab2575b5015610a92575050565b610aae60405192839263701ed0db60e01b845260048401610a2e565b0390fd5b610aca915060203d81116104f5576104e78183610765565b38610a8856fea2646970667358221220e2c2d47fc6460bbbdd4c76485861406a913f227e386100174d1215ba4dc471e864736f6c634300080f00330000000000000000000000006103db328d4864dc16bd2f0ee1b9a92e3f87f915
Deployed Bytecode
0x608060408181526004908136101561001657600080fd5b600092833560e01c90816301e33667146106f8575080630c340a24146106d05780632289b6b81461066f57806341e0cad61461050a5780634ff85d941461042457806365e12392146103d257806395e36d2c1461015d578063b7034f7e146101125763b8cc9ce61461008757600080fd5b3461010e57602036600319011261010e5781356001600160a01b038181169291839003610109578454908116938433036100f257506001600160a01b0319168217845551917f6fadb1c244276388aee22be93b919985a18748c021e5d48553957a48101a25608484a3f35b6024908351906319b1d90760e31b82523390820152fd5b600080fd5b8280fd5b50903461010e57606036600319011261010e57356001600160a01b03808216820361010957602435908116810361010957604435908115158203610109578061015a93610824565b51f35b50903461010e578160031936011261010e576001600160a01b03908035828116908190036101095760243592808416809403610109578086541633036103bc578186526020600181528186882054166103a55785516351076acb60e11b815281818681875afa90811561039b57889161036e575b50865163313ce56760e01b8152828187818a5afa8015610364578990610328575b60ff915016604d811161031557600a0a60018060401b03958682116103015750908560019392169081878216116000146102945790610230916107bd565b9487519661023f606089610765565b8752909416848601908152868601888152938852935284862093518454935192516001600160e81b031990941691161760a09190911b600160a01b600160e01b03161790151560e01b60ff60e01b1617905551f35b61029d916107bd565b948751966102ac606089610765565b8752909416848601908152868601828152938852935284862093518454935192516001600160e81b031990941691161760a09190911b600160a01b600160e01b03161790151560e01b60ff60e01b1617905551f35b602491895191624809a360e21b8352820152fd5b634e487b7160e01b895260118652602489fd5b508281813d831161035d575b61033e8183610765565b81010312610359575160ff811681036103595760ff906101f2565b8880fd5b503d610334565b88513d8b823e3d90fd5b61038e9150823d8411610394575b6103868183610765565b81019061079e565b386101d1565b503d61037c565b87513d8a823e3d90fd5b8551633a4406b560e01b8152808501849052602490fd5b84516319b1d90760e31b81523381850152602490fd5b50903461010e578160031936011261010e576001600160a01b03903581811690819003610109576024359182168092036101095783839160209552600285522090600052825280600020549051908152f35b50829034610506576080366003190112610506578235926001600160a01b03808516918286036101095760243590828216938483036101095760443593841684036101095760643594851515860361010957602090604488518094819363cde6804160e01b8352878301523360248301525afa9081156104fc5787916104ce575b50156104b7575061015a939495610824565b6024908551906319b1d90760e31b82523390820152fd5b6104ef915060203d81116104f5575b6104e78183610765565b81019061080c565b886104a5565b503d6104dd565b86513d89823e3d90fd5b5080fd5b50913461066c578260031936011261066c578135906001600160a01b03908183169081840361066c57602435938385169485810361010e5787519561054f8988610765565b83875283602080980152848452600187528884209789519861057260608b610765565b54878116808b5260a082901c6001600160401b03168a8c015260e09190911c60ff1615158b8b01521561065557853b1561065157895163bfe69c8d60e01b81529081018290528481602481838a5af18015610647579089939291610631575b5084956105f29495526002885289862090600052875288600020549361098b565b818111156106295761060492506107eb565b925b5116918184516106168682610765565b8481520190815283519283525190820152f35b505092610606565b94610640816105f29697610765565b94936105d1565b8a513d87823e3d90fd5b8480fd5b8951634e2c71db60e11b8152908101869052602490fd5b80fd5b50903461010e57602036600319011261010e576001600160a01b03919035828116908190036106cc57818460ff9260609652600160205220548251938116845260018060401b038160a01c16602085015260e01c16151590820152f35b8380fd5b838234610506578160031936011261050657905490516001600160a01b039091168152602090f35b91929050346106cc5760603660031901126106cc578035916001600160a01b039182841684036107615760243592808416840361075d5786541633036107485750509061015a9160443591610a49565b6319b1d90760e31b8252339082015260249150fd5b8680fd5b8580fd5b601f909101601f19168101906001600160401b0382119082101761078857604052565b634e487b7160e01b600052604160045260246000fd5b9081602091031261010957516001600160401b03811681036101095790565b6001600160401b03918216919082156107d557160490565b634e487b7160e01b600052601260045260246000fd5b8181106107f6570390565b634e487b7160e01b600052601160045260246000fd5b90816020910312610109575180151581036101095790565b600060018060a01b03808316948583526020926001845260409788822090895191610850606084610765565b5485811680845260a082901c6001600160401b03168885015260e09190911c60ff1615158b8401521561097357610922575b878252600285526108a6818a842098868116998a60005288528b600020549861098b565b8681116108ba575b50505050505050505050565b8985936108e87f2422cac5e23c46c890fdcf42d0c64757409df6832174df639337558f09d99c6899846107eb565b9a815260028852208860005286528960002055610909888484845116610a49565b511696519586521693a4388080808080808080806108ae565b90873b1561066c57885163bfe69c8d60e01b815287851660048201528181602481838d5af1801561096957610959575b5090610882565b8161096391610765565b38610952565b8a513d84823e3d90fd5b8951634e2c71db60e11b8152600481018a9052602490fd5b604051632ae6e9fd60e21b81526001600160a01b0392831660048201529160209183916024918391165afa908115610a2257600091610a04575b5060408201516001600160401b0391821692602091156109f6570151169080600019048211811515166107f6570290565b0151169081156107d5570490565b610a1c915060203d8111610394576103868183610765565b386109c5565b6040513d6000823e3d90fd5b6001600160a01b039091168152602081019190915260400190565b6020604051809263a9059cbb60e01b825281600081610a6c898960048401610a2e565b03926001600160a01b03165af1908115610a2257600091610ab2575b5015610a92575050565b610aae60405192839263701ed0db60e01b845260048401610a2e565b0390fd5b610aca915060203d81116104f5576104e78183610765565b38610a8856fea2646970667358221220e2c2d47fc6460bbbdd4c76485861406a913f227e386100174d1215ba4dc471e864736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006103db328d4864dc16bd2f0ee1b9a92e3f87f915
-----Decoded View---------------
Arg [0] : governor_ (address): 0x6103DB328d4864dc16BD2F0eE1B9A92e3F87f915
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000006103db328d4864dc16bd2f0ee1b9a92e3f87f915
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $43.42 | 303.1102 | $13,161.04 |
Loading...
Loading
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.