Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 5 from a total of 5 transactions
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x9B0df1A5...10e5cED4B The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ConvexCurveManagerImmutable
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.20; import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol"; import { IMultipleRewardDistributor } from "../../../common/rewards/distributor/IMultipleRewardDistributor.sol"; import { IConvexVirtualBalanceRewardPool } from "../../../interfaces/convex/IConvexVirtualBalanceRewardPool.sol"; import { IStashTokenWrapper } from "../../../interfaces/convex/IStashTokenWrapper.sol"; import { ILiquidityManager } from "../../../interfaces/voting-escrow/ILiquidityManager.sol"; import { IConvexBasicRewards } from "../../../interfaces/IConvexBasicRewards.sol"; import { IConvexBooster } from "../../../interfaces/IConvexBooster.sol"; import { WordCodec } from "../../../common/codec/WordCodec.sol"; import { LiquidityManagerBaseImmutable } from "./LiquidityManagerBaseImmutable.sol"; contract ConvexCurveManagerImmutable is LiquidityManagerBaseImmutable { using SafeERC20 for IERC20; using WordCodec for bytes32; /************* * Constants * *************/ /// @dev The address of Convex CVX token. address private constant CVX = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B; /// @dev The address of Convex Booster. address private constant BOOSTER = 0xF403C135812408BFbE8713b5A23a04b3D48AAE31; /// @dev The offset of pid in `_miscData`. uint256 private constant PID_OFFSET = 61; /// @dev The rewarder of pid in `_miscData`. uint256 private constant REWARDER_OFFSET = 77; /// @notice The pid in Convex Booster. uint256 public immutable pid; /// @notice The address of rewarder. address public immutable rewarder; /************* * Variables * *************/ /// @dev the list of reward tokens. address[] private rewards; /*************** * Constructor * ***************/ constructor( address _operator, address _token, address _rewarder ) LiquidityManagerBaseImmutable(_operator, _token) { pid = IConvexBasicRewards(_rewarder).pid(); rewarder = _rewarder; IERC20(_token).safeApprove(BOOSTER, type(uint256).max); syncRewardToken(); } /************************* * Public View Functions * *************************/ /// @inheritdoc ILiquidityManager function getRewardTokens() external view returns (address[] memory) { return rewards; } /**************************** * Public Mutated Functions * ****************************/ /// @notice Sync reward tokens from ConvexBasicRewards contract. function syncRewardToken() public { delete rewards; rewards.push(IConvexBasicRewards(rewarder).rewardToken()); uint256 _length = IConvexBasicRewards(rewarder).extraRewardsLength(); bool _hasCVX = false; for (uint256 i = 0; i < _length; i++) { address _rewarder = IConvexBasicRewards(rewarder).extraRewards(i); address _wrapper = IConvexVirtualBalanceRewardPool(_rewarder).rewardToken(); // old rewarders didn't use token wrapper try IStashTokenWrapper(_wrapper).token() returns (address _token) { if (_token == CVX) _hasCVX = true; rewards.push(_token); } catch { if (_wrapper == CVX) _hasCVX = true; rewards.push(_wrapper); } } if (!_hasCVX) rewards.push(CVX); _length = rewards.length; for (uint256 i = 0; i < _length; ++i) { address _token = rewards[i]; IERC20(_token).safeApprove(operator, 0); IERC20(_token).safeApprove(operator, type(uint256).max); } } /// @inheritdoc ILiquidityManager function manage() public override { uint256 _balance = IERC20(token).balanceOf(address(this)); if (_balance == 0) return; _manageUnderlying(address(0), _balance, false); } /// @inheritdoc ILiquidityManager function harvest(address _receiver) external { // try to deposit first uint256 _balance = IERC20(token).balanceOf(address(this)); if (_balance > 0) { IConvexBooster(BOOSTER).deposit(pid, _balance, true); } // harvest IConvexBasicRewards(rewarder).getReward(); // distribute rewards uint256 _harvesterRatio = getHarvesterRatio(); uint256 _managerRatio = getManagerRatio(); uint256 _length = rewards.length; for (uint256 i = 0; i < _length; ++i) { address _rewardToken = rewards[i]; uint256 _rewardAmount = IERC20(_rewardToken).balanceOf(address(this)) - incentive[_rewardToken]; if (_rewardAmount == 0) continue; unchecked { uint256 _incentive = (_rewardAmount * _managerRatio) / FEE_PRECISION; if (_incentive > 0) incentive[_rewardToken] += _incentive; uint256 _bounty = (_rewardAmount * _harvesterRatio) / FEE_PRECISION; if (_bounty > 0) { IERC20(_rewardToken).safeTransfer(_receiver, _bounty); } IMultipleRewardDistributor(operator).depositReward(_rewardToken, _rewardAmount - _incentive - _bounty); } } } /********************** * Internal Functions * **********************/ /// @inheritdoc LiquidityManagerBaseImmutable function _managedBalance() internal view virtual override returns (uint256) { unchecked { return IERC20(token).balanceOf(address(this)) + IConvexBasicRewards(rewarder).balanceOf(address(this)); } } /// @inheritdoc LiquidityManagerBaseImmutable function _deposit( address _receiver, uint256, bool _manage ) internal virtual override { if (_manage) { // deposit to underlying strategy uint256 _balance = IERC20(token).balanceOf(address(this)); if (_balance > 0) { _manageUnderlying(_receiver, _balance, true); } } } /// @inheritdoc LiquidityManagerBaseImmutable function _withdraw(address _receiver, uint256 _amount) internal virtual override { if (_amount > 0) { uint256 _balance = IERC20(token).balanceOf(address(this)); if (_amount > _balance) { unchecked { IConvexBasicRewards(rewarder).withdrawAndUnwrap(_amount - _balance, false); } } IERC20(token).safeTransfer(_receiver, _amount); } } /// @dev Internal function to manage underlying assets function _manageUnderlying( address _receiver, uint256 _balance, bool _incentived ) internal { // deposit to booster IConvexBooster(BOOSTER).deposit(pid, _balance, true); // send incentive if (_incentived) { uint256 _length = rewards.length; for (uint256 i = 0; i < _length; ++i) { address _rewardToken = rewards[i]; uint256 _incentive = incentive[_rewardToken]; if (_incentive > 0) { IERC20(_rewardToken).safeTransfer(_receiver, _incentive); incentive[_rewardToken] = 0; } } } } }
// 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.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./Ownable.sol"; /** * @dev Contract module which provides 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} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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. */ 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]. */ 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 v4.4.1 (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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // solhint-disable no-inline-assembly /// @dev A subset copied from the following contracts: /// /// + `balancer-labs/v2-solidity-utils/contracts/helpers/WordCodec.sol` /// + `balancer-labs/v2-solidity-utils/contracts/helpers/WordCodecHelpers.sol` library WordCodec { /// @dev Inserts an unsigned integer of bitLength, shifted by an offset, into a 256 bit word, /// replacing the old value. Returns the new word. function insertUint( bytes32 word, uint256 value, uint256 offset, uint256 bitLength ) internal pure returns (bytes32 result) { // Equivalent to: // uint256 mask = (1 << bitLength) - 1; // bytes32 clearedWord = bytes32(uint256(word) & ~(mask << offset)); // result = clearedWord | bytes32(value << offset); assembly { let mask := sub(shl(bitLength, 1), 1) let clearedWord := and(word, not(shl(offset, mask))) result := or(clearedWord, shl(offset, value)) } } /// @dev Decodes and returns an unsigned integer with `bitLength` bits, shifted by an offset, from a 256 bit word. function decodeUint( bytes32 word, uint256 offset, uint256 bitLength ) internal pure returns (uint256 result) { // Equivalent to: // result = uint256(word >> offset) & ((1 << bitLength) - 1); assembly { result := and(shr(offset, word), sub(shl(bitLength, 1), 1)) } } /// @dev Inserts a signed integer shifted by an offset into a 256 bit word, replacing the old value. Returns /// the new word. /// /// Assumes `value` can be represented using `bitLength` bits. function insertInt( bytes32 word, int256 value, uint256 offset, uint256 bitLength ) internal pure returns (bytes32) { unchecked { uint256 mask = (1 << bitLength) - 1; bytes32 clearedWord = bytes32(uint256(word) & ~(mask << offset)); // Integer values need masking to remove the upper bits of negative values. return clearedWord | bytes32((uint256(value) & mask) << offset); } } /// @dev Decodes and returns a signed integer with `bitLength` bits, shifted by an offset, from a 256 bit word. function decodeInt( bytes32 word, uint256 offset, uint256 bitLength ) internal pure returns (int256 result) { unchecked { int256 maxInt = int256((1 << (bitLength - 1)) - 1); uint256 mask = (1 << bitLength) - 1; int256 value = int256(uint256(word >> offset) & mask); // In case the decoded value is greater than the max positive integer that can be represented with bitLength // bits, we know it was originally a negative integer. Therefore, we mask it to restore the sign in the 256 bit // representation. // // Equivalent to: // result = value > maxInt ? (value | int256(~mask)) : value; assembly { result := or(mul(gt(value, maxInt), not(mask)), value) } } } /// @dev Decodes and returns a boolean shifted by an offset from a 256 bit word. function decodeBool(bytes32 word, uint256 offset) internal pure returns (bool result) { // Equivalent to: // result = (uint256(word >> offset) & 1) == 1; assembly { result := and(shr(offset, word), 1) } } /// @dev Inserts a boolean value shifted by an offset into a 256 bit word, replacing the old value. Returns the new /// word. function insertBool( bytes32 word, bool value, uint256 offset ) internal pure returns (bytes32 result) { // Equivalent to: // bytes32 clearedWord = bytes32(uint256(word) & ~(1 << offset)); // bytes32 referenceInsertBool = clearedWord | bytes32(uint256(value ? 1 : 0) << offset); assembly { let clearedWord := and(word, not(shl(offset, 1))) result := or(clearedWord, shl(offset, value)) } } function clearWordAtPosition( bytes32 word, uint256 offset, uint256 bitLength ) internal pure returns (bytes32 clearedWord) { unchecked { uint256 mask = (1 << bitLength) - 1; clearedWord = bytes32(uint256(word) & ~(mask << offset)); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IMultipleRewardDistributor { /********** * Events * **********/ /// @notice Emitted when new reward token is registered. /// /// @param token The address of reward token. /// @param distributor The address of reward distributor. event RegisterRewardToken(address indexed token, address indexed distributor); /// @notice Emitted when the reward distributor is updated. /// /// @param token The address of reward token. /// @param oldDistributor The address of previous reward distributor. /// @param newDistributor The address of current reward distributor. event UpdateRewardDistributor(address indexed token, address indexed oldDistributor, address indexed newDistributor); /// @notice Emitted when a reward token is unregistered. /// /// @param token The address of reward token. event UnregisterRewardToken(address indexed token); /// @notice Emitted when a reward token is deposited. /// /// @param token The address of reward token. /// @param amount The amount of reward token deposited. event DepositReward(address indexed token, uint256 amount); /********** * Errors * **********/ /// @dev Thrown when caller access an unactive reward token. error NotActiveRewardToken(); /// @dev Thrown when the address of reward distributor is `address(0)`. error RewardDistributorIsZero(); /// @dev Thrown when caller is not reward distributor. error NotRewardDistributor(); /// @dev Thrown when caller try to register an existing reward token. error DuplicatedRewardToken(); /// @dev Thrown when caller try to unregister a reward with pending rewards. error RewardDistributionNotFinished(); /************************* * Public View Functions * *************************/ /// @notice Return the address of reward distributor. /// /// @param token The address of reward token. function distributors(address token) external view returns (address); /// @notice Return the list of active reward tokens. function getActiveRewardTokens() external view returns (address[] memory); /// @notice Return the list of historical reward tokens. function getHistoricalRewardTokens() external view returns (address[] memory); /// @notice Return the amount of pending distributed rewards in current period. /// /// @param token The address of reward token. /// @return distributable The amount of reward token can be distributed in current period. /// @return undistributed The amount of reward token still locked in current period. function pendingRewards(address token) external view returns (uint256 distributable, uint256 undistributed); /**************************** * Public Mutated Functions * ****************************/ /// @notice Deposit new rewards to this contract. /// /// @param token The address of reward token. /// @param amount The amount of new rewards. function depositReward(address token, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0 || ^0.8.0; interface IConvexVirtualBalanceRewardPool { function rewardToken() external view returns (address); function earned(address account) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0 || ^0.8.0; interface IStashTokenWrapper { function token() external view returns (address); function rewardPool() external view returns (address); function isInvalid() external view returns (bool); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address _account) external view returns (uint256); function transfer(address _recipient, uint256 _amount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0 || ^0.8.0; interface IConvexBasicRewards { function pid() external view returns (uint256); function totalSupply() external view returns (uint256); function periodFinish() external view returns (uint256); function rewardRate() external view returns (uint256); function stakingToken() external view returns (address); function stakeFor(address, uint256) external returns (bool); function balanceOf(address) external view returns (uint256); function earned(address) external view returns (uint256); function withdrawAll(bool) external returns (bool); function withdraw(uint256, bool) external returns (bool); function withdrawAndUnwrap(uint256, bool) external returns (bool); function getReward() external returns (bool); function stake(uint256) external returns (bool); function rewardToken() external view returns (address); function extraRewards(uint256) external view returns (address); function extraRewardsLength() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0 || ^0.8.0; pragma abicoder v2; interface IConvexBooster { struct PoolInfo { address lptoken; address token; address gauge; address crvRewards; address stash; bool shutdown; } function poolInfo(uint256 _pid) external view returns (PoolInfo memory); function depositAll(uint256 _pid, bool _stake) external returns (bool); function deposit( uint256 _pid, uint256 _amount, bool _stake ) external returns (bool); function earmarkRewards(uint256 _pid) external returns (bool); function earmarkFees() external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ILiquidityManager { /********** * Events * **********/ /// @notice Emitted when the ratio for manager is updated. /// @param oldRatio The value of the previous ratio, multipled by 1e9. /// @param newRatio The value of the current ratio, multipled by 1e9. event UpdateManagerRatio(uint256 oldRatio, uint256 newRatio); /// @notice Emitted when the ratio for harvester is updated. /// @param oldRatio The value of the previous ratio, multipled by 1e9. /// @param newRatio The value of the current ratio, multipled by 1e9. event UpdateHarvesterRatio(uint256 oldRatio, uint256 newRatio); /********** * Errors * **********/ /// @dev Thrown when try to kill the manager more than once. error AlreadyKilled(); /// @dev Thrown when the call is not operator. error CallerIsNotOperator(); /// @dev Thrown when the manager ratio exceeds `MAX_MANAGER_RATIO`. error ManagerRatioTooLarge(); /// @dev Thrown when the harvester ratio exceeds `MAX_HARVESTER_RATIO`. error HarvesterRatioTooLarge(); /************************* * Public View Functions * *************************/ /// @notice Return whether the manager is active. function isActive() external view returns (bool); /// @notice Return the list of reward tokens. function getRewardTokens() external view returns (address[] memory); /// @notice Return the fee ratio distributed to treasury, multipled by 1e9. function getManagerRatio() external view returns (uint256); /// @notice Return the fee ratio distributed to harvester, multipled by 1e9. function getHarvesterRatio() external view returns (uint256); /**************************** * Public Mutated Functions * ****************************/ /// @notice Deposit token to corresponding manager. /// @dev Requirements: /// + Caller should make sure the token is already transfered into the manager contract. /// + Caller should make sure the deposit amount is greater than zero. /// /// @param receiver The address of recipient who will receive the share. /// @param amount The amount of token to deposit. /// @param manage Whether to deposit the token to underlying strategy. function deposit( address receiver, uint256 amount, bool manage ) external; /// @notice Withdraw underlying token from corresponding manager. /// @dev Requirements: /// + Caller should make sure the withdraw amount is greater than zero. /// /// @param receiver The address of recipient who will receive the token. /// @param amount The amount of token to withdraw. function withdraw(address receiver, uint256 amount) external; /// @notice Emergency function to execute arbitrary call. /// @dev This function should be only used in case of emergency. It should never be called explicitly /// in any contract in normal case. /// /// @param to The address of target contract to call. /// @param value The value passed to the target contract. /// @param data The calldata pseed to the target contract. function execute( address to, uint256 value, bytes calldata data ) external payable returns (bool, bytes memory); /// @notice Manage the deposited token. Usually the token will be /// deposited to another protocol which could generate more yields. function manage() external; /// @notice Harvest pending rewards from underlying protocol. /// @param receiver The address of the recipient for harvest incentive. function harvest(address receiver) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { Ownable2Step } from "@openzeppelin/contracts-v4/access/Ownable2Step.sol"; import { WordCodec } from "../../../common/codec/WordCodec.sol"; import { ILiquidityManager } from "../../../interfaces/voting-escrow/ILiquidityManager.sol"; abstract contract LiquidityManagerBaseImmutable is Ownable2Step, ILiquidityManager { using WordCodec for bytes32; /************* * Constants * *************/ /// @dev The offset of active flag in `_miscData`. uint256 private constant ACTIVE_FLAG_OFFSET = 0; /// @dev The offset of manager ratio in `_miscData`. uint256 private constant MANAGER_RATIO_OFFSET = 1; /// @dev The offset of harvester ratio in `_miscData`. uint256 private constant HARVESTER_RATIO_OFFSET = 31; /// @dev The maximum manager ratio. uint256 private constant MAX_MANAGER_RATIO = 5e8; // 20% /// @dev The maximum harvester ratio. uint256 private constant MAX_HARVESTER_RATIO = 1e8; // 20% /// @dev The fee denominator used for rate calculation. uint256 internal constant FEE_PRECISION = 1e9; /// @notice The address of operator, usually the `LiquidityGauge` contract. address public immutable operator; /// @notice The address of managed token. address public immutable token; /************* * Variables * *************/ /// @notice Mapping from reward token address to the amount of incentive for manager. mapping(address => uint256) public incentive; /// @dev `_miscData` is a storage slot that can be used to store unrelated pieces of information. /// All LiquidityManagerBase store the *active flag*, *manager ratio* and *harvester ratio*, but /// the `miscData`can be extended to store more pieces of information. /// /// The *active flag* is stored in the first bit, and the *manager ratio* is stored in the next most /// significant 30 bits, and the *harvester ratio* is stored in the next most significant 30 bits, /// leaving the remaining 195 bits free to store any other information derived pools might need. /// /// - The *manager ratio* and *harvester ratio* are charged each time when harvester harvest the pool revenue. /// /// [ active flag | manager ratio | harvester ratio | available ] /// [ 1 bit | 30 bits | 30 bits | 195 bits ] /// [ MSB LSB ] bytes32 internal _miscData; /************* * Modifiers * *************/ modifier onlyOperator() { if (_msgSender() != operator) { revert CallerIsNotOperator(); } _; } modifier whenNotKilled() { if (!isActive()) revert AlreadyKilled(); _; } /*************** * Constructor * ***************/ constructor(address _operator, address _token) { operator = _operator; token = _token; // Set active _miscData = _miscData.insertBool(true, ACTIVE_FLAG_OFFSET); } /************************* * Public View Functions * *************************/ /// @inheritdoc ILiquidityManager function isActive() public view override returns (bool) { return _miscData.decodeBool(ACTIVE_FLAG_OFFSET); } /// @inheritdoc ILiquidityManager function getManagerRatio() public view override returns (uint256) { return _miscData.decodeUint(MANAGER_RATIO_OFFSET, 30); } /// @inheritdoc ILiquidityManager function getHarvesterRatio() public view override returns (uint256) { return _miscData.decodeUint(HARVESTER_RATIO_OFFSET, 30); } /**************************** * Public Mutated Functions * ****************************/ /// @inheritdoc ILiquidityManager function deposit( address _receiver, uint256 _amount, bool _manage ) external onlyOperator whenNotKilled { _deposit(_receiver, _amount, _manage); } /// @inheritdoc ILiquidityManager function withdraw(address _receiver, uint256 _amount) external onlyOperator whenNotKilled { _withdraw(_receiver, _amount); } /************************ * Restricted Functions * ************************/ /// @inheritdoc ILiquidityManager function execute( address _to, uint256 _value, bytes calldata _data ) external payable onlyOwner returns (bool, bytes memory) { // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory result) = _to.call{ value: _value }(_data); return (success, result); } /// @notice Kill the liquidity manager and withdraw all token back to operator. function kill() external onlyOwner whenNotKilled { _miscData = _miscData.insertBool(false, ACTIVE_FLAG_OFFSET); // Send all funds back to operator uint256 _balance = _managedBalance(); _withdraw(operator, _balance); } /// @notice Update the fee ratio distributed to manager. /// @param _newRatio The new ratio to update, multipled by 1e9. function updateManagerRatio(uint32 _newRatio) external onlyOwner { if (uint256(_newRatio) > MAX_MANAGER_RATIO) { revert ManagerRatioTooLarge(); } bytes32 _data = _miscData; uint256 _oldRatio = _miscData.decodeUint(MANAGER_RATIO_OFFSET, 30); _miscData = _data.insertUint(_newRatio, MANAGER_RATIO_OFFSET, 30); emit UpdateManagerRatio(_oldRatio, _newRatio); } /// @notice Update the fee ratio distributed to harvester. /// @param _newRatio The new ratio to update, multipled by 1e9. function updateHarvesterRatio(uint32 _newRatio) external onlyOwner { if (uint256(_newRatio) > MAX_HARVESTER_RATIO) { revert HarvesterRatioTooLarge(); } bytes32 _data = _miscData; uint256 _oldRatio = _miscData.decodeUint(HARVESTER_RATIO_OFFSET, 30); _miscData = _data.insertUint(_newRatio, HARVESTER_RATIO_OFFSET, 30); emit UpdateHarvesterRatio(_oldRatio, _newRatio); } /********************** * Internal Functions * **********************/ /// @dev Internal function to return all managed tokens. function _managedBalance() internal view virtual returns (uint256); /// @dev Internal function to deposit token. /// /// @param _receiver The address of recipient who will receive the share. /// @param _amount The amount of token to deposit. /// @param _manage Whether to deposit the token to underlying strategy. function _deposit( address _receiver, uint256 _amount, bool _manage ) internal virtual; /// @dev Internal function to withdraw token. /// /// @param _receiver The address of recipient who will receive the token. /// @param _amount The amount of token to withdraw. function _withdraw(address _receiver, uint256 _amount) internal virtual; }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "shanghai", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_rewarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyKilled","type":"error"},{"inputs":[],"name":"CallerIsNotOperator","type":"error"},{"inputs":[],"name":"HarvesterRatioTooLarge","type":"error"},{"inputs":[],"name":"ManagerRatioTooLarge","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"UpdateHarvesterRatio","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newRatio","type":"uint256"}],"name":"UpdateManagerRatio","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_manage","type":"bool"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getHarvesterRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getManagerRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"incentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"kill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"manage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"syncRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_newRatio","type":"uint32"}],"name":"updateHarvesterRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_newRatio","type":"uint32"}],"name":"updateManagerRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x60806040526004361061013c575f3560e01c80638da5cb5b116100b3578063dcc3e06e1161006d578063dcc3e06e14610361578063e30c397814610394578063f1068454146103b1578063f2fde38b146103e4578063f3fef3a314610403578063fc0c546a14610422575f80fd5b80638da5cb5b146102b3578063a69f4935146102cf578063b61d27f6146102ec578063ba2ee65c1461030d578063bf6f5b0014610321578063c4f59f9b14610340575f80fd5b80634350df3d116101045780634350df3d146101e25780634d567e6214610201578063570ca7351461022c5780637108576e14610277578063715018a61461028b57806379ba50971461029f575f80fd5b80630e5c011e146101405780631902fe6f1461016157806322f3e2d41461018d5780633edd1128146101af57806341c0e1b5146101ce575b5f80fd5b34801561014b575f80fd5b5061015f61015a366004611ac4565b610455565b005b34801561016c575f80fd5b5060035460011c633fffffff165b6040519081526020015b60405180910390f35b348015610198575f80fd5b506003546001166040519015158152602001610184565b3480156101ba575f80fd5b5061015f6101c9366004611af3565b6107cc565b3480156101d9575f80fd5b5061015f610848565b3480156101ed575f80fd5b5061015f6101fc366004611b32565b6108b5565b34801561020c575f80fd5b5061017a61021b366004611ac4565b60026020525f908152604090205481565b348015610237575f80fd5b5061025f7f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba81565b6040516001600160a01b039091168152602001610184565b348015610282575f80fd5b5061015f610959565b348015610296575f80fd5b5061015f610dfb565b3480156102aa575f80fd5b5061015f610e0e565b3480156102be575f80fd5b505f546001600160a01b031661025f565b3480156102da575f80fd5b50600354601f1c633fffffff1661017a565b6102ff6102fa366004611b55565b610e8a565b604051610184929190611c24565b348015610318575f80fd5b5061015f610f01565b34801561032c575f80fd5b5061015f61033b366004611b32565b610fa0565b34801561034b575f80fd5b5061035461103b565b6040516101849190611c3e565b34801561036c575f80fd5b5061025f7f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f981565b34801561039f575f80fd5b506001546001600160a01b031661025f565b3480156103bc575f80fd5b5061017a7f00000000000000000000000000000000000000000000000000000000000000f481565b3480156103ef575f80fd5b5061015f6103fe366004611ac4565b61109b565b34801561040e575f80fd5b5061015f61041d366004611c8a565b61110b565b34801561042d575f80fd5b5061025f7f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d9681565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d966001600160a01b0316906370a0823190602401602060405180830381865afa1580156104b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104dd9190611cb4565b90508015610587576040516321d0683360e11b81527f00000000000000000000000000000000000000000000000000000000000000f46004820152602481018290526001604482015273f403c135812408bfbe8713b5a23a04b3d48aae31906343a0d066906064016020604051808303815f875af1158015610561573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105859190611ccb565b505b7f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f96001600160a01b0316633d18b9126040518163ffffffff1660e01b81526004016020604051808303815f875af11580156105e4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106089190611ccb565b50600354600454633fffffff601f83901c81169260011c16905f5b818110156107c4575f6004828154811061063f5761063f611ce6565b5f918252602080832091909101546001600160a01b0316808352600290915260408083205490516370a0823160e01b81523060048201529193509083906370a0823190602401602060405180830381865afa1580156106a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106c49190611cb4565b6106ce9190611d0e565b9050805f036106de5750506107b4565b633b9aca0085820204801561070b576001600160a01b0383165f9081526002602052604090208054820190555b633b9aca0087830204801561072e5761072e6001600160a01b0385168b83611185565b604051637db4e28f60e01b81526001600160a01b03858116600483015283850383900360248301527f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba1690637db4e28f906044015f604051808303815f87803b158015610799575f80fd5b505af11580156107ab573d5f803e3d5ffd5b50505050505050505b6107bd81611d27565b9050610623565b505050505050565b337f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba6001600160a01b0316146108155760405163683b4ec760e11b815260040160405180910390fd5b60035460011661083857604051633d24012960e11b815260040160405180910390fd5b6108438383836111e8565b505050565b610850611290565b60035460011661087357604051633d24012960e11b815260040160405180910390fd5b600354600119166003555f6108866112e9565b90506108b27f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba826113fd565b50565b6108bd611290565b631dcd65008163ffffffff1611156108e857604051639a451f3d60e01b815260040160405180910390fd5b6003545f600182901c633fffffff1690506109128263ffffffff80861690600190601e9061155a16565b6003556040805182815263ffffffff851660208201527f31847b566e19cccc4a2cce6544d2e8c1a91362c7a2a4cf6f1ec84dcd0a494b1791015b60405180910390a1505050565b61096460045f611a82565b60047f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f96001600160a01b031663f7c618c16040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109e69190611d3f565b81546001810183555f928352602080842090910180546001600160a01b0319166001600160a01b039384161790556040805163355688fd60e21b815290517f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f99093169263d55a23f4926004808401939192918290030181865afa158015610a6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a939190611cb4565b90505f805b82811015610cf457604051632061aa2360e11b8152600481018290525f907f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f96001600160a01b0316906340c3544690602401602060405180830381865afa158015610b05573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b299190611d3f565b90505f816001600160a01b031663f7c618c16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b68573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b8c9190611d3f565b9050806001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610be8575060408051601f3d908101601f19168201909252610be591810190611d3f565b60015b610c6557734e3fbd56cd56c3e72c1403e103b45db9da5b9d2a196001600160a01b03821601610c1657600193505b600480546001810182555f919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b038316179055610cdf565b734e3fbd56cd56c3e72c1403e103b45db9da5b9d2a196001600160a01b03821601610c8f57600194505b600480546001810182555f919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0319166001600160a01b03929092169190911790555b50508080610cec90611d27565b915050610a98565b5080610d5057600480546001810182555f919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b031916734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b1790555b60045491505f5b82811015610843575f60048281548110610d7357610d73611ce6565b5f9182526020822001546001600160a01b03169150610db59082907f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba9061156e565b610dea6001600160a01b0382167f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba5f1961156e565b50610df481611d27565b9050610d57565b610e03611290565b610e0c5f611681565b565b60015433906001600160a01b03168114610e815760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b6108b281611681565b5f6060610e95611290565b5f80876001600160a01b0316878787604051610eb2929190611d5a565b5f6040518083038185875af1925050503d805f8114610eec576040519150601f19603f3d011682016040523d82523d5f602084013e610ef1565b606091505b5090999098509650505050505050565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d966001600160a01b0316906370a0823190602401602060405180830381865afa158015610f65573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f899190611cb4565b9050805f03610f955750565b6108b25f825f61169a565b610fa8611290565b6305f5e1008163ffffffff161115610fd357604051633421169f60e21b815260040160405180910390fd5b6003545f601f82901c633fffffff169050610ffd8263ffffffff80861690601f90601e9061155a16565b6003556040805182815263ffffffff851660208201527f2c3b971a5011a057ee9b96ea2aa1504d93d268e5c9cfdee7581d31435b24435e910161094c565b6060600480548060200260200160405190810160405280929190818152602001828054801561109157602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611073575b5050505050905090565b6110a3611290565b600180546001600160a01b0383166001600160a01b031990911681179091556110d35f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b337f0000000000000000000000005b1d12365bec01b8b672ee45912d1bbc86305dba6001600160a01b0316146111545760405163683b4ec760e11b815260040160405180910390fd5b60035460011661117757604051633d24012960e11b815260040160405180910390fd5b61118182826113fd565b5050565b6040516001600160a01b03831660248201526044810182905261084390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526117d6565b8015610843576040516370a0823160e01b81523060048201525f907f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d966001600160a01b0316906370a0823190602401602060405180830381865afa158015611252573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112769190611cb4565b9050801561128a5761128a8482600161169a565b50505050565b5f546001600160a01b03163314610e0c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e78565b6040516370a0823160e01b81523060048201525f907f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f96001600160a01b0316906370a0823190602401602060405180830381865afa15801561134d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113719190611cb4565b6040516370a0823160e01b81523060048201527f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d966001600160a01b0316906370a0823190602401602060405180830381865afa1580156113d3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113f79190611cb4565b01905090565b8015611181576040516370a0823160e01b81523060048201525f907f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d966001600160a01b0316906370a0823190602401602060405180830381865afa158015611467573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061148b9190611cb4565b90508082111561152657604051636197390160e11b815281830360048201525f60248201527f000000000000000000000000883d7ab9078970b0204c50b56e1c3f72ab5544f96001600160a01b03169063c32e7202906044016020604051808303815f875af1158015611500573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115249190611ccb565b505b6108436001600160a01b037f00000000000000000000000028ca243dc0ac075dd012fcf9375c25d18a844d96168484611185565b6001901b5f1901811b1992909216911b1790565b8015806115e65750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156115c0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115e49190611cb4565b155b6116515760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610e78565b6040516001600160a01b03831660248201526044810182905261084390849063095ea7b360e01b906064016111b1565b600180546001600160a01b03191690556108b2816118a9565b6040516321d0683360e11b81527f00000000000000000000000000000000000000000000000000000000000000f46004820152602481018390526001604482015273f403c135812408bfbe8713b5a23a04b3d48aae31906343a0d066906064016020604051808303815f875af1158015611716573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061173a9190611ccb565b508015610843576004545f5b818110156117cf575f6004828154811061176257611762611ce6565b5f9182526020808320909101546001600160a01b0316808352600290915260409091205490915080156117bc576117a36001600160a01b0383168883611185565b6001600160a01b0382165f908152600260205260408120555b5050806117c890611d27565b9050611746565b5050505050565b5f61182a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118f89092919063ffffffff16565b905080515f148061184a57508080602001905181019061184a9190611ccb565b6108435760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610e78565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606061190684845f8561190e565b949350505050565b60608247101561196f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610e78565b5f80866001600160a01b0316858760405161198a9190611d69565b5f6040518083038185875af1925050503d805f81146119c4576040519150601f19603f3d011682016040523d82523d5f602084013e6119c9565b606091505b50915091506119da878383876119e5565b979650505050505050565b60608315611a535782515f03611a4c576001600160a01b0385163b611a4c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610e78565b5081611906565b6119068383815115611a685781518083602001fd5b8060405162461bcd60e51b8152600401610e789190611d84565b5080545f8255905f5260205f20908101906108b291905b80821115611aac575f8155600101611a99565b5090565b6001600160a01b03811681146108b2575f80fd5b5f60208284031215611ad4575f80fd5b8135611adf81611ab0565b9392505050565b80151581146108b2575f80fd5b5f805f60608486031215611b05575f80fd5b8335611b1081611ab0565b9250602084013591506040840135611b2781611ae6565b809150509250925092565b5f60208284031215611b42575f80fd5b813563ffffffff81168114611adf575f80fd5b5f805f8060608587031215611b68575f80fd5b8435611b7381611ab0565b935060208501359250604085013567ffffffffffffffff80821115611b96575f80fd5b818701915087601f830112611ba9575f80fd5b813581811115611bb7575f80fd5b886020828501011115611bc8575f80fd5b95989497505060200194505050565b5f5b83811015611bf1578181015183820152602001611bd9565b50505f910152565b5f8151808452611c10816020860160208601611bd7565b601f01601f19169290920160200192915050565b8215158152604060208201525f6119066040830184611bf9565b602080825282518282018190525f9190848201906040850190845b81811015611c7e5783516001600160a01b031683529284019291840191600101611c59565b50909695505050505050565b5f8060408385031215611c9b575f80fd5b8235611ca681611ab0565b946020939093013593505050565b5f60208284031215611cc4575f80fd5b5051919050565b5f60208284031215611cdb575f80fd5b8151611adf81611ae6565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b81810381811115611d2157611d21611cfa565b92915050565b5f60018201611d3857611d38611cfa565b5060010190565b5f60208284031215611d4f575f80fd5b8151611adf81611ab0565b818382375f9101908152919050565b5f8251611d7a818460208701611bd7565b9190910192915050565b602081525f611adf6020830184611bf956fea2646970667358221220b83eb5ddcde17ed59d8cad4d48b554a49c6edb457602c5b3a835e7e9b6e638da64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.