More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StoutVault
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Controller} from "./abstract/Controller.sol"; import {ReentrancyGuard} from "./abstract/ReentrancyGuard.sol"; import {Rebase, AuxRebase} from "./library/AuxRebase.sol"; import {IERC20Custom} from "./interface/IERC20Custom.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC20 as IERC20Safe} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title StoutVault * @dev Token vault with rebase and share tracking * @notice Multi-token vault with share accounting */ contract StoutVault is Controller, ReentrancyGuard { using AuxRebase for Rebase; /*////////////////////////////////////////////////////////////// CONSTANTS & STATE VARIABLES //////////////////////////////////////////////////////////////*/ /// @notice Minimum share balance to prevent dust accumulation /// @dev Prevents extremely small share balances that could cause computational issues uint256 private constant MINIMUM_SHARE_BALANCE = 1000; /// @notice Tracks total rebase information for each token /// @dev Maps token address to its total rebase state mapping(IERC20Custom => Rebase) public totals; /// @notice Tracks individual account balances for each token /// @dev Nested mapping: token address → account address → share balance mapping(IERC20Custom => mapping(address => uint256)) public balanceOf; /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted when tokens are deposited into the vault event Deposited( IERC20Custom indexed token, address indexed from, address indexed to, uint256 amount, uint256 share ); /// @notice Emitted when tokens are withdrawn from the vault event Withdrawn( IERC20Custom indexed token, address indexed from, address indexed to, uint256 amount, uint256 share ); /// @notice Emitted when shares are transferred between accounts event Transferred( IERC20Custom indexed token, address indexed from, address indexed to, uint256 share ); /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ /// @notice Thrown when an operation would result in an empty vault error CannotBeEmpty(); /// @notice Thrown when an invalid skim operation is attempted error InvalidSkim(); /// @notice Thrown when an unauthorized account attempts an action error NotAllowed(address msgSender, address from); /// @notice Thrown when no tokens are available for an operation error NoTokens(); /// @notice Thrown when a receiver address is not set error ReceiverNotSet(); /*////////////////////////////////////////////////////////////// ACCESS CONTROL //////////////////////////////////////////////////////////////*/ /// @notice Restricts actions to authorized accounts /// @dev Allows actions from: /// · The account itself /// · The vault contract /// · Authorized controllers modifier allowed(address from) { if ( from != _msgSender() && from != address(this) && !isController(_msgSender()) ) { revert NotAllowed(_msgSender(), from); } _; } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ /// @notice Initializes the vault with default configuration constructor() { _configure(); } /*////////////////////////////////////////////////////////////// DEPOSIT MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Deposits tokens into the vault * @param token_ Token to deposit * @param from Source address of tokens * @param to Recipient address for shares * @param amount Amount of tokens to deposit * @param share Optional share amount to deposit * * @dev Flexible deposit mechanism supporting: * · Automatic share calculation * · Minimum share balance enforcement * · Skim and direct deposit modes * * Requirements: * · Non-zero receiver address * · Valid token and amount * · Sufficient token balance * * Effects: * · Updates share and total balances * · Transfers tokens to vault * · Emits Deposited event */ function deposit( IERC20Custom token_, address from, address to, uint256 amount, uint256 share ) external nonReentrant allowed(from) returns (uint256 amountIn, uint256 shareIn) { if (to == address(0)) revert ReceiverNotSet(); IERC20Custom token = token_; _onBeforeDeposit(token, from, to, amount, share); Rebase memory total = totals[token]; if (total.elastic == 0 && token.totalSupply() == 0) revert NoTokens(); if (share == 0) { share = total.toBase(amount, false); if (total.base + share < MINIMUM_SHARE_BALANCE) { return (0, 0); } } else { amount = total.toElastic(share, true); } if ( from == address(this) && amount > _tokenBalanceOf(token) - total.elastic ) { revert InvalidSkim(); } balanceOf[token][to] += share; total.base += share; total.elastic += amount; totals[token] = total; // Only transfer if the source is not the vault itself if (from != address(this)) { SafeERC20.safeTransferFrom( IERC20Safe(address(token)), from, address(this), amount ); } emit Deposited(token, from, to, amount, share); return (amount, share); } /*////////////////////////////////////////////////////////////// WITHDRAWAL MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Withdraws tokens from the vault * @param token_ Token to withdraw * @param from Source address of shares * @param to Recipient address for tokens * @param amount Optional token amount to withdraw * @param share Share amount to withdraw * * @dev Flexible withdrawal mechanism supporting: * · Automatic amount calculation * · Minimum share balance preservation * * Requirements: * · Non-zero receiver address * · Sufficient share balance * · Maintains minimum share balance * * Effects: * · Updates share and total balances * · Transfers tokens from vault * · Emits Withdrawn event */ function withdraw( IERC20Custom token_, address from, address to, uint256 amount, uint256 share ) external nonReentrant allowed(from) returns (uint256 amountOut, uint256 shareOut) { if (to == address(0)) revert ReceiverNotSet(); IERC20Custom token = token_; Rebase memory total = totals[token]; if (share == 0) { share = total.toBase(amount, true); } else { amount = total.toElastic(share, false); } balanceOf[token][from] -= share; total.elastic -= amount; total.base -= share; if (total.base > 0 && total.base < MINIMUM_SHARE_BALANCE) { revert CannotBeEmpty(); } totals[token] = total; SafeERC20.safeTransfer(IERC20Safe(address(token)), to, amount); emit Withdrawn(token, from, to, amount, share); return (amount, share); } /*////////////////////////////////////////////////////////////// TRANSFER MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Transfers shares between addresses * @param token Token to transfer * @param from Source address * @param to Recipient address * @param share Share amount to transfer * * @dev Allows direct share transfers with: * · Access control * · Zero-address prevention * * Requirements: * · Sufficient share balance * · Non-zero receiver address * * Effects: * · Updates account balances * · Emits Transferred event */ function transfer( IERC20Custom token, address from, address to, uint256 share ) external nonReentrant allowed(from) { if (to == address(0)) revert ReceiverNotSet(); balanceOf[token][from] -= share; balanceOf[token][to] += share; emit Transferred(token, from, to, share); } /** * @notice Transfers shares to multiple recipients * @param token Token to transfer * @param from Source address * @param tos Recipient addresses * @param shares Share amounts to transfer * * @dev Batch transfer mechanism supporting: * · Multiple recipient transfers * · Efficient share distribution * * Requirements: * · Sufficient total share balance * · Non-zero first receiver address * * Effects: * · Updates multiple account balances * · Emits multiple Transferred events */ function transferMultiple( IERC20Custom token, address from, address[] calldata tos, uint256[] calldata shares ) external nonReentrant allowed(from) { if (tos[0] == address(0)) revert ReceiverNotSet(); uint256 totalAmount; uint256 len = tos.length; for (uint256 i; i < len; i++) { address to = tos[i]; balanceOf[token][to] += shares[i]; totalAmount += shares[i]; emit Transferred(token, from, to, shares[i]); } balanceOf[token][from] -= totalAmount; } /*////////////////////////////////////////////////////////////// CONVERSION UTILITIES //////////////////////////////////////////////////////////////*/ /** * @notice Converts token amount to shares * @param token Token to convert * @param amount Token amount to convert * @param roundUp Whether to round up the share calculation * @return share Calculated share amount * * @dev Precise share calculation based on current rebase state */ function toShare( IERC20Custom token, uint256 amount, bool roundUp ) external view returns (uint256 share) { share = totals[token].toBase(amount, roundUp); } /** * @notice Converts shares to token amount * @param token Token to convert * @param share Share amount to convert * @param roundUp Whether to round up the amount calculation * @return amount Calculated token amount * * @dev Precise amount calculation based on current rebase state */ function toAmount( IERC20Custom token, uint256 share, bool roundUp ) external view returns (uint256 amount) { amount = totals[token].toElastic(share, roundUp); } /*////////////////////////////////////////////////////////////// PRIVATE CONFIGURATION HOOKS //////////////////////////////////////////////////////////////*/ /// @notice Optional configuration method for derived contracts function _configure() internal virtual {} /// @notice Optional pre-deposit hook for derived contracts function _onBeforeDeposit( IERC20Custom token, address from, address to, uint256 amount, uint256 share ) internal virtual {} /// @notice Gets the current token balance of the vault function _tokenBalanceOf( IERC20Custom token ) private view returns (uint256 amount) { amount = token.balanceOf(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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 { /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @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. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title Context * @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, as 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). * @notice This contract is used through inheritance. It will make available the * modifier `_msgSender()`, which can be used to reference the account that * called a function within an implementing contract. */ abstract contract Context { /*////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Gets the sender of the current call * @dev Provides a way to retrieve the message sender that supports meta-transactions * @return Sender address (msg.sender in the base implementation) */ function _msgSender() internal view virtual returns (address) { return msg.sender; } /** * @notice Gets the complete calldata of the current call * @dev Provides a way to retrieve the message data that supports meta-transactions * @return Complete calldata bytes */ function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @notice Gets the length of any context-specific suffix in the message data * @dev Used in meta-transaction implementations to account for additional data * @return Length of the context suffix (0 in the base implementation) */ function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Ownable} from "./Ownable.sol"; /** * @title Controller * @dev Contract module that extends Ownable to provide a more flexible authorization * system where multiple addresses can be granted controller privileges. * @notice This allows for a multi-admin setup where both the owner and authorized * controllers can execute protected functions. The owner maintains the ability to * add or remove controllers. */ abstract contract Controller is Ownable { /*////////////////////////////////////////////////////////////// STATE VARIABLES //////////////////////////////////////////////////////////////*/ /// @notice Mapping of addresses to their controller status mapping(address => bool) public controllers; /// @notice Number of active controllers (excluding owner) uint256 private _numControllers; /// @notice Array of controller addresses address[] private _controllerList; /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted when a new controller is authorized event ControllerAdded(address indexed controller); /// @notice Emitted when a controller's authorization is revoked event ControllerRemoved(address indexed controller); /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ /// @notice Thrown when a non-controller tries to access a protected function error SignerIsNotController(); /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ /** * @notice Restricts function access to authorized controllers and owner * @dev Reverts with SignerIsNotController if caller lacks authorization */ modifier onlyController() { if (!isController(_msgSender())) { revert SignerIsNotController(); } _; } /*////////////////////////////////////////////////////////////// PUBLIC FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Adds a new controller * @dev Only the owner can add new controllers * @param controller Address to be granted controller privileges */ function addController(address controller) external onlyOwner { if (!controllers[controller] && controller != owner()) { controllers[controller] = true; _numControllers++; _controllerList.push(controller); emit ControllerAdded(controller); } } /** * @notice Removes a controller * @dev Only the owner can remove controllers * @param controller Address to have controller privileges revoked */ function removeController(address controller) external onlyOwner { if (controllers[controller]) { controllers[controller] = false; uint256 length = _controllerList.length; for (uint256 i = 0; i < length; i++) { if (_controllerList[i] == controller) { _controllerList[i] = _controllerList[length - 1]; _controllerList.pop(); break; } } _numControllers--; emit ControllerRemoved(controller); } } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Checks if an address has controller privileges * @dev Returns true if the address is either the owner or an authorized controller * @param controller Address to check for authorization * @return True if the address has controller privileges */ function isController(address controller) public view returns (bool) { return controller == owner() || controllers[controller]; } /** * @notice Gets the number of controllers excluding the owner * @return The number of active controllers (excluding owner) */ function numControllers() public view returns (uint256) { return _numControllers; } /** * @notice Gets the list of active controllers * @return Array of controller addresses */ function getControllers() public view virtual returns (address[] memory) { return _controllerList; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; import {Context} from "./Context.sol"; /** * @title Ownable * @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. * @notice By default, the owner account will be the one that deploys the contract. * This can later be changed with {transferOwnership} and {renounceOwnership}. */ abstract contract Ownable is Context { /*////////////////////////////////////////////////////////////// STATE VARIABLES //////////////////////////////////////////////////////////////*/ /// @notice Address of the current owner address private _owner; /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted when ownership is transferred event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ /// @notice Thrown when non-owner tries to call owner-only function error UnauthorizedAccount(address account); /// @notice Thrown when trying to transfer ownership to invalid address error InvalidOwner(address owner); /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ /** * @dev Throws if called by any account other than the owner */ modifier onlyOwner() { _checkOwner(); _; } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ /** * @dev Initializes the contract setting the deployer as the initial owner */ constructor() { _transferOwnership(_msgSender()); } /*////////////////////////////////////////////////////////////// PUBLIC FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Leaves the contract without owner * @dev Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @notice Transfers ownership of the contract to a new account * @dev The new owner cannot be the zero address * @param newOwner The address that will become the new owner */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert InvalidOwner(address(0)); } _transferOwnership(newOwner); } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns the address of the current owner * @return Current owner address */ function owner() public view virtual returns (address) { return _owner; } /*////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @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); } /** * @dev Throws if the sender is not the owner */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert UnauthorizedAccount(_msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title ReentrancyGuard * @dev Contract module that helps prevent reentrant calls to a function * @notice This module is used through inheritance. It will make available the modifier * `nonReentrant`, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. */ abstract contract ReentrancyGuard { /*////////////////////////////////////////////////////////////// STATE VARIABLES //////////////////////////////////////////////////////////////*/ /// @notice Guard state constants uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @notice Current state of the guard uint256 private _status; /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ error ReentrantCall(); /*////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ /** * @notice Initializes the contract by setting the initial reentrancy guard state */ constructor() { _status = NOT_ENTERED; } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Checks if a protected function is currently executing * @return True if the contract is in the entered state */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } /*////////////////////////////////////////////////////////////// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @dev Sets guard state before protected function execution * @notice Reverts if a reentrant call is detected */ function _nonReentrantBefore() private { if (_status == ENTERED) { revert ReentrantCall(); } _status = ENTERED; } /** * @dev Resets guard state after protected function execution */ function _nonReentrantAfter() private { _status = NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title IERC20Custom * @dev Interface for the ERC20 fungible token standard (EIP-20) * @notice Defines functionality for: * 1. Token transfers * 2. Allowance management * 3. Balance tracking * 4. Token metadata */ interface IERC20Custom { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /** * @dev Emitted on token transfer between addresses * @param from Source address (0x0 for mints) * @param to Destination address (0x0 for burns) * @param value Amount of tokens transferred * @notice Tracks: * · Regular transfers * · Minting operations * · Burning operations */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when spending allowance is granted * @param owner Address granting permission * @param spender Address receiving permission * @param value Amount of tokens approved * @notice Records: * · New approvals * · Updated allowances * · Revoked permissions */ event Approval( address indexed owner, address indexed spender, uint256 value ); /*////////////////////////////////////////////////////////////// TRANSFER OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Transfers tokens to specified recipient * @param to Recipient address * @param value Amount to transfer in base units * @return bool True if transfer succeeds * @dev Requirements: * · Caller has sufficient balance * · Recipient is valid * · Amount > 0 * * Effects: * · Decreases caller balance * · Increases recipient balance * · Emits Transfer event */ function transfer(address to, uint256 value) external returns (bool); /** * @notice Executes transfer on behalf of token owner * @param from Source address * @param to Destination address * @param value Amount to transfer in base units * @return bool True if transfer succeeds * @dev Requirements: * · Caller has sufficient allowance * · Source has sufficient balance * · Valid addresses * * Effects: * · Decreases allowance * · Updates balances * · Emits Transfer event */ function transferFrom( address from, address to, uint256 value ) external returns (bool); /*////////////////////////////////////////////////////////////// APPROVAL OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Authorizes address to spend tokens * @param spender Address to authorize * @param value Amount to authorize in base units * @return bool True if approval succeeds * @dev Controls: * · Spending permissions * · Delegation limits * · Authorization levels * * Security: * · Overwrites previous allowance * · Requires explicit value * · Emits Approval event */ function approve(address spender, uint256 value) external returns (bool); /*////////////////////////////////////////////////////////////// TOKEN METADATA //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves human-readable token name * @return string Full token name */ function name() external view returns (string memory); /** * @notice Retrieves token trading symbol * @return string Short token identifier */ function symbol() external view returns (string memory); /** * @notice Retrieves token decimal precision * @return uint8 Number of decimal places * @dev Standard: * · 18 for most tokens * · Used for display formatting */ function decimals() external view returns (uint8); /*////////////////////////////////////////////////////////////// BALANCE QUERIES //////////////////////////////////////////////////////////////*/ /** * @notice Retrieves total token supply * @return uint256 Current total supply * @dev Reflects: * · All minted tokens * · Minus burned tokens * · In base units */ function totalSupply() external view returns (uint256); /** * @notice Retrieves account token balance * @param account Address to query * @return uint256 Current balance in base units * @dev Returns: * · Available balance * · Includes pending rewards * · Excludes locked tokens */ function balanceOf(address account) external view returns (uint256); /** * @notice Retrieves remaining spending allowance * @param owner Token owner address * @param spender Authorized spender address * @return uint256 Current allowance in base units * @dev Shows: * · Approved amount * · Remaining limit * · Delegation status */ function allowance( address owner, address spender ) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.24 <0.9.0; /** * @title Rebase Library * @dev Library for handling elastic supply token calculations and adjustments * @notice This library provides mathematical operations for elastic/base token conversions * and supply adjustments. It handles two key concepts: * * 1. Elastic Supply: The actual total supply that can expand or contract * 2. Base Supply: The underlying base amount that remains constant */ /*////////////////////////////////////////////////////////////// TYPES //////////////////////////////////////////////////////////////*/ /** * @dev Core data structure for elastic supply tracking * @param elastic Current elastic (rebased) supply * @param base Current base (non-rebased) supply */ struct Rebase { uint256 elastic; uint256 base; } /** * @title AuxRebase * @dev Auxiliary functions for elastic supply calculations * @notice Provides safe mathematical operations for elastic/base conversions * with optional rounding control */ library AuxRebase { /*////////////////////////////////////////////////////////////// ELASTIC SUPPLY OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Increases the elastic supply * @param total Current total supply state * @param elastic Amount to add to elastic supply * @return newElastic Updated elastic supply after addition */ function addElastic( Rebase storage total, uint256 elastic ) internal returns (uint256 newElastic) { newElastic = total.elastic += elastic; } /** * @notice Decreases the elastic supply * @param total Current total supply state * @param elastic Amount to subtract from elastic supply * @return newElastic Updated elastic supply after subtraction */ function subElastic( Rebase storage total, uint256 elastic ) internal returns (uint256 newElastic) { newElastic = total.elastic -= elastic; } /*////////////////////////////////////////////////////////////// CONVERSION OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Converts an elastic amount to its base amount * @param total Current total supply state * @param elastic Amount of elastic tokens to convert * @param roundUp If true, rounds up the result * @return base Equivalent amount in base units * @dev * · If elastic supply is 0, returns elastic amount as base * · Handles potential precision loss during conversion * · Rounding can cause slight variations in converted amounts * · Recommended for scenarios requiring precise supply tracking * * Rounding Behavior: * · roundUp = false: Always rounds down (truncates) * · roundUp = true: Rounds up if there's a fractional remainder * * Edge Cases: * · total.elastic == 0: Returns input elastic as base * · Potential for minimal precision differences */ function toBase( Rebase memory total, uint256 elastic, bool roundUp ) internal pure returns (uint256 base) { if (total.elastic == 0) { base = elastic; } else { base = (elastic * total.base) / total.elastic; if (roundUp && (base * total.elastic) / total.base < elastic) { base++; } } } /** * @notice Converts a base amount to its elastic amount * @param total Current total supply state * @param base Amount of base tokens to convert * @param roundUp If true, rounds up the result * @return elastic Equivalent amount in elastic units * @dev * · If base supply is 0, returns base amount as elastic * · Handles potential precision loss during conversion * · Rounding can cause slight variations in converted amounts * · Recommended for scenarios requiring precise supply tracking * * Rounding Behavior: * · roundUp = false: Always rounds down (truncates) * · roundUp = true: Rounds up if there's a fractional remainder * * Edge Cases: * · total.base == 0: Returns input base as elastic * · Potential for minimal precision differences */ function toElastic( Rebase memory total, uint256 base, bool roundUp ) internal pure returns (uint256 elastic) { if (total.base == 0) { elastic = base; } else { elastic = (base * total.elastic) / total.base; if (roundUp && (elastic * total.base) / total.elastic < base) { elastic++; } } } /*////////////////////////////////////////////////////////////// COMBINED OPERATIONS //////////////////////////////////////////////////////////////*/ /** * @notice Adds elastic tokens and calculates corresponding base amount * @param total Current total supply state * @param elastic Amount of elastic tokens to add * @param roundUp If true, rounds up base conversion * @return (Rebase, uint256) Updated total supply and calculated base amount */ function add( Rebase memory total, uint256 elastic, bool roundUp ) internal pure returns (Rebase memory, uint256 base) { base = toBase(total, elastic, roundUp); total.elastic += elastic; total.base += base; return (total, base); } /** * @notice Subtracts base tokens and calculates corresponding elastic amount * @param total Current total supply state * @param base Amount of base tokens to subtract * @param roundUp If true, rounds up elastic conversion * @return (Rebase, uint256) Updated total supply and calculated elastic amount */ function sub( Rebase memory total, uint256 base, bool roundUp ) internal pure returns (Rebase memory, uint256 elastic) { elastic = toElastic(total, base, roundUp); total.elastic -= elastic; total.base -= base; return (total, elastic); } /** * @notice Adds specific amounts to both elastic and base supplies * @param total Current total supply state * @param elastic Amount of elastic tokens to add * @param base Amount of base tokens to add * @return Rebase Updated total supply after addition */ function add( Rebase memory total, uint256 elastic, uint256 base ) internal pure returns (Rebase memory) { total.elastic += elastic; total.base += base; return total; } /** * @notice Subtracts specific amounts from both elastic and base supplies * @param total Current total supply state * @param elastic Amount of elastic tokens to subtract * @param base Amount of base tokens to subtract * @return Rebase Updated total supply after subtraction */ function sub( Rebase memory total, uint256 elastic, uint256 base ) internal pure returns (Rebase memory) { total.elastic -= elastic; total.base -= base; return total; } }
{ "viaIR": true, "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotBeEmpty","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidSkim","type":"error"},{"inputs":[],"name":"NoTokens","type":"error"},{"inputs":[{"internalType":"address","name":"msgSender","type":"address"},{"internalType":"address","name":"from","type":"address"}],"name":"NotAllowed","type":"error"},{"inputs":[],"name":"ReceiverNotSet","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SignerIsNotController","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"UnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"ControllerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"controller","type":"address"}],"name":"ControllerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Custom","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Deposited","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":true,"internalType":"contract IERC20Custom","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Transferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Custom","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"addController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"controllers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"token_","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"share","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"shareIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getControllers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"isController","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numControllers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"removeController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"token","type":"address"},{"internalType":"uint256","name":"share","type":"uint256"},{"internalType":"bool","name":"roundUp","type":"bool"}],"name":"toAmount","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"roundUp","type":"bool"}],"name":"toShare","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"","type":"address"}],"name":"totals","outputs":[{"internalType":"uint256","name":"elastic","type":"uint256"},{"internalType":"uint256","name":"base","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"token","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"share","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"token","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address[]","name":"tos","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"name":"transferMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Custom","name":"token_","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"share","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"shareOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052346200002d57620000146200003e565b6200001e62000033565b6127ca6200028182396127ca90f35b62000039565b60405190565b600080fd5b62000048620000ee565b565b90565b90565b90565b6200006c6200006662000072926200004a565b62000050565b6200004d565b90565b62000081600162000053565b90565b60001b90565b90620000996000199162000084565b9181191691161790565b620000bc620000b6620000c2926200004d565b62000050565b6200004d565b90565b90565b90620000e2620000dc620000ea92620000a3565b620000c5565b82546200008a565b9055565b620000f862000110565b6200010e6200010662000075565b6004620000c8565b565b6200011a6200011c565b565b620001306200012a62000137565b62000213565b565b600090565b6200014162000132565b503390565b60001c90565b60018060a01b031690565b620001666200016c9162000146565b6200014c565b90565b6200017b905462000157565b90565b906200019160018060a01b039162000084565b9181191691161790565b60018060a01b031690565b620001bf620001b9620001c5926200019b565b62000050565b6200019b565b90565b620001d390620001a6565b90565b620001e190620001c8565b90565b90565b9062000201620001fb6200020992620001d6565b620001e4565b82546200017e565b9055565b60000190565b6200021f60006200016f565b6200022c826000620001e7565b90620002646200025d7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093620001d6565b91620001d6565b916200026f62000033565b806200027b816200020d565b0390a356fe60806040526004361015610013575b610ab9565b61001e60003561012d565b806302b9446c146101285780630fca8843146101235780634ffe34db1461011e5780635662311814610119578063715018a6146101145780638da5cb5b1461010f57806397da6d301461010a578063a5b1d7fe14610105578063a7fc7a0714610100578063b429afeb146100fb578063b4e8a6c4146100f6578063da5139ca146100f1578063da8c229e146100ec578063f18d03cc146100e7578063f2fde38b146100e2578063f6a74ed7146100dd5763f7888aec0361000e57610a83565b6109aa565b610977565b610940565b6108c4565b610814565b6107df565b610709565b6106b3565b61065f565b610625565b6105f0565b61059a565b610554565b6104a4565b6103ab565b610262565b60e01c90565b60405190565b600080fd5b600080fd5b600080fd5b60018060a01b031690565b61015c90610148565b90565b61016890610153565b90565b6101748161015f565b0361017b57565b600080fd5b9050359061018d8261016b565b565b61019881610153565b0361019f57565b600080fd5b905035906101b18261018f565b565b90565b6101bf816101b3565b036101c657565b600080fd5b905035906101d8826101b6565b565b919060a08382031261022c576101f38160008501610180565b9261020182602083016101a4565b9261022961021284604085016101a4565b9361022081606086016101cb565b936080016101cb565b90565b61013e565b61023a906101b3565b9052565b91602061026092949361025960408201966000830190610231565b0190610231565b565b346102975761027e6102753660046101da565b939290926111fa565b9061029361028a610133565b9283928361023e565b0390f35b610139565b600080fd5b600080fd5b600080fd5b909182601f830112156102e55781359167ffffffffffffffff83116102e05760200192602083028401116102db57565b6102a6565b6102a1565b61029c565b909182601f830112156103245781359167ffffffffffffffff831161031f57602001926020830284011161031a57565b6102a6565b6102a1565b61029c565b91906080838203126103a0576103428160008501610180565b9261035082602083016101a4565b92604082013567ffffffffffffffff811161039b57836103719184016102ab565b929093606082013567ffffffffffffffff81116103965761039292016102ea565b9091565b610143565b610143565b61013e565b60000190565b346103e0576103ca6103be366004610329565b94939093929192611530565b6103d2610133565b806103dc816103a5565b0390f35b610139565b906020828203126103ff576103fc91600001610180565b90565b61013e565b90565b61041b61041661042092610148565b610404565b610148565b90565b61042c90610407565b90565b61043890610423565b90565b906104459061042f565b600052602052604060002090565b60001c90565b90565b61046861046d91610453565b610459565b90565b61047a905461045c565b90565b61048890600561043b565b906104a1600161049a60008501610470565b9301610470565b90565b346104d5576104bc6104b73660046103e5565b61047d565b906104d16104c8610133565b9283928361023e565b0390f35b610139565b151590565b6104e8816104da565b036104ef57565b600080fd5b90503590610501826104df565b565b90916060828403126105395761053661051f8460008501610180565b9361052d81602086016101cb565b936040016104f4565b90565b61013e565b919061055290600060208501940190610231565b565b346105855761058161057061056a366004610503565b91611540565b610578610133565b9182918261053e565b0390f35b610139565b600091031261059557565b61013e565b346105c8576105aa36600461058a565b6105b2611591565b6105ba610133565b806105c4816103a5565b0390f35b610139565b6105d690610153565b9052565b91906105ee906000602085019401906105cd565b565b346106205761060036600461058a565b61061c61060b6115cc565b610613610133565b918291826105da565b0390f35b610139565b3461065a576106416106383660046101da565b939290926118d4565b9061065661064d610133565b9283928361023e565b0390f35b610139565b3461068f5761066f36600461058a565b61068b61067a6118f6565b610682610133565b9182918261053e565b0390f35b610139565b906020828203126106ae576106ab916000016101a4565b90565b61013e565b346106e1576106cb6106c6366004610694565b611b3e565b6106d3610133565b806106dd816103a5565b0390f35b610139565b6106ef906104da565b9052565b9190610707906000602085019401906106e6565b565b346107395761073561072461071f366004610694565b611b4e565b61072c610133565b918291826106f3565b0390f35b610139565b5190565b60209181520190565b60200190565b61075a90610153565b9052565b9061076b81602093610751565b0190565b60200190565b9061079261078c6107858461073e565b8093610742565b9261074b565b9060005b8181106107a35750505090565b9091926107bc6107b6600192865161075e565b9461076f565b9101919091610796565b6107dc9160208201916000818403910152610775565b90565b3461080f576107ef36600461058a565b61080b6107fa611c5c565b610802610133565b918291826107c6565b0390f35b610139565b346108455761084161083061082a366004610503565b91611c72565b610838610133565b9182918261053e565b0390f35b610139565b61085390610407565b90565b61085f9061084a565b90565b9061086c90610856565b600052602052604060002090565b1c90565b60ff1690565b610894906008610899930261087a565b61087e565b90565b906108a79154610884565b90565b6108c1906108bc600191600092610862565b61089c565b90565b346108f4576108f06108df6108da366004610694565b6108aa565b6108e7610133565b918291826106f3565b0390f35b610139565b60808183031261093b576109108260008301610180565b9261093861092184602085016101a4565b9361092f81604086016101a4565b936060016101cb565b90565b61013e565b346109725761095c6109533660046108f9565b92919091611e70565b610964610133565b8061096e816103a5565b0390f35b610139565b346109a55761098f61098a366004610694565b611eec565b610997610133565b806109a1816103a5565b0390f35b610139565b346109d8576109c26109bd366004610694565b612144565b6109ca610133565b806109d4816103a5565b0390f35b610139565b9190604083820312610a0657806109fa610a039260008601610180565b936020016101a4565b90565b61013e565b90610a159061042f565b600052602052604060002090565b90610a2d90610856565b600052602052604060002090565b610a4b906008610a50930261087a565b610459565b90565b90610a5e9154610a3b565b90565b610a7b610a8092610a76600693600094610a0b565b610a23565b610a53565b90565b34610ab457610ab0610a9f610a993660046109dd565b90610a61565b610aa7610133565b9182918261053e565b0390f35b610139565b600080fd5b600090565b90610ada969594939291610ad561217b565b610b16565b9091610ae46121e7565b565b610aef9061084a565b90565b916020610b14929493610b0d604082019660008301906105cd565b01906105cd565b565b96959493929190829788610b39610b33610b2e6121fb565b610153565b91610153565b141580610ba7575b80610b88575b610b5a57610b56979850610e71565b9091565b88610b636121fb565b610b84610b6e610133565b928392630272d02960e61b845260048401610af2565b0390fd5b50610ba2610b9c610b976121fb565b611b4e565b156104da565b610b47565b5088610bc3610bbd610bb830610ae6565b610153565b91610153565b1415610b41565b90565b610be1610bdc610be692610bca565b610404565b610148565b90565b610bf290610bcd565b90565b90610bff906101b3565b9052565b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90610c2d90610c03565b810190811067ffffffffffffffff821117610c4757604052565b610c0d565b90610c5f610c58610133565b9283610c23565b565b610c6b6040610c4c565b90565b90610ca7610c9e6001610c7f610c61565b94610c98610c8f60008301610470565b60008801610bf5565b01610470565b60208401610bf5565b565b610cb290610c6e565b90565b610cbf90516101b3565b90565b610cd6610cd1610cdb92610bca565b610404565b6101b3565b90565b610ce79061084a565b90565b60e01b90565b90505190610cfd826101b6565b565b90602082820312610d1957610d1691600001610cf0565b90565b61013e565b610d26610133565b3d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b610d54610d5a919392936101b3565b926101b3565b8201809211610d6557565b610d2f565b90565b610d81610d7c610d8692610d6a565b610404565b6101b3565b90565b610d946103e8610d6d565b90565b610da6610dac919392936101b3565b926101b3565b8203918211610db757565b610d2f565b60001b90565b90610dcf60001991610dbc565b9181191691161790565b610ded610de8610df2926101b3565b610404565b6101b3565b90565b90565b90610e0d610e08610e1492610dd9565b610df5565b8254610dc2565b9055565b90610e4560206001610e4b94610e3d60008201610e3760008801610cb5565b90610df8565b019201610cb5565b90610df8565b565b90610e5791610e18565b565b610e6290610407565b90565b610e6e90610e59565b90565b969596939293505081610e95610e8f610e8a6000610be9565b610153565b91610153565b146111d757610eae610ea96005839061043b565b610ca9565b95610ebb60008801610cb5565b610ece610ec86000610cc2565b916101b3565b1480611142575b61111f5780610eed610ee76000610cc2565b916101b3565b146000146111095750610f038685600091612349565b95610f1a610f1360208301610cb5565b8890610d45565b610f33610f2d610f28610d89565b6101b3565b916101b3565b106110e8575b83610f54610f4e610f4930610ae6565b610153565b91610153565b14806110b1575b61108e57610fe690610f9588610f8f610f80610f7960068890610a0b565b8890610a23565b91610f8a83610470565b610d45565b90610df8565b610fb588610faf6020840191610faa83610cb5565b610d45565b90610bf5565b610fd586610fcf6000840191610fca83610cb5565b610d45565b90610bf5565b610fe16005849061043b565b610e4d565b82611001610ffb610ff630610ae6565b610153565b91610153565b03611063575b9183928661104761104161103b7fb045190548dadae679cfe9e337437613ca6dd73efdf984f75e56f152ccee22f09461042f565b94610856565b94610856565b9461105c611053610133565b9283928361023e565b0390a49190565b61108961107761107283610cde565b610e65565b8461108130610ae6565b908792612520565b611007565b611096610133565b633551b94d60e01b8152806110ad600482016103a5565b0390fd5b50846110e26110dc6110d76110c58661241d565b6110d160008701610cb5565b90610d97565b6101b3565b916101b3565b11610f5b565b50505050509050600090611106611100600093610cc2565b92610cc2565b90565b9593506111198487600191612275565b93610f39565b611127610133565b63df95788360e01b81528061113e600482016103a5565b0390fd5b50611167602061115184610cde565b6318160ddd9061115f610133565b938492610cea565b82528180611177600482016103a5565b03915afa9081156111d2576000916111a4575b5061119e6111986000610cc2565b916101b3565b14610ed5565b6111c5915060203d81116111cb575b6111bd8183610c23565b810190610cff565b3861118a565b503d6111b3565b610d1e565b6111df610133565b6310c3a82760e21b8152806111f6600482016103a5565b0390fd5b906112189493929161120a610abe565b611212610abe565b90610ac3565b9091565b90611232959493929161122d61217b565b61123c565b61123a6121e7565b565b95949392919080968761125e6112586112536121fb565b610153565b91610153565b1415806112ca575b806112ab575b61127d5761127b96975061135a565b565b876112866121fb565b6112a7611291610133565b928392630272d02960e61b845260048401610af2565b0390fd5b506112c56112bf6112ba6121fb565b611b4e565b156104da565b61126c565b50876112e66112e06112db30610ae6565b610153565b91610153565b1415611266565b634e487b7160e01b600052603260045260246000fd5b9190811015611313576020020190565b6112ed565b356113228161018f565b90565b5090565b600161133591016101b3565b90565b9190811015611348576020020190565b6112ed565b35611357816101b6565b90565b90939295949561137d61137884836113726000610cc2565b91611303565b611318565b61139861139261138d6000610be9565b610153565b91610153565b1461150d576113a5610abe565b926113b1818390611325565b966113ba610abe565b5b806113ce6113c88b6101b3565b916101b3565b10156114d257828482906113e192611303565b6113ea90611318565b95878b83906113f892611338565b6114019061134d565b60068761140d91610a0b565b8861141791610a23565b9061142182610470565b9061142b91610d45565b61143491610df8565b878b839061144192611338565b61144a9061134d565b61145391610d45565b95859089898d859061146492611338565b61146d9061134d565b927f769254a71d2f67d8ac6cb44f2803c0d05cfbcf9effadb6a984f10ff9de3df6c3906114999061042f565b916114a390610856565b926114ad90610856565b936114b6610133565b6114c181928261053e565b0390a46114cd90611329565b6113bb565b50975050509261150b945061150592506114f16114f692946006610a0b565b610a23565b9161150083610470565b610d97565b90610df8565b565b611515610133565b6310c3a82760e21b81528061152c600482016103a5565b0390fd5b9061153e959493929161121c565b565b9161156061155b61156894611553610abe565b50600561043b565b610ca9565b919091612275565b90565b611573612570565b61157b61157d565b565b61158f61158a6000610be9565b612600565b565b61159961156b565b565b600090565b60018060a01b031690565b6115b76115bc91610453565b6115a0565b90565b6115c990546115ab565b90565b6115d461159b565b506115df60006115bf565b90565b906115f99695949392916115f461217b565b611605565b90916116036121e7565b565b9695949392919082978861162861162261161d6121fb565b610153565b91610153565b141580611696575b80611677575b611649576116459798506116b9565b9091565b886116526121fb565b61167361165d610133565b928392630272d02960e61b845260048401610af2565b0390fd5b5061169161168b6116866121fb565b611b4e565b156104da565b611636565b50886116b26116ac6116a730610ae6565b610153565b91610153565b1415611630565b9695969392935050816116dd6116d76116d26000610be9565b610153565b91610153565b146118b1576116f66116f16005839061043b565b610ca9565b958061170b6117056000610cc2565b916101b3565b1460001461189b57506117218685600191612349565b955b6117558761174f61174061173960068790610a0b565b8890610a23565b9161174a83610470565b610d97565b90610df8565b6117758561176f600084019161176a83610cb5565b610d97565b90610bf5565b6117958761178f602084019161178a83610cb5565b610d97565b90610bf5565b6117a160208201610cb5565b6117b46117ae6000610cc2565b916101b3565b118061186f575b61184c576117d4906117cf6005849061043b565b610e4d565b6117f06117e86117e383610cde565b610e65565b838691612685565b9183928661183061182a6118247f144f5f62c08d623a6f383205dc8d5ef825b693748e2977846e18121b6780413a9461042f565b94610856565b94610856565b9461184561183c610133565b9283928361023e565b0390a49190565b611854610133565b6385b2711f60e01b81528061186b600482016103a5565b0390fd5b5061187c60208201610cb5565b61189561188f61188a610d89565b6101b3565b916101b3565b106117bb565b9593506118ab8487600091612275565b93611723565b6118b9610133565b6310c3a82760e21b8152806118d0600482016103a5565b0390fd5b906118f2949392916118e4610abe565b6118ec610abe565b906115e2565b9091565b6118fe610abe565b506119096002610470565b90565b61191d90611918612570565b611a65565b565b61192b61193091610453565b61087e565b90565b61193d905461191f565b90565b9061194c60ff91610dbc565b9181191691161790565b61195f906104da565b90565b90565b9061197a61197561198192611956565b611962565b8254611940565b9055565b61198e906101b3565b600019811461199d5760010190565b610d2f565b90565b600052602060002090565b5490565b6119bd816119b0565b8210156119d8576119cf6001916119a5565b91020190600090565b6112ed565b1b90565b91906008611a019102916119fb60018060a01b03846119dd565b926119dd565b9181191691161790565b90565b9190611a24611a1f611a2c93610856565b611a0b565b9083546119e1565b9055565b9081549168010000000000000000831015611a605782611a58916001611a5e950181556119b4565b90611a0e565b565b610c0d565b611a82611a7c611a7760018490610862565b611933565b156104da565b80611b1c575b611a90575b50565b611aa66001611aa160018490610862565b611965565b611ac2611abb611ab66002610470565b611985565b6002610df8565b611ad6611acf60036119a2565b8290611a30565b611b007f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d747491610856565b90611b09610133565b80611b13816103a5565b0390a238611a8d565b5080611b37611b31611b2c6115cc565b610153565b91610153565b1415611a88565b611b479061190c565b565b600090565b611b56611b49565b5080611b71611b6b611b666115cc565b610153565b91610153565b14908115611b7e575b5090565b611b939150611b8e906001610862565b611933565b38611b7a565b606090565b5490565b60209181520190565b600052602060002090565b611bc090546115ab565b90565b60010190565b90611be6611be0611bd984611b9e565b8093611ba2565b92611bab565b9060005b818110611bf75750505090565b909192611c17611c11600192611c0c87611bb6565b61075e565b94611bc3565b9101919091611bea565b90611c2b91611bc9565b90565b90611c4e611c4792611c3e610133565b93848092611c21565b0383610c23565b565b611c5990611c2e565b90565b611c64611b99565b50611c6f6003611c50565b90565b91611c92611c8d611c9a94611c85610abe565b50600561043b565b610ca9565b919091612349565b90565b90611cb1939291611cac61217b565b611cbb565b611cb96121e7565b565b93929190809485611cdb611cd5611cd06121fb565b610153565b91610153565b141580611d47575b80611d28575b611cfa57611cf8949550611d6a565b565b85611d036121fb565b611d24611d0e610133565b928392630272d02960e61b845260048401610af2565b0390fd5b50611d42611d3c611d376121fb565b611b4e565b156104da565b611ce9565b5085611d63611d5d611d5830610ae6565b610153565b91610153565b1415611ce3565b9291909281611d8a611d84611d7f6000610be9565b610153565b91610153565b14611e4d57611dc183611dbb611dac611da560068690610a0b565b8890610a23565b91611db683610470565b610d97565b90610df8565b611df383611ded611dde611dd760068690610a0b565b8690610a23565b91611de883610470565b610d45565b90610df8565b92909192611e48611e36611e30611e2a7f769254a71d2f67d8ac6cb44f2803c0d05cfbcf9effadb6a984f10ff9de3df6c39461042f565b94610856565b94610856565b94611e3f610133565b9182918261053e565b0390a4565b611e55610133565b6310c3a82760e21b815280611e6c600482016103a5565b0390fd5b90611e7c939291611c9d565b565b611e8f90611e8a612570565b611e91565b565b80611ead611ea7611ea26000610be9565b610153565b91610153565b14611ebd57611ebb90612600565b565b611ee8611eca6000610be9565b611ed2610133565b91829163b20f76e360e01b8352600483016105da565b0390fd5b611ef590611e7e565b565b611f0890611f03612570565b611fee565b565b611f1381611b9e565b821015611f2e57611f25600191611bab565b91020190600090565b6112ed565b611f43906008611f48930261087a565b6115a0565b90565b90611f569154611f33565b90565b90565b611f70611f6b611f7592611f59565b610404565b6101b3565b90565b634e487b7160e01b600052603160045260246000fd5b611fa091611f9a61159b565b91611a0e565b565b611fab816119b0565b8015611fcc576001900390611fc9611fc383836119b4565b90611f8e565b55565b611f78565b611fda906101b3565b60008114611fe9576001900390565b610d2f565b612002611ffd60018390610862565b611933565b61200a575b50565b612020600061201b60018490610862565b611965565b61202a6003611b9e565b906120356000610cc2565b5b80612049612043856101b3565b916101b3565b101561213c5761206461205e60038390611f0a565b90611f4b565b61207661207084610153565b91610153565b146120895761208490611329565b612036565b6120c16120b96120b36120c794956120ad6003916120a76001611f5c565b90610d97565b90611f0a565b90611f4b565b916003611f0a565b90611a0e565b6120d96120d460036119a2565b611fa2565b5b6120f66120ef6120ea6002610470565b611fd1565b6002610df8565b6121207f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e8111391610856565b90612129610133565b80612133816103a5565b0390a238612007565b5090506120da565b61214d90611ef7565b565b90565b61216661216161216b9261214f565b610404565b6101b3565b90565b6121786002612152565b90565b6121856004610470565b61219e61219861219361216e565b6101b3565b916101b3565b146121b7576121b56121ae61216e565b6004610df8565b565b6121bf610133565b6306fda65d60e31b8152806121d6600482016103a5565b0390fd5b6121e46001611f5c565b90565b6121f96121f26121da565b6004610df8565b565b61220361159b565b503390565b61221761221d919392936101b3565b926101b3565b916122298382026101b3565b92818404149015171561223857565b610d2f565b634e487b7160e01b600052601260045260246000fd5b61225f612265916101b3565b916101b3565b908115612270570490565b61223d565b919091612280610abe565b5061228d60208201610cb5565b6122a061229a6000610cc2565b916101b3565b146000146122ae575050905b565b9092916122dc6122ca826122c460008601610cb5565b90612208565b6122d660208501610cb5565b90612253565b939182612300575b50506122f0575b6122ac565b906122fa90611985565b906122eb565b61234191925061233561233b9161232f60006123288961232260208601610cb5565b90612208565b9201610cb5565b90612253565b926101b3565b916101b3565b1038806122e4565b919091612354610abe565b5061236160008201610cb5565b61237461236e6000610cc2565b916101b3565b14600014612382575050905b565b9092916123b061239e8261239860208601610cb5565b90612208565b6123aa60008501610cb5565b90612253565b9391826123d4575b50506123c4575b612380565b906123ce90611985565b906123bf565b61241591925061240961240f9161240360206123fc896123f660008601610cb5565b90612208565b9201610cb5565b90612253565b926101b3565b916101b3565b1038806123b8565b60206124346124669261242e610abe565b50610cde565b6370a082319061245b61244630610ae6565b9261244f610133565b95869485938493610cea565b8352600483016105da565b03915afa9081156124ab5760009161247d575b5090565b61249e915060203d81116124a4575b6124968183610c23565b810190610cff565b38612479565b503d61248c565b610d1e565b6124b99061084a565b90565b63ffffffff1690565b63ffffffff60e01b1690565b6124e56124e06124ea926124bc565b610cea565b6124c5565b90565b60409061251761251e949695939661250d606084019860008501906105cd565b60208301906105cd565b0190610231565b565b60049261255a61256e959361256993946125416323b872dd929491926124d1565b9361254a610133565b97889560208701908152016124ed565b60208201810382520383610c23565b6126d3565b565b6125786115cc565b61259161258b6125866121fb565b610153565b91610153565b0361259857565b6125c16125a36121fb565b6125ab610133565b9182916332b2baa360e01b8352600483016105da565b0390fd5b906125d660018060a01b0391610dbc565b9181191691161790565b906125f56125f06125fc92610856565b611a0b565b82546125c5565b9055565b61260a60006115bf565b6126158260006125e0565b906126496126437f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093610856565b91610856565b91612652610133565b8061265c816103a5565b0390a3565b91602061268392949361267c604082019660008301906105cd565b0190610231565b565b906126cc6126d1936126bd600494936126a463a9059cbb9193916124d1565b926126ad610133565b9687946020860190815201612661565b60208201810382520383610c23565b6126d3565b565b9060006020916126e1610abe565b506126ea610abe565b50828151910182855af115612788573d6000519061271161270b6000610cc2565b916101b3565b1460001461276e5750612723816124b0565b3b6127376127316000610cc2565b916101b3565b145b6127405750565b61274c61276a916124b0565b612754610133565b918291635274afe760e01b8352600483016105da565b0390fd5b61278161277b6001611f5c565b916101b3565b1415612739565b6040513d6000823e3d90fdfea264697066735822122019977ed1dbd13dcee86ac336cc0f9993ddcdb259ca5e603fcdbd3191ca4c70ac64736f6c63430008180033
Deployed Bytecode
0x60806040526004361015610013575b610ab9565b61001e60003561012d565b806302b9446c146101285780630fca8843146101235780634ffe34db1461011e5780635662311814610119578063715018a6146101145780638da5cb5b1461010f57806397da6d301461010a578063a5b1d7fe14610105578063a7fc7a0714610100578063b429afeb146100fb578063b4e8a6c4146100f6578063da5139ca146100f1578063da8c229e146100ec578063f18d03cc146100e7578063f2fde38b146100e2578063f6a74ed7146100dd5763f7888aec0361000e57610a83565b6109aa565b610977565b610940565b6108c4565b610814565b6107df565b610709565b6106b3565b61065f565b610625565b6105f0565b61059a565b610554565b6104a4565b6103ab565b610262565b60e01c90565b60405190565b600080fd5b600080fd5b600080fd5b60018060a01b031690565b61015c90610148565b90565b61016890610153565b90565b6101748161015f565b0361017b57565b600080fd5b9050359061018d8261016b565b565b61019881610153565b0361019f57565b600080fd5b905035906101b18261018f565b565b90565b6101bf816101b3565b036101c657565b600080fd5b905035906101d8826101b6565b565b919060a08382031261022c576101f38160008501610180565b9261020182602083016101a4565b9261022961021284604085016101a4565b9361022081606086016101cb565b936080016101cb565b90565b61013e565b61023a906101b3565b9052565b91602061026092949361025960408201966000830190610231565b0190610231565b565b346102975761027e6102753660046101da565b939290926111fa565b9061029361028a610133565b9283928361023e565b0390f35b610139565b600080fd5b600080fd5b600080fd5b909182601f830112156102e55781359167ffffffffffffffff83116102e05760200192602083028401116102db57565b6102a6565b6102a1565b61029c565b909182601f830112156103245781359167ffffffffffffffff831161031f57602001926020830284011161031a57565b6102a6565b6102a1565b61029c565b91906080838203126103a0576103428160008501610180565b9261035082602083016101a4565b92604082013567ffffffffffffffff811161039b57836103719184016102ab565b929093606082013567ffffffffffffffff81116103965761039292016102ea565b9091565b610143565b610143565b61013e565b60000190565b346103e0576103ca6103be366004610329565b94939093929192611530565b6103d2610133565b806103dc816103a5565b0390f35b610139565b906020828203126103ff576103fc91600001610180565b90565b61013e565b90565b61041b61041661042092610148565b610404565b610148565b90565b61042c90610407565b90565b61043890610423565b90565b906104459061042f565b600052602052604060002090565b60001c90565b90565b61046861046d91610453565b610459565b90565b61047a905461045c565b90565b61048890600561043b565b906104a1600161049a60008501610470565b9301610470565b90565b346104d5576104bc6104b73660046103e5565b61047d565b906104d16104c8610133565b9283928361023e565b0390f35b610139565b151590565b6104e8816104da565b036104ef57565b600080fd5b90503590610501826104df565b565b90916060828403126105395761053661051f8460008501610180565b9361052d81602086016101cb565b936040016104f4565b90565b61013e565b919061055290600060208501940190610231565b565b346105855761058161057061056a366004610503565b91611540565b610578610133565b9182918261053e565b0390f35b610139565b600091031261059557565b61013e565b346105c8576105aa36600461058a565b6105b2611591565b6105ba610133565b806105c4816103a5565b0390f35b610139565b6105d690610153565b9052565b91906105ee906000602085019401906105cd565b565b346106205761060036600461058a565b61061c61060b6115cc565b610613610133565b918291826105da565b0390f35b610139565b3461065a576106416106383660046101da565b939290926118d4565b9061065661064d610133565b9283928361023e565b0390f35b610139565b3461068f5761066f36600461058a565b61068b61067a6118f6565b610682610133565b9182918261053e565b0390f35b610139565b906020828203126106ae576106ab916000016101a4565b90565b61013e565b346106e1576106cb6106c6366004610694565b611b3e565b6106d3610133565b806106dd816103a5565b0390f35b610139565b6106ef906104da565b9052565b9190610707906000602085019401906106e6565b565b346107395761073561072461071f366004610694565b611b4e565b61072c610133565b918291826106f3565b0390f35b610139565b5190565b60209181520190565b60200190565b61075a90610153565b9052565b9061076b81602093610751565b0190565b60200190565b9061079261078c6107858461073e565b8093610742565b9261074b565b9060005b8181106107a35750505090565b9091926107bc6107b6600192865161075e565b9461076f565b9101919091610796565b6107dc9160208201916000818403910152610775565b90565b3461080f576107ef36600461058a565b61080b6107fa611c5c565b610802610133565b918291826107c6565b0390f35b610139565b346108455761084161083061082a366004610503565b91611c72565b610838610133565b9182918261053e565b0390f35b610139565b61085390610407565b90565b61085f9061084a565b90565b9061086c90610856565b600052602052604060002090565b1c90565b60ff1690565b610894906008610899930261087a565b61087e565b90565b906108a79154610884565b90565b6108c1906108bc600191600092610862565b61089c565b90565b346108f4576108f06108df6108da366004610694565b6108aa565b6108e7610133565b918291826106f3565b0390f35b610139565b60808183031261093b576109108260008301610180565b9261093861092184602085016101a4565b9361092f81604086016101a4565b936060016101cb565b90565b61013e565b346109725761095c6109533660046108f9565b92919091611e70565b610964610133565b8061096e816103a5565b0390f35b610139565b346109a55761098f61098a366004610694565b611eec565b610997610133565b806109a1816103a5565b0390f35b610139565b346109d8576109c26109bd366004610694565b612144565b6109ca610133565b806109d4816103a5565b0390f35b610139565b9190604083820312610a0657806109fa610a039260008601610180565b936020016101a4565b90565b61013e565b90610a159061042f565b600052602052604060002090565b90610a2d90610856565b600052602052604060002090565b610a4b906008610a50930261087a565b610459565b90565b90610a5e9154610a3b565b90565b610a7b610a8092610a76600693600094610a0b565b610a23565b610a53565b90565b34610ab457610ab0610a9f610a993660046109dd565b90610a61565b610aa7610133565b9182918261053e565b0390f35b610139565b600080fd5b600090565b90610ada969594939291610ad561217b565b610b16565b9091610ae46121e7565b565b610aef9061084a565b90565b916020610b14929493610b0d604082019660008301906105cd565b01906105cd565b565b96959493929190829788610b39610b33610b2e6121fb565b610153565b91610153565b141580610ba7575b80610b88575b610b5a57610b56979850610e71565b9091565b88610b636121fb565b610b84610b6e610133565b928392630272d02960e61b845260048401610af2565b0390fd5b50610ba2610b9c610b976121fb565b611b4e565b156104da565b610b47565b5088610bc3610bbd610bb830610ae6565b610153565b91610153565b1415610b41565b90565b610be1610bdc610be692610bca565b610404565b610148565b90565b610bf290610bcd565b90565b90610bff906101b3565b9052565b601f801991011690565b634e487b7160e01b600052604160045260246000fd5b90610c2d90610c03565b810190811067ffffffffffffffff821117610c4757604052565b610c0d565b90610c5f610c58610133565b9283610c23565b565b610c6b6040610c4c565b90565b90610ca7610c9e6001610c7f610c61565b94610c98610c8f60008301610470565b60008801610bf5565b01610470565b60208401610bf5565b565b610cb290610c6e565b90565b610cbf90516101b3565b90565b610cd6610cd1610cdb92610bca565b610404565b6101b3565b90565b610ce79061084a565b90565b60e01b90565b90505190610cfd826101b6565b565b90602082820312610d1957610d1691600001610cf0565b90565b61013e565b610d26610133565b3d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b610d54610d5a919392936101b3565b926101b3565b8201809211610d6557565b610d2f565b90565b610d81610d7c610d8692610d6a565b610404565b6101b3565b90565b610d946103e8610d6d565b90565b610da6610dac919392936101b3565b926101b3565b8203918211610db757565b610d2f565b60001b90565b90610dcf60001991610dbc565b9181191691161790565b610ded610de8610df2926101b3565b610404565b6101b3565b90565b90565b90610e0d610e08610e1492610dd9565b610df5565b8254610dc2565b9055565b90610e4560206001610e4b94610e3d60008201610e3760008801610cb5565b90610df8565b019201610cb5565b90610df8565b565b90610e5791610e18565b565b610e6290610407565b90565b610e6e90610e59565b90565b969596939293505081610e95610e8f610e8a6000610be9565b610153565b91610153565b146111d757610eae610ea96005839061043b565b610ca9565b95610ebb60008801610cb5565b610ece610ec86000610cc2565b916101b3565b1480611142575b61111f5780610eed610ee76000610cc2565b916101b3565b146000146111095750610f038685600091612349565b95610f1a610f1360208301610cb5565b8890610d45565b610f33610f2d610f28610d89565b6101b3565b916101b3565b106110e8575b83610f54610f4e610f4930610ae6565b610153565b91610153565b14806110b1575b61108e57610fe690610f9588610f8f610f80610f7960068890610a0b565b8890610a23565b91610f8a83610470565b610d45565b90610df8565b610fb588610faf6020840191610faa83610cb5565b610d45565b90610bf5565b610fd586610fcf6000840191610fca83610cb5565b610d45565b90610bf5565b610fe16005849061043b565b610e4d565b82611001610ffb610ff630610ae6565b610153565b91610153565b03611063575b9183928661104761104161103b7fb045190548dadae679cfe9e337437613ca6dd73efdf984f75e56f152ccee22f09461042f565b94610856565b94610856565b9461105c611053610133565b9283928361023e565b0390a49190565b61108961107761107283610cde565b610e65565b8461108130610ae6565b908792612520565b611007565b611096610133565b633551b94d60e01b8152806110ad600482016103a5565b0390fd5b50846110e26110dc6110d76110c58661241d565b6110d160008701610cb5565b90610d97565b6101b3565b916101b3565b11610f5b565b50505050509050600090611106611100600093610cc2565b92610cc2565b90565b9593506111198487600191612275565b93610f39565b611127610133565b63df95788360e01b81528061113e600482016103a5565b0390fd5b50611167602061115184610cde565b6318160ddd9061115f610133565b938492610cea565b82528180611177600482016103a5565b03915afa9081156111d2576000916111a4575b5061119e6111986000610cc2565b916101b3565b14610ed5565b6111c5915060203d81116111cb575b6111bd8183610c23565b810190610cff565b3861118a565b503d6111b3565b610d1e565b6111df610133565b6310c3a82760e21b8152806111f6600482016103a5565b0390fd5b906112189493929161120a610abe565b611212610abe565b90610ac3565b9091565b90611232959493929161122d61217b565b61123c565b61123a6121e7565b565b95949392919080968761125e6112586112536121fb565b610153565b91610153565b1415806112ca575b806112ab575b61127d5761127b96975061135a565b565b876112866121fb565b6112a7611291610133565b928392630272d02960e61b845260048401610af2565b0390fd5b506112c56112bf6112ba6121fb565b611b4e565b156104da565b61126c565b50876112e66112e06112db30610ae6565b610153565b91610153565b1415611266565b634e487b7160e01b600052603260045260246000fd5b9190811015611313576020020190565b6112ed565b356113228161018f565b90565b5090565b600161133591016101b3565b90565b9190811015611348576020020190565b6112ed565b35611357816101b6565b90565b90939295949561137d61137884836113726000610cc2565b91611303565b611318565b61139861139261138d6000610be9565b610153565b91610153565b1461150d576113a5610abe565b926113b1818390611325565b966113ba610abe565b5b806113ce6113c88b6101b3565b916101b3565b10156114d257828482906113e192611303565b6113ea90611318565b95878b83906113f892611338565b6114019061134d565b60068761140d91610a0b565b8861141791610a23565b9061142182610470565b9061142b91610d45565b61143491610df8565b878b839061144192611338565b61144a9061134d565b61145391610d45565b95859089898d859061146492611338565b61146d9061134d565b927f769254a71d2f67d8ac6cb44f2803c0d05cfbcf9effadb6a984f10ff9de3df6c3906114999061042f565b916114a390610856565b926114ad90610856565b936114b6610133565b6114c181928261053e565b0390a46114cd90611329565b6113bb565b50975050509261150b945061150592506114f16114f692946006610a0b565b610a23565b9161150083610470565b610d97565b90610df8565b565b611515610133565b6310c3a82760e21b81528061152c600482016103a5565b0390fd5b9061153e959493929161121c565b565b9161156061155b61156894611553610abe565b50600561043b565b610ca9565b919091612275565b90565b611573612570565b61157b61157d565b565b61158f61158a6000610be9565b612600565b565b61159961156b565b565b600090565b60018060a01b031690565b6115b76115bc91610453565b6115a0565b90565b6115c990546115ab565b90565b6115d461159b565b506115df60006115bf565b90565b906115f99695949392916115f461217b565b611605565b90916116036121e7565b565b9695949392919082978861162861162261161d6121fb565b610153565b91610153565b141580611696575b80611677575b611649576116459798506116b9565b9091565b886116526121fb565b61167361165d610133565b928392630272d02960e61b845260048401610af2565b0390fd5b5061169161168b6116866121fb565b611b4e565b156104da565b611636565b50886116b26116ac6116a730610ae6565b610153565b91610153565b1415611630565b9695969392935050816116dd6116d76116d26000610be9565b610153565b91610153565b146118b1576116f66116f16005839061043b565b610ca9565b958061170b6117056000610cc2565b916101b3565b1460001461189b57506117218685600191612349565b955b6117558761174f61174061173960068790610a0b565b8890610a23565b9161174a83610470565b610d97565b90610df8565b6117758561176f600084019161176a83610cb5565b610d97565b90610bf5565b6117958761178f602084019161178a83610cb5565b610d97565b90610bf5565b6117a160208201610cb5565b6117b46117ae6000610cc2565b916101b3565b118061186f575b61184c576117d4906117cf6005849061043b565b610e4d565b6117f06117e86117e383610cde565b610e65565b838691612685565b9183928661183061182a6118247f144f5f62c08d623a6f383205dc8d5ef825b693748e2977846e18121b6780413a9461042f565b94610856565b94610856565b9461184561183c610133565b9283928361023e565b0390a49190565b611854610133565b6385b2711f60e01b81528061186b600482016103a5565b0390fd5b5061187c60208201610cb5565b61189561188f61188a610d89565b6101b3565b916101b3565b106117bb565b9593506118ab8487600091612275565b93611723565b6118b9610133565b6310c3a82760e21b8152806118d0600482016103a5565b0390fd5b906118f2949392916118e4610abe565b6118ec610abe565b906115e2565b9091565b6118fe610abe565b506119096002610470565b90565b61191d90611918612570565b611a65565b565b61192b61193091610453565b61087e565b90565b61193d905461191f565b90565b9061194c60ff91610dbc565b9181191691161790565b61195f906104da565b90565b90565b9061197a61197561198192611956565b611962565b8254611940565b9055565b61198e906101b3565b600019811461199d5760010190565b610d2f565b90565b600052602060002090565b5490565b6119bd816119b0565b8210156119d8576119cf6001916119a5565b91020190600090565b6112ed565b1b90565b91906008611a019102916119fb60018060a01b03846119dd565b926119dd565b9181191691161790565b90565b9190611a24611a1f611a2c93610856565b611a0b565b9083546119e1565b9055565b9081549168010000000000000000831015611a605782611a58916001611a5e950181556119b4565b90611a0e565b565b610c0d565b611a82611a7c611a7760018490610862565b611933565b156104da565b80611b1c575b611a90575b50565b611aa66001611aa160018490610862565b611965565b611ac2611abb611ab66002610470565b611985565b6002610df8565b611ad6611acf60036119a2565b8290611a30565b611b007f0a8bb31534c0ed46f380cb867bd5c803a189ced9a764e30b3a4991a9901d747491610856565b90611b09610133565b80611b13816103a5565b0390a238611a8d565b5080611b37611b31611b2c6115cc565b610153565b91610153565b1415611a88565b611b479061190c565b565b600090565b611b56611b49565b5080611b71611b6b611b666115cc565b610153565b91610153565b14908115611b7e575b5090565b611b939150611b8e906001610862565b611933565b38611b7a565b606090565b5490565b60209181520190565b600052602060002090565b611bc090546115ab565b90565b60010190565b90611be6611be0611bd984611b9e565b8093611ba2565b92611bab565b9060005b818110611bf75750505090565b909192611c17611c11600192611c0c87611bb6565b61075e565b94611bc3565b9101919091611bea565b90611c2b91611bc9565b90565b90611c4e611c4792611c3e610133565b93848092611c21565b0383610c23565b565b611c5990611c2e565b90565b611c64611b99565b50611c6f6003611c50565b90565b91611c92611c8d611c9a94611c85610abe565b50600561043b565b610ca9565b919091612349565b90565b90611cb1939291611cac61217b565b611cbb565b611cb96121e7565b565b93929190809485611cdb611cd5611cd06121fb565b610153565b91610153565b141580611d47575b80611d28575b611cfa57611cf8949550611d6a565b565b85611d036121fb565b611d24611d0e610133565b928392630272d02960e61b845260048401610af2565b0390fd5b50611d42611d3c611d376121fb565b611b4e565b156104da565b611ce9565b5085611d63611d5d611d5830610ae6565b610153565b91610153565b1415611ce3565b9291909281611d8a611d84611d7f6000610be9565b610153565b91610153565b14611e4d57611dc183611dbb611dac611da560068690610a0b565b8890610a23565b91611db683610470565b610d97565b90610df8565b611df383611ded611dde611dd760068690610a0b565b8690610a23565b91611de883610470565b610d45565b90610df8565b92909192611e48611e36611e30611e2a7f769254a71d2f67d8ac6cb44f2803c0d05cfbcf9effadb6a984f10ff9de3df6c39461042f565b94610856565b94610856565b94611e3f610133565b9182918261053e565b0390a4565b611e55610133565b6310c3a82760e21b815280611e6c600482016103a5565b0390fd5b90611e7c939291611c9d565b565b611e8f90611e8a612570565b611e91565b565b80611ead611ea7611ea26000610be9565b610153565b91610153565b14611ebd57611ebb90612600565b565b611ee8611eca6000610be9565b611ed2610133565b91829163b20f76e360e01b8352600483016105da565b0390fd5b611ef590611e7e565b565b611f0890611f03612570565b611fee565b565b611f1381611b9e565b821015611f2e57611f25600191611bab565b91020190600090565b6112ed565b611f43906008611f48930261087a565b6115a0565b90565b90611f569154611f33565b90565b90565b611f70611f6b611f7592611f59565b610404565b6101b3565b90565b634e487b7160e01b600052603160045260246000fd5b611fa091611f9a61159b565b91611a0e565b565b611fab816119b0565b8015611fcc576001900390611fc9611fc383836119b4565b90611f8e565b55565b611f78565b611fda906101b3565b60008114611fe9576001900390565b610d2f565b612002611ffd60018390610862565b611933565b61200a575b50565b612020600061201b60018490610862565b611965565b61202a6003611b9e565b906120356000610cc2565b5b80612049612043856101b3565b916101b3565b101561213c5761206461205e60038390611f0a565b90611f4b565b61207661207084610153565b91610153565b146120895761208490611329565b612036565b6120c16120b96120b36120c794956120ad6003916120a76001611f5c565b90610d97565b90611f0a565b90611f4b565b916003611f0a565b90611a0e565b6120d96120d460036119a2565b611fa2565b5b6120f66120ef6120ea6002610470565b611fd1565b6002610df8565b6121207f33d83959be2573f5453b12eb9d43b3499bc57d96bd2f067ba44803c859e8111391610856565b90612129610133565b80612133816103a5565b0390a238612007565b5090506120da565b61214d90611ef7565b565b90565b61216661216161216b9261214f565b610404565b6101b3565b90565b6121786002612152565b90565b6121856004610470565b61219e61219861219361216e565b6101b3565b916101b3565b146121b7576121b56121ae61216e565b6004610df8565b565b6121bf610133565b6306fda65d60e31b8152806121d6600482016103a5565b0390fd5b6121e46001611f5c565b90565b6121f96121f26121da565b6004610df8565b565b61220361159b565b503390565b61221761221d919392936101b3565b926101b3565b916122298382026101b3565b92818404149015171561223857565b610d2f565b634e487b7160e01b600052601260045260246000fd5b61225f612265916101b3565b916101b3565b908115612270570490565b61223d565b919091612280610abe565b5061228d60208201610cb5565b6122a061229a6000610cc2565b916101b3565b146000146122ae575050905b565b9092916122dc6122ca826122c460008601610cb5565b90612208565b6122d660208501610cb5565b90612253565b939182612300575b50506122f0575b6122ac565b906122fa90611985565b906122eb565b61234191925061233561233b9161232f60006123288961232260208601610cb5565b90612208565b9201610cb5565b90612253565b926101b3565b916101b3565b1038806122e4565b919091612354610abe565b5061236160008201610cb5565b61237461236e6000610cc2565b916101b3565b14600014612382575050905b565b9092916123b061239e8261239860208601610cb5565b90612208565b6123aa60008501610cb5565b90612253565b9391826123d4575b50506123c4575b612380565b906123ce90611985565b906123bf565b61241591925061240961240f9161240360206123fc896123f660008601610cb5565b90612208565b9201610cb5565b90612253565b926101b3565b916101b3565b1038806123b8565b60206124346124669261242e610abe565b50610cde565b6370a082319061245b61244630610ae6565b9261244f610133565b95869485938493610cea565b8352600483016105da565b03915afa9081156124ab5760009161247d575b5090565b61249e915060203d81116124a4575b6124968183610c23565b810190610cff565b38612479565b503d61248c565b610d1e565b6124b99061084a565b90565b63ffffffff1690565b63ffffffff60e01b1690565b6124e56124e06124ea926124bc565b610cea565b6124c5565b90565b60409061251761251e949695939661250d606084019860008501906105cd565b60208301906105cd565b0190610231565b565b60049261255a61256e959361256993946125416323b872dd929491926124d1565b9361254a610133565b97889560208701908152016124ed565b60208201810382520383610c23565b6126d3565b565b6125786115cc565b61259161258b6125866121fb565b610153565b91610153565b0361259857565b6125c16125a36121fb565b6125ab610133565b9182916332b2baa360e01b8352600483016105da565b0390fd5b906125d660018060a01b0391610dbc565b9181191691161790565b906125f56125f06125fc92610856565b611a0b565b82546125c5565b9055565b61260a60006115bf565b6126158260006125e0565b906126496126437f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e093610856565b91610856565b91612652610133565b8061265c816103a5565b0390a3565b91602061268392949361267c604082019660008301906105cd565b0190610231565b565b906126cc6126d1936126bd600494936126a463a9059cbb9193916124d1565b926126ad610133565b9687946020860190815201612661565b60208201810382520383610c23565b6126d3565b565b9060006020916126e1610abe565b506126ea610abe565b50828151910182855af115612788573d6000519061271161270b6000610cc2565b916101b3565b1460001461276e5750612723816124b0565b3b6127376127316000610cc2565b916101b3565b145b6127405750565b61274c61276a916124b0565b612754610133565b918291635274afe760e01b8352600483016105da565b0390fd5b61278161277b6001611f5c565b916101b3565b1415612739565b6040513d6000823e3d90fdfea264697066735822122019977ed1dbd13dcee86ac336cc0f9993ddcdb259ca5e603fcdbd3191ca4c70ac64736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.