More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
20554913 | 144 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x404AF5D6...CDA51100f The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
TokenRewards
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@uniswap/v3-core/contracts/libraries/FixedPoint96.sol'; import './interfaces/IDecentralizedIndex.sol'; import './interfaces/IDexAdapter.sol'; import './interfaces/IPEAS.sol'; import './interfaces/IRewardsWhitelister.sol'; import './interfaces/IProtocolFees.sol'; import './interfaces/IProtocolFeeRouter.sol'; import './interfaces/ITokenRewards.sol'; import './interfaces/IV3TwapUtilities.sol'; import './libraries/BokkyPooBahsDateTimeLibrary.sol'; contract TokenRewards is ITokenRewards, Context { using SafeERC20 for IERC20; uint256 constant PRECISION = 10 ** 36; uint24 constant REWARDS_POOL_FEE = 10000; // 1% address immutable INDEX_FUND; address immutable PAIRED_LP_TOKEN; IProtocolFeeRouter immutable PROTOCOL_FEE_ROUTER; IRewardsWhitelister immutable REWARDS_WHITELISTER; IDexAdapter immutable DEX_HANDLER; IV3TwapUtilities immutable V3_TWAP_UTILS; struct Reward { uint256 excluded; uint256 realized; } address public immutable override trackingToken; address public immutable override rewardsToken; // main rewards token uint256 public override totalShares; uint256 public override totalStakers; mapping(address => uint256) public shares; // reward token => user => Reward mapping(address => mapping(address => Reward)) public rewards; uint256 _rewardsSwapSlippage = 20; // 2% // reward token => amount mapping(address => uint256) _rewardsPerShare; // reward token => amount mapping(address => uint256) public rewardsDistributed; // reward token => amount mapping(address => uint256) public rewardsDeposited; // reward token => month => amount mapping(address => mapping(uint256 => uint256)) public rewardsDepMonthly; // all deposited rewards tokens address[] _allRewardsTokens; mapping(address => bool) _depositedRewardsToken; constructor( IProtocolFeeRouter _feeRouter, IRewardsWhitelister _rewardsWhitelist, IDexAdapter _dexHandler, IV3TwapUtilities _v3TwapUtilities, address _indexFund, address _pairedLpToken, address _trackingToken, address _rewardsToken ) { PROTOCOL_FEE_ROUTER = _feeRouter; REWARDS_WHITELISTER = _rewardsWhitelist; DEX_HANDLER = _dexHandler; V3_TWAP_UTILS = _v3TwapUtilities; INDEX_FUND = _indexFund; PAIRED_LP_TOKEN = _pairedLpToken; trackingToken = _trackingToken; rewardsToken = _rewardsToken; } function setShares( address _wallet, uint256 _amount, bool _sharesRemoving ) external override { require(_msgSender() == trackingToken, 'UNAUTHORIZED'); _setShares(_wallet, _amount, _sharesRemoving); } function _setShares( address _wallet, uint256 _amount, bool _sharesRemoving ) internal { _processFeesIfApplicable(); if (_sharesRemoving) { _removeShares(_wallet, _amount); emit RemoveShares(_wallet, _amount); } else { _addShares(_wallet, _amount); emit AddShares(_wallet, _amount); } } function _addShares(address _wallet, uint256 _amount) internal { if (shares[_wallet] > 0) { _distributeReward(_wallet); } uint256 sharesBefore = shares[_wallet]; totalShares += _amount; shares[_wallet] += _amount; if (sharesBefore == 0 && shares[_wallet] > 0) { totalStakers++; } _resetExcluded(_wallet); } function _removeShares(address _wallet, uint256 _amount) internal { require(shares[_wallet] > 0 && _amount <= shares[_wallet], 'RE'); _distributeReward(_wallet); totalShares -= _amount; shares[_wallet] -= _amount; if (shares[_wallet] == 0) { totalStakers--; } _resetExcluded(_wallet); } function _processFeesIfApplicable() internal { IDecentralizedIndex(INDEX_FUND).processPreSwapFeesAndSwap(); } function depositFromPairedLpToken( uint256 _amountTknDepositing, uint256 _slippageOverride ) public override { require(PAIRED_LP_TOKEN != rewardsToken, 'R'); require(_slippageOverride <= 200, 'MS'); // 20% if (_amountTknDepositing > 0) { IERC20(PAIRED_LP_TOKEN).safeTransferFrom( _msgSender(), address(this), _amountTknDepositing ); } uint256 _amountTkn = IERC20(PAIRED_LP_TOKEN).balanceOf(address(this)); require(_amountTkn > 0, 'A'); uint256 _adminAmt = _getAdminFeeFromAmount(_amountTkn); _amountTkn -= _adminAmt; (address _token0, address _token1) = PAIRED_LP_TOKEN < rewardsToken ? (PAIRED_LP_TOKEN, rewardsToken) : (rewardsToken, PAIRED_LP_TOKEN); address _pool = DEX_HANDLER.getV3Pool(_token0, _token1, REWARDS_POOL_FEE); uint160 _rewardsSqrtPriceX96 = V3_TWAP_UTILS .sqrtPriceX96FromPoolAndInterval(_pool); uint256 _rewardsPriceX96 = V3_TWAP_UTILS.priceX96FromSqrtPriceX96( _rewardsSqrtPriceX96 ); uint256 _amountOut = _token0 == PAIRED_LP_TOKEN ? (_rewardsPriceX96 * _amountTkn) / FixedPoint96.Q96 : (_amountTkn * FixedPoint96.Q96) / _rewardsPriceX96; uint256 _slippage = _slippageOverride > 0 ? _slippageOverride : _rewardsSwapSlippage; _swapForRewards( _amountTkn, _amountOut, _slippage, _slippageOverride > 0, _adminAmt ); } function depositRewards(address _token, uint256 _amount) external override { _depositRewardsFromToken(_msgSender(), _token, _amount, true); } function depositRewardsNoTransfer( address _token, uint256 _amount ) external override { require(_msgSender() == INDEX_FUND, 'AUTH'); _depositRewardsFromToken(_msgSender(), _token, _amount, false); } function _depositRewardsFromToken( address _user, address _token, uint256 _amount, bool _shouldTransfer ) internal { require(_amount > 0, 'A'); require(_isValidRewardsToken(_token), 'V'); uint256 _finalAmt = _amount; if (_shouldTransfer) { uint256 _balBefore = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransferFrom(_user, address(this), _finalAmt); _finalAmt = IERC20(_token).balanceOf(address(this)) - _balBefore; } uint256 _adminAmt = _getAdminFeeFromAmount(_finalAmt); if (_adminAmt > 0) { IERC20(_token).safeTransfer( Ownable(address(V3_TWAP_UTILS)).owner(), _adminAmt ); _finalAmt -= _adminAmt; } _depositRewards(_token, _finalAmt); } function _depositRewards(address _token, uint256 _amountTotal) internal { if (!_depositedRewardsToken[_token]) { _depositedRewardsToken[_token] = true; _allRewardsTokens.push(_token); } if (_amountTotal == 0) { return; } if (totalShares == 0) { require(_token == rewardsToken, 'R'); _burnRewards(_amountTotal); return; } uint256 _depositAmount = _amountTotal; if (_token == rewardsToken) { (, uint256 _yieldBurnFee) = _getYieldFees(); if (_yieldBurnFee > 0) { uint256 _burnAmount = (_amountTotal * _yieldBurnFee) / PROTOCOL_FEE_ROUTER.protocolFees().DEN(); if (_burnAmount > 0) { _burnRewards(_burnAmount); _depositAmount -= _burnAmount; } } } rewardsDeposited[_token] += _depositAmount; rewardsDepMonthly[_token][ beginningOfMonth(block.timestamp) ] += _depositAmount; _rewardsPerShare[_token] += (PRECISION * _depositAmount) / totalShares; emit DepositRewards(_msgSender(), _token, _depositAmount); } function _distributeReward(address _wallet) internal { if (shares[_wallet] == 0) { return; } for (uint256 _i; _i < _allRewardsTokens.length; _i++) { address _token = _allRewardsTokens[_i]; uint256 _amount = getUnpaid(_token, _wallet); rewards[_token][_wallet].realized += _amount; rewards[_token][_wallet].excluded = _cumulativeRewards( _token, shares[_wallet] ); if (_amount > 0) { rewardsDistributed[_token] += _amount; IERC20(_token).safeTransfer(_wallet, _amount); emit DistributeReward(_wallet, _token, _amount); } } } function _resetExcluded(address _wallet) internal { for (uint256 _i; _i < _allRewardsTokens.length; _i++) { address _token = _allRewardsTokens[_i]; rewards[_token][_wallet].excluded = _cumulativeRewards( _token, shares[_wallet] ); } } function _burnRewards(uint256 _burnAmount) internal { try IPEAS(rewardsToken).burn(_burnAmount) {} catch { IERC20(rewardsToken).safeTransfer(address(0xdead), _burnAmount); } } function _isValidRewardsToken(address _token) internal view returns (bool) { return _token == rewardsToken || REWARDS_WHITELISTER.whitelist(_token); } function _getAdminFeeFromAmount( uint256 _amount ) internal view returns (uint256) { (uint256 _yieldAdminFee, ) = _getYieldFees(); if (_yieldAdminFee == 0) { return 0; } return (_amount * _yieldAdminFee) / PROTOCOL_FEE_ROUTER.protocolFees().DEN(); } function _getYieldFees() internal view returns (uint256 _admin, uint256 _burn) { IProtocolFees _fees = PROTOCOL_FEE_ROUTER.protocolFees(); if (address(_fees) != address(0)) { _admin = _fees.yieldAdmin(); _burn = _fees.yieldBurn(); } } function _swapForRewards( uint256 _amountIn, uint256 _amountOut, uint256 _slippage, bool _isSlipOverride, uint256 _adminAmt ) internal { uint256 _balBefore = IERC20(rewardsToken).balanceOf(address(this)); IERC20(PAIRED_LP_TOKEN).safeIncreaseAllowance( address(DEX_HANDLER), _amountIn ); try DEX_HANDLER.swapV3Single( PAIRED_LP_TOKEN, rewardsToken, REWARDS_POOL_FEE, _amountIn, (_amountOut * (1000 - _slippage)) / 1000, address(this) ) { if (_adminAmt > 0) { IERC20(PAIRED_LP_TOKEN).safeTransfer( Ownable(address(V3_TWAP_UTILS)).owner(), _adminAmt ); } _rewardsSwapSlippage = 20; _depositRewards( rewardsToken, IERC20(rewardsToken).balanceOf(address(this)) - _balBefore ); } catch { if (!_isSlipOverride && _rewardsSwapSlippage < 200) { _rewardsSwapSlippage += 10; } IERC20(PAIRED_LP_TOKEN).safeDecreaseAllowance( address(DEX_HANDLER), _amountIn ); } } function beginningOfMonth(uint256 _timestamp) public pure returns (uint256) { (, , uint256 _dayOfMonth) = BokkyPooBahsDateTimeLibrary.timestampToDate( _timestamp ); return _timestamp - ((_dayOfMonth - 1) * 1 days) - (_timestamp % 1 days); } function claimReward(address _wallet) external override { _distributeReward(_wallet); emit ClaimReward(_wallet); } function getUnpaid( address _token, address _wallet ) public view returns (uint256) { if (shares[_wallet] == 0) { return 0; } uint256 earnedRewards = _cumulativeRewards(_token, shares[_wallet]); uint256 rewardsExcluded = rewards[_token][_wallet].excluded; if (earnedRewards <= rewardsExcluded) { return 0; } return earnedRewards - rewardsExcluded; } function _cumulativeRewards( address _token, uint256 _share ) internal view returns (uint256) { return (_share * _rewardsPerShare[_token]) / PRECISION; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) /// @dev Used in SqrtPriceMath.sol library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; interface IDecentralizedIndex is IERC20 { enum IndexType { WEIGHTED, UNWEIGHTED } struct Config { address partner; bool hasTransferTax; bool blacklistTKNpTKNPoolV2; } // all fees: 1 == 0.01%, 10 == 0.1%, 100 == 1% struct Fees { uint16 burn; uint16 bond; uint16 debond; uint16 buy; uint16 sell; uint16 partner; } struct IndexAssetInfo { address token; uint256 weighting; uint256 basePriceUSDX96; address c1; // arbitrary contract/address field we can use for an index uint256 q1; // arbitrary quantity/number field we can use for an index } event Create(address indexed newIdx, address indexed wallet); event Initialize(address indexed wallet, address v2Pool); event Bond( address indexed wallet, address indexed token, uint256 amountTokensBonded, uint256 amountTokensMinted ); event Debond(address indexed wallet, uint256 amountDebonded); event AddLiquidity( address indexed wallet, uint256 amountTokens, uint256 amountDAI ); event RemoveLiquidity(address indexed wallet, uint256 amountLiquidity); event SetPartner(address indexed wallet, address newPartner); event SetPartnerFee(address indexed wallet, uint16 newFee); function BOND_FEE() external view returns (uint16); function DEBOND_FEE() external view returns (uint16); function FLASH_FEE_AMOUNT_DAI() external view returns (uint256); function PAIRED_LP_TOKEN() external view returns (address); function indexType() external view returns (IndexType); function created() external view returns (uint256); function lpStakingPool() external view returns (address); function lpRewardsToken() external view returns (address); function partner() external view returns (address); function getIdxPriceUSDX96() external view returns (uint256, uint256); function isAsset(address token) external view returns (bool); function getAllAssets() external view returns (IndexAssetInfo[] memory); function getInitialAmount( address sToken, uint256 sAmount, address tToken ) external view returns (uint256); function getTokenPriceUSDX96(address token) external view returns (uint256); function processPreSwapFeesAndSwap() external; function bond(address token, uint256 amount, uint256 amountMintMin) external; function debond( uint256 amount, address[] memory token, uint8[] memory percentage ) external; function addLiquidityV2( uint256 idxTokens, uint256 daiTokens, uint256 slippage, uint256 deadline ) external returns (uint256); function removeLiquidityV2( uint256 lpTokens, uint256 minTokens, uint256 minDAI, uint256 deadline ) external; function flash( address recipient, address token, uint256 amount, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IDexAdapter { function ASYNC_INITIALIZE() external view returns (bool); function V2_ROUTER() external view returns (address); function V3_ROUTER() external view returns (address); function getV3Pool( address _token0, address _token1, uint24 _poolFee ) external view returns (address _pool); function getV2Pool( address _token0, address _token1 ) external view returns (address _pool); function createV2Pool( address _token0, address _token1 ) external returns (address _pool); function swapV2Single( address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _amountOutMin, address _recipient ) external returns (uint256 _amountOut); function swapV3Single( address _tokenIn, address _tokenOut, uint24 _fee, uint256 _amountIn, uint256 _amountOutMin, address _recipient ) external returns (uint256 _amountOut); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external; function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; interface IPEAS is IERC20 { event Burn(address indexed user, uint256 amount); function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import './IProtocolFees.sol'; interface IProtocolFeeRouter { function protocolFees() external view returns (IProtocolFees); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IProtocolFees { event SetYieldAdmin(uint256 newFee); event SetYieldBurn(uint256 newFee); function DEN() external view returns (uint256); function yieldAdmin() external view returns (uint256); function yieldBurn() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IRewardsWhitelister { function whitelist(address token) external view returns (bool); function getFullWhitelist() external view returns (address[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface ITokenRewards { event AddShares(address indexed wallet, uint256 amount); event RemoveShares(address indexed wallet, uint256 amount); event ClaimReward(address indexed wallet); event DistributeReward( address indexed wallet, address indexed token, uint256 amount ); event DepositRewards( address indexed wallet, address indexed token, uint256 amount ); function totalShares() external view returns (uint256); function totalStakers() external view returns (uint256); function rewardsToken() external view returns (address); function trackingToken() external view returns (address); function depositFromPairedLpToken( uint256 amount, uint256 slippageOverride ) external; function depositRewards(address token, uint256 amount) external; function depositRewardsNoTransfer(address token, uint256 amount) external; function claimReward(address wallet) external; function setShares( address wallet, uint256 amount, bool sharesRemoving ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IV3TwapUtilities { function getV3Pool( address v3Factory, address token0, address token1 ) external view returns (address); function getV3Pool( address v3Factory, address token0, address token1, uint24 poolFee ) external view returns (address); function getV3Pool( address v3Factory, address token0, address token1, int24 tickSpacing ) external view returns (address); function getPoolPriceUSDX96( address pricePool, address nativeStablePool, address WETH9 ) external view returns (uint256); function sqrtPriceX96FromPoolAndInterval( address pool ) external view returns (uint160); function priceX96FromSqrtPriceX96( uint160 sqrtPriceX96 ) external pure returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; // ---------------------------------------------------------------------------- // BokkyPooBah's DateTime Library v1.00 // // A gas-efficient Solidity date and time library // // https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary // // Tested date range 1970/01/01 to 2345/12/31 // // Conventions: // Unit | Range | Notes // :-------- |:-------------:|:----- // timestamp | >= 0 | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC // year | 1970 ... 2345 | // month | 1 ... 12 | // day | 1 ... 31 | // hour | 0 ... 23 | // minute | 0 ... 59 | // second | 0 ... 59 | // dayOfWeek | 1 ... 7 | 1 = Monday, ..., 7 = Sunday // // // Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. // // GNU Lesser General Public License 3.0 // https://www.gnu.org/licenses/lgpl-3.0.en.html // ---------------------------------------------------------------------------- library BokkyPooBahsDateTimeLibrary { uint constant SECONDS_PER_DAY = 24 * 60 * 60; int constant OFFSET19700101 = 2440588; // ------------------------------------------------------------------------ // Calculate year/month/day from the number of days since 1970/01/01 using // the date conversion algorithm from // http://aa.usno.navy.mil/faq/docs/JD_Formula.php // and adding the offset 2440588 so that 1970/01/01 is day 0 // // int L = days + 68569 + offset // int N = 4 * L / 146097 // L = L - (146097 * N + 3) / 4 // year = 4000 * (L + 1) / 1461001 // L = L - 1461 * year / 4 + 31 // month = 80 * L / 2447 // dd = L - 2447 * month / 80 // L = month / 11 // month = month + 2 - 12 * L // year = 100 * (N - 49) + year + L // ------------------------------------------------------------------------ function _daysToDate( uint _days ) internal pure returns (uint year, uint month, uint day) { int __days = int(_days); int L = __days + 68569 + OFFSET19700101; int N = (4 * L) / 146097; L = L - (146097 * N + 3) / 4; int _year = (4000 * (L + 1)) / 1461001; L = L - (1461 * _year) / 4 + 31; int _month = (80 * L) / 2447; int _day = L - (2447 * _month) / 80; L = _month / 11; _month = _month + 2 - 12 * L; _year = 100 * (N - 49) + _year + L; year = uint(_year); month = uint(_month); day = uint(_day); } function timestampToDate( uint timestamp ) internal pure returns (uint year, uint month, uint day) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); } }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IProtocolFeeRouter","name":"_feeRouter","type":"address"},{"internalType":"contract IRewardsWhitelister","name":"_rewardsWhitelist","type":"address"},{"internalType":"contract IDexAdapter","name":"_dexHandler","type":"address"},{"internalType":"contract IV3TwapUtilities","name":"_v3TwapUtilities","type":"address"},{"internalType":"address","name":"_indexFund","type":"address"},{"internalType":"address","name":"_pairedLpToken","type":"address"},{"internalType":"address","name":"_trackingToken","type":"address"},{"internalType":"address","name":"_rewardsToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AddShares","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"}],"name":"ClaimReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributeReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RemoveShares","type":"event"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"beginningOfMonth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountTknDepositing","type":"uint256"},{"internalType":"uint256","name":"_slippageOverride","type":"uint256"}],"name":"depositFromPairedLpToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositRewardsNoTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_wallet","type":"address"}],"name":"getUnpaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"excluded","type":"uint256"},{"internalType":"uint256","name":"realized","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardsDepMonthly","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardsDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardsDistributed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_sharesRemoving","type":"bool"}],"name":"setShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"trackingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063cc85bd1611610097578063d279c19111610066578063d279c1911461025c578063d6460b4b1461026f578063e70b9e2714610282578063f2c03c58146102c957600080fd5b8063cc85bd16146101e2578063ce7c2ac214610202578063d076eabc14610222578063d1af0c7d1461023557600080fd5b806386989038116100d357806386989038146101745780638e79fd9a1461017d57806397ad1cce14610190578063bde30818146101a357600080fd5b80633a98ef39146101055780633dc60e831461012157806370b9f1f914610136578063849c4f1d14610149575b600080fd5b61010e60005481565b6040519081526020015b60405180910390f35b61013461012f36600461236d565b6102e9565b005b610134610144366004612399565b610364565b61010e61015736600461236d565b600860209081526000928352604080842090915290825290205481565b61010e60015481565b61010e61018b3660046123bb565b610885565b61013461019e36600461236d565b610920565b6101ca7f000000000000000000000000557e20e5c72cbdc42d887f6b3cb6322a08510e5781565b6040516001600160a01b039091168152602001610118565b61010e6101f03660046123f4565b60066020526000908152604090205481565b61010e6102103660046123f4565b60026020526000908152604090205481565b61010e610230366004612411565b61092d565b6101ca7f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df87581565b61013461026a3660046123f4565b61097f565b61013461027d366004612438565b6109bf565b6102b46102903660046123bb565b60036020908152600092835260408084209091529082529020805460019091015482565b60408051928352602083019190915201610118565b61010e6102d73660046123f4565b60076020526000908152604090205481565b337f0000000000000000000000005dde1c1593a6ae1ba69370a2a05cdfebe799499d6001600160a01b0316146103535760405162461bcd60e51b815260040161034a90602080825260049082015263082aaa8960e31b604082015260600190565b60405180910390fd5b6103603383836000610a36565b5050565b7f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b03167f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316036103e95760405162461bcd60e51b81526020600482015260016024820152602960f91b604482015260640161034a565b60c881111561041f5760405162461bcd60e51b81526020600482015260026024820152614d5360f01b604482015260640161034a565b811561045a5761045a7f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316333085610c6c565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316906370a0823190602401602060405180830381865afa1580156104c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e5919061247a565b90506000811161051b5760405162461bcd60e51b81526020600482015260016024820152604160f81b604482015260640161034a565b600061052682610cdd565b905061053281836124a9565b91506000807f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b03167f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316106105d7577f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8757f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df87561061a565b7f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8757f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8755b60405163e3ddd77960e01b81526001600160a01b038084166004830152808316602483015261271060448301529294509092506000917f0000000000000000000000007686aa8b32aa9eb135ac15a549ccd71976c878bb169063e3ddd77990606401602060405180830381865afa158015610699573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bd91906124bc565b604051637fb4f79d60e01b81526001600160a01b0380831660048301529192506000917f000000000000000000000000024ff47d552cb222b265d68c7aeb26e586d5229d1690637fb4f79d90602401602060405180830381865afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906124bc565b60405163352fc4cd60e21b81526001600160a01b0380831660048301529192506000917f000000000000000000000000024ff47d552cb222b265d68c7aeb26e586d5229d169063d4bf133490602401602060405180830381865afa1580156107b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dd919061247a565b905060007f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316866001600160a01b0316146108385781610829600160601b8a6124d9565b6108339190612506565b610851565b600160601b61084789846124d9565b6108519190612506565b90506000808a1161086457600454610866565b895b905061087889838360008e118c610df3565b5050505050505050505050565b6001600160a01b03811660009081526002602052604081205481036108ac5750600061091a565b6001600160a01b0382166000908152600260205260408120546108d09085906111e1565b6001600160a01b0380861660009081526003602090815260408083209388168352929052205490915080821161090b5760009250505061091a565b61091581836124a9565b925050505b92915050565b6103603383836001610a36565b60008061093983611215565b92505050620151808361094c919061251a565b6109576001836124a9565b61096490620151806124d9565b61096e90856124a9565b61097891906124a9565b9392505050565b6109888161123b565b6040516001600160a01b038216907f63e32091e4445d16e29c33a6b264577c2d86694021aa4e6f4dd590048f5792e890600090a250565b337f000000000000000000000000557e20e5c72cbdc42d887f6b3cb6322a08510e576001600160a01b031614610a265760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b604482015260640161034a565b610a318383836113d8565b505050565b60008211610a6a5760405162461bcd60e51b81526020600482015260016024820152604160f81b604482015260640161034a565b610a738361147d565b610aa35760405162461bcd60e51b81526020600482015260016024820152602b60f91b604482015260640161034a565b818115610ba4576040516370a0823160e01b81523060048201526000906001600160a01b038616906370a0823190602401602060405180830381865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b15919061247a565b9050610b2c6001600160a01b038616873085610c6c565b6040516370a0823160e01b815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa158015610b72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b96919061247a565b610ba091906124a9565b9150505b6000610baf82610cdd565b90508015610c5a57610c4d7f000000000000000000000000024ff47d552cb222b265d68c7aeb26e586d5229d6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3c91906124bc565b6001600160a01b0387169083611544565b610c5781836124a9565b91505b610c648583611574565b505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610cd79085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526118ea565b50505050565b600080610ce86119bf565b50905080600003610cfc5750600092915050565b7f0000000000000000000000007d544dd34abbe24c8832db27820ff53c151e949b6001600160a01b0316631ad8b03b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7e91906124bc565b6001600160a01b0316633c9a07006040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddf919061247a565b610de982856124d9565b6109789190612506565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316906370a0823190602401602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e919061247a565b9050610ed46001600160a01b037f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df875167f0000000000000000000000007686aa8b32aa9eb135ac15a549ccd71976c878bb88611b25565b6001600160a01b037f0000000000000000000000007686aa8b32aa9eb135ac15a549ccd71976c878bb16638d5752d67f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8757f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756127108a6103e8610f568b826124a9565b610f60908d6124d9565b610f6a9190612506565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015262ffffff9091166044840152606483015260848201523060a482015260c4016020604051808303816000875af1925050508015610ff1575060408051601f3d908101601f19168201909252610fee9181019061247a565b60015b61107c5782158015611005575060c8600454105b1561102357600a6004600082825461101d919061252e565b90915550505b6110776001600160a01b037f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df875167f0000000000000000000000007686aa8b32aa9eb135ac15a549ccd71976c878bb88611bd2565b610c64565b508115611139576111397f000000000000000000000000024ff47d552cb222b265d68c7aeb26e586d5229d6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110891906124bc565b6001600160a01b037f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df875169084611544565b601460049081556040516370a0823160e01b81523091810191909152610c64907f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8759083906001600160a01b038316906370a0823190602401602060405180830381865afa1580156111ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d2919061247a565b6111dc91906124a9565b611574565b6001600160a01b0382166000908152600560205260408120546ec097ce7bc90715b34b9f100000000090610de990846124d9565b6000808061122e6112296201518086612506565b611cdb565b9196909550909350915050565b6001600160a01b038116600090815260026020526040812054900361125d5750565b60005b6009548110156103605760006009828154811061127f5761127f612541565b60009182526020822001546001600160a01b0316915061129f8285610885565b6001600160a01b0380841660009081526003602090815260408083209389168352929052908120600101805492935083929091906112de90849061252e565b90915550506001600160a01b0384166000908152600260205260409020546113079083906111e1565b6001600160a01b0380841660009081526003602090815260408083209389168352929052205580156113c3576001600160a01b0382166000908152600660205260408120805483929061135b90849061252e565b9091555061137590506001600160a01b0383168583611544565b816001600160a01b0316846001600160a01b03167f4fa9693cae526341d334e2862ca2413b2e503f1266255f9e0869fb36e6d89b17836040516113ba91815260200190565b60405180910390a35b505080806113d090612557565b915050611260565b6113e0611e4f565b8015611438576113f08383611ebe565b826001600160a01b03167fae0577e1c96b26fbc0b9df702431f5470979d001d24f136eded791b8b6521d6f8360405161142b91815260200190565b60405180910390a2505050565b6114428383611fb8565b826001600160a01b03167fba8f3777cf908803bf1f3dd58e7f4b7d3de4dbe3c234c4ccab0975d98f7cd3888360405161142b91815260200190565b60007f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316826001600160a01b0316148061091a5750604051634d8c928d60e11b81526001600160a01b0383811660048301527f000000000000000000000000ec0eb48d2d638f241c1a7f109e38ef2901e9450f1690639b19251a90602401602060405180830381865afa158015611520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a9190612570565b6040516001600160a01b038316602482015260448101829052610a3190849063a9059cbb60e01b90606401610ca0565b6001600160a01b0382166000908152600a602052604090205460ff166115fa576001600160a01b0382166000818152600a60205260408120805460ff191660019081179091556009805491820181559091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b03191690911790555b80600003611606575050565b60005460000361167e577f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316826001600160a01b0316146116755760405162461bcd60e51b81526020600482015260016024820152602960f91b604482015260640161034a565b61036081612086565b806001600160a01b037f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8758116908416036117e05760006116bc6119bf565b91505080156117de5760007f0000000000000000000000007d544dd34abbe24c8832db27820ff53c151e949b6001600160a01b0316631ad8b03b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611725573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174991906124bc565b6001600160a01b0316633c9a07006040518163ffffffff1660e01b8152600401602060405180830381865afa158015611786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117aa919061247a565b6117b483866124d9565b6117be9190612506565b905080156117dc576117cf81612086565b6117d981846124a9565b92505b505b505b6001600160a01b0383166000908152600760205260408120805483929061180890849061252e565b90915550506001600160a01b038316600090815260086020526040812082916118304261092d565b8152602001908152602001600020600082825461184d919061252e565b909155505060005461186e826ec097ce7bc90715b34b9f10000000006124d9565b6118789190612506565b6001600160a01b038416600090815260056020526040812080549091906118a090849061252e565b90915550506040518181526001600160a01b0384169033907f6f1ecfed9dbd8c39701eb5288ad020f77ec8a5b2f93133e85482bf66cb877a309060200160405180910390a3505050565b600061193f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121369092919063ffffffff16565b90508051600014806119605750808060200190518101906119609190612570565b610a315760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161034a565b60008060007f0000000000000000000000007d544dd34abbe24c8832db27820ff53c151e949b6001600160a01b0316631ad8b03b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4691906124bc565b90506001600160a01b03811615611b2057806001600160a01b031663676011556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab9919061247a565b9250806001600160a01b0316630389ed176040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1d919061247a565b91505b509091565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611b75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b99919061247a565b9050610cd78463095ea7b360e01b85611bb2868661252e565b6040516001600160a01b0390921660248301526044820152606401610ca0565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611c22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c46919061247a565b905081811015611caa5760405162461bcd60e51b815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e63652062604482015268656c6f77207a65726f60b81b606482015260840161034a565b6040516001600160a01b03841660248201528282036044820152610cd790859063095ea7b360e01b90606401610ca0565b60008080838162253d8c611cf28362010bd961258d565b611cfc919061258d565b9050600062023ab1611d0f8360046125b5565b611d1991906125e5565b90506004611d2a8262023ab16125b5565b611d3590600361258d565b611d3f91906125e5565b611d499083612613565b9150600062164b09611d5c84600161258d565b611d6890610fa06125b5565b611d7291906125e5565b90506004611d82826105b56125b5565b611d8c91906125e5565b611d969084612613565b611da190601f61258d565b9250600061098f611db38560506125b5565b611dbd91906125e5565b905060006050611dcf8361098f6125b5565b611dd991906125e5565b611de39086612613565b9050611df0600b836125e5565b9450611dfd85600c6125b5565b611e0883600261258d565b611e129190612613565b91508483611e21603187612613565b611e2c9060646125b5565b611e36919061258d565b611e40919061258d565b9a919950975095505050505050565b7f0000000000000000000000005dde1c1593a6ae1ba69370a2a05cdfebe799499d6001600160a01b031663bb4630276040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611eaa57600080fd5b505af1158015610cd7573d6000803e3d6000fd5b6001600160a01b03821660009081526002602052604090205415801590611efd57506001600160a01b0382166000908152600260205260409020548111155b611f2e5760405162461bcd60e51b8152602060048201526002602482015261524560f01b604482015260640161034a565b611f378261123b565b80600080828254611f4891906124a9565b90915550506001600160a01b03821660009081526002602052604081208054839290611f759084906124a9565b90915550506001600160a01b0382166000908152600260205260408120549003611faf5760018054906000611fa98361263a565b91905055505b6103608261214d565b6001600160a01b03821660009081526002602052604090205415611fdf57611fdf8261123b565b6001600160a01b038216600090815260026020526040812054815490918391819061200b90849061252e565b90915550506001600160a01b0383166000908152600260205260408120805484929061203890849061252e565b90915550508015801561206257506001600160a01b03831660009081526002602052604090205415155b1561207d576001805490600061207783612557565b91905055505b610a318361214d565b604051630852cd8d60e31b8152600481018290527f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8756001600160a01b0316906342966c6890602401600060405180830381600087803b1580156120e857600080fd5b505af19250505080156120f9575060015b612133576121336001600160a01b037f00000000000000000000000002f92800f57bcd74066f5709f1daa1a4302df8751661dead83611544565b50565b606061214584846000856121df565b949350505050565b60005b6009548110156103605760006009828154811061216f5761216f612541565b60009182526020808320909101546001600160a01b0386811684526002909252604090922054911691506121a49082906111e1565b6001600160a01b03918216600090815260036020908152604080832094871683529390529190912055806121d781612557565b915050612150565b6060824710156122405760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161034a565b600080866001600160a01b0316858760405161225c9190612675565b60006040518083038185875af1925050503d8060008114612299576040519150601f19603f3d011682016040523d82523d6000602084013e61229e565b606091505b50915091506122af878383876122ba565b979650505050505050565b60608315612329578251600003612322576001600160a01b0385163b6123225760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161034a565b5081612145565b612145838381511561233e5781518083602001fd5b8060405162461bcd60e51b815260040161034a9190612691565b6001600160a01b038116811461213357600080fd5b6000806040838503121561238057600080fd5b823561238b81612358565b946020939093013593505050565b600080604083850312156123ac57600080fd5b50508035926020909101359150565b600080604083850312156123ce57600080fd5b82356123d981612358565b915060208301356123e981612358565b809150509250929050565b60006020828403121561240657600080fd5b813561097881612358565b60006020828403121561242357600080fd5b5035919050565b801515811461213357600080fd5b60008060006060848603121561244d57600080fd5b833561245881612358565b925060208401359150604084013561246f8161242a565b809150509250925092565b60006020828403121561248c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561091a5761091a612493565b6000602082840312156124ce57600080fd5b815161097881612358565b808202811582820484141761091a5761091a612493565b634e487b7160e01b600052601260045260246000fd5b600082612515576125156124f0565b500490565b600082612529576125296124f0565b500690565b8082018082111561091a5761091a612493565b634e487b7160e01b600052603260045260246000fd5b60006001820161256957612569612493565b5060010190565b60006020828403121561258257600080fd5b81516109788161242a565b80820182811260008312801582168215821617156125ad576125ad612493565b505092915050565b80820260008212600160ff1b841416156125d1576125d1612493565b818105831482151761091a5761091a612493565b6000826125f4576125f46124f0565b600160ff1b82146000198414161561260e5761260e612493565b500590565b818103600083128015838313168383128216171561263357612633612493565b5092915050565b60008161264957612649612493565b506000190190565b60005b8381101561266c578181015183820152602001612654565b50506000910152565b60008251612687818460208701612651565b9190910192915050565b60208152600082518060208401526126b0816040850160208701612651565b601f01601f1916919091016040019291505056fea164736f6c6343000813000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.