Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 8636685 | 383 days ago | IN | Create: ERC20StakingModuleFactory | 0 ETH | 0.10101473 |
Latest 21 internal transactions
Advanced mode:
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
8922807 | 332 days ago | 0 ETH | ||||
8922807 | 332 days ago | Contract Creation | 0 ETH | |||
8922807 | 332 days ago | 0 ETH | ||||
8841248 | 347 days ago | 0 ETH | ||||
8841248 | 347 days ago | Contract Creation | 0 ETH | |||
8841248 | 347 days ago | 0 ETH | ||||
8797014 | 355 days ago | 0 ETH | ||||
8797014 | 355 days ago | Contract Creation | 0 ETH | |||
8797014 | 355 days ago | 0 ETH | ||||
8769525 | 360 days ago | 0 ETH | ||||
8769525 | 360 days ago | Contract Creation | 0 ETH | |||
8769525 | 360 days ago | 0 ETH | ||||
8756423 | 362 days ago | 0 ETH | ||||
8756423 | 362 days ago | Contract Creation | 0 ETH | |||
8756423 | 362 days ago | 0 ETH | ||||
8729748 | 367 days ago | 0 ETH | ||||
8729748 | 367 days ago | Contract Creation | 0 ETH | |||
8729748 | 367 days ago | 0 ETH | ||||
8643834 | 382 days ago | 0 ETH | ||||
8643834 | 382 days ago | Contract Creation | 0 ETH | |||
8643834 | 382 days ago | 0 ETH |
Loading...
Loading
Contract Name:
ERC20StakingModuleFactory
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/* ERC20StakingModuleFactory https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; import "./interfaces/IModuleFactory.sol"; import "./ERC20StakingModule.sol"; /** * @title ERC20 staking module factory * * @notice this factory contract handles deployment for the * ERC20StakingModule contract * * @dev it is called by the parent PoolFactory and is responsible * for parsing constructor arguments before creating a new contract */ contract ERC20StakingModuleFactory is IModuleFactory { /** * @inheritdoc IModuleFactory */ function createModule(address, bytes calldata data) external override returns (address) { // validate require(data.length == 32, "smf1"); // parse staking token address token; assembly { token := calldataload(100) } // create module ERC20StakingModule module = new ERC20StakingModule(token, address(this)); module.transferOwnership(msg.sender); // output emit ModuleCreated(msg.sender, address(module)); return address(module); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/* ERC20StakingModule https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IStakingModule.sol"; import "./OwnerController.sol"; import "./TokenUtils.sol"; /** * @title ERC20 staking module * * @notice this staking module allows users to deposit an amount of ERC20 token * in exchange for shares credited to their address. When the user * unstakes, these shares will be burned and a reward will be distributed. */ contract ERC20StakingModule is IStakingModule, OwnerController { using SafeERC20 for IERC20; using TokenUtils for IERC20; // events event Approval(address indexed user, address indexed operator, bool value); // constant uint256 public constant INITIAL_SHARES_PER_TOKEN = 1e6; // members IERC20 private immutable _token; address private immutable _factory; mapping(address => uint256) public shares; uint256 public totalShares; mapping(address => mapping(address => bool)) public approvals; /** * @param token_ the token that will be staked * @param factory_ address of module factory */ constructor(address token_, address factory_) { require(token_ != address(0)); _token = IERC20(token_); _factory = factory_; } /** * @inheritdoc IStakingModule */ function tokens() external view override returns (address[] memory tokens_) { tokens_ = new address[](1); tokens_[0] = address(_token); } /** * @inheritdoc IStakingModule */ function balances( address user ) external view override returns (uint256[] memory balances_) { balances_ = new uint256[](1); balances_[0] = _balance(user); } /** * @inheritdoc IStakingModule */ function factory() external view override returns (address) { return _factory; } /** * @inheritdoc IStakingModule */ function totals() external view override returns (uint256[] memory totals_) { totals_ = new uint256[](1); totals_[0] = _token.balanceOf(address(this)); } /** * @inheritdoc IStakingModule */ function stake( address sender, uint256 amount, bytes calldata data ) external override onlyOwner returns (bytes32, uint256) { // validate require(amount > 0, "sm1"); address account = _account(sender, data); // transfer uint256 minted = _token.receiveAmount(totalShares, sender, amount); // update user staking info shares[account] += minted; // add newly minted shares to global total totalShares += minted; bytes32 account_ = bytes32(uint256(uint160(account))); emit Staked(account_, sender, address(_token), amount, minted); return (account_, minted); } /** * @inheritdoc IStakingModule */ function unstake( address sender, uint256 amount, bytes calldata data ) external override onlyOwner returns (bytes32, address, uint256) { // validate and get shares address account = _account(sender, data); uint256 burned = _shares(account, amount); // burn shares totalShares -= burned; shares[account] -= burned; // unstake _token.safeTransfer(sender, amount); bytes32 account_ = bytes32(uint256(uint160(account))); emit Unstaked(account_, sender, address(_token), amount, burned); return (account_, sender, burned); } /** * @inheritdoc IStakingModule */ function claim( address sender, uint256 amount, bytes calldata data ) external override onlyOwner returns (bytes32, address, uint256) { address account = _account(sender, data); uint256 s = _shares(account, amount); bytes32 account_ = bytes32(uint256(uint160(account))); emit Claimed(account_, sender, address(_token), amount, s); return (account_, sender, s); } /** * @inheritdoc IStakingModule */ function update( address sender, bytes calldata data ) external view override returns (bytes32) { return (bytes32(uint256(uint160(_account(sender, data))))); } /** * @inheritdoc IStakingModule */ function clean(bytes calldata) external override {} /** * @notice set approval for operators to act on user position * @param operator address of operator * @param value boolean to grant or revoke approval */ function approve(address operator, bool value) external { approvals[msg.sender][operator] = value; emit Approval(msg.sender, operator, value); } /** * @dev internal helper to get user balance * @param user address of interest */ function _balance(address user) private view returns (uint256) { if (totalShares == 0) { return 0; } return _token.getAmount(totalShares, shares[user]); } /** * @dev internal helper to validate and convert user stake amount to shares * @param user address of user * @param amount number of tokens to consider * @return shares_ equivalent number of shares */ function _shares( address user, uint256 amount ) private view returns (uint256 shares_) { // validate require(amount > 0, "sm3"); require(totalShares > 0, "sm4"); // convert token amount to shares shares_ = _token.getShares(totalShares, amount); require(shares_ > 0, "sm5"); require(shares[user] >= shares_, "sm6"); } /** * @dev internal helper to get account and validate approval * @param sender address of sender * @param data either empty bytes or encoded account address */ function _account( address sender, bytes calldata data ) private view returns (address) { require(data.length == 0 || data.length == 32, "sm7"); if (data.length > 0) { address account; assembly { account := calldataload(132) } require(approvals[account][sender], "sm8"); return account; } else { return sender; } } }
/* IEvents https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; /** * @title GYSR event system * * @notice common interface to define GYSR event system */ interface IEvents { // staking event Staked( bytes32 indexed account, address indexed user, address indexed token, uint256 amount, uint256 shares ); event Unstaked( bytes32 indexed account, address indexed user, address indexed token, uint256 amount, uint256 shares ); event Claimed( bytes32 indexed account, address indexed user, address indexed token, uint256 amount, uint256 shares ); event Updated(bytes32 indexed account, address indexed user); // rewards event RewardsDistributed( address indexed user, address indexed token, uint256 amount, uint256 shares ); event RewardsFunded( address indexed token, uint256 amount, uint256 shares, uint256 timestamp ); event RewardsExpired( address indexed token, uint256 amount, uint256 shares, uint256 timestamp ); event RewardsWithdrawn( address indexed token, uint256 amount, uint256 shares, uint256 timestamp ); event RewardsUpdated(bytes32 indexed account); // gysr event GysrSpent(address indexed user, uint256 amount); event GysrVested(address indexed user, uint256 amount); event GysrWithdrawn(uint256 amount); }
/* IModuleFactory https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; /** * @title Module factory interface * * @notice this defines the common module factory interface used by the * main factory to create the staking and reward modules for a new Pool. */ interface IModuleFactory { // events event ModuleCreated(address indexed user, address module); /** * @notice create a new Pool module * @param config address for configuration contract * @param data binary encoded construction parameters * @return address of newly created module */ function createModule(address config, bytes calldata data) external returns (address); }
/* IOwnerController https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; /** * @title Owner controller interface * * @notice this defines the interface for any contracts that use the * owner controller access pattern */ interface IOwnerController { /** * @dev Returns the address of the current owner. */ function owner() external view returns (address); /** * @dev Returns the address of the current controller. */ function controller() external view returns (address); /** * @dev Transfers ownership of the contract to a new account (`newOwner`). This can * include renouncing ownership by transferring to the zero address. * Can only be called by the current owner. */ function transferOwnership(address newOwner) external; /** * @dev Transfers control of the contract to a new account (`newController`). * Can only be called by the owner. */ function transferControl(address newController) external; }
/* IStakingModule https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IEvents.sol"; import "./IOwnerController.sol"; /** * @title Staking module interface * * @notice this contract defines the common interface that any staking module * must implement to be compatible with the modular Pool architecture. */ interface IStakingModule is IOwnerController, IEvents { /** * @return array of staking tokens */ function tokens() external view returns (address[] memory); /** * @notice get balance of user * @param user address of user * @return balances of each staking token */ function balances(address user) external view returns (uint256[] memory); /** * @return address of module factory */ function factory() external view returns (address); /** * @notice get total staked amount * @return totals for each staking token */ function totals() external view returns (uint256[] memory); /** * @notice stake an amount of tokens for user * @param sender address of sender * @param amount number of tokens to stake * @param data additional data * @return bytes32 id of staking account * @return number of shares minted for stake */ function stake( address sender, uint256 amount, bytes calldata data ) external returns (bytes32, uint256); /** * @notice unstake an amount of tokens for user * @param sender address of sender * @param amount number of tokens to unstake * @param data additional data * @return bytes32 id of staking account * @return address of reward receiver * @return number of shares burned for unstake */ function unstake( address sender, uint256 amount, bytes calldata data ) external returns (bytes32, address, uint256); /** * @notice quote the share value for an amount of tokens without unstaking * @param sender address of sender * @param amount number of tokens to claim with * @param data additional data * @return bytes32 id of staking account * @return address of reward receiver * @return number of shares that the claim amount is worth */ function claim( address sender, uint256 amount, bytes calldata data ) external returns (bytes32, address, uint256); /** * @notice method called by anyone to update accounting * @dev will only be called ad hoc and should not contain essential logic * @param sender address of user for update * @param data additional data * @return bytes32 id of staking account */ function update( address sender, bytes calldata data ) external returns (bytes32); /** * @notice method called by owner to clean up and perform additional accounting * @dev will only be called ad hoc and should not contain any essential logic * @param data additional data */ function clean(bytes calldata data) external; }
/* OwnerController https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; import "./interfaces/IOwnerController.sol"; /** * @title Owner controller * * @notice this base contract implements an owner-controller access model. * * @dev the contract is an adapted version of the OpenZeppelin Ownable contract. * It allows the owner to designate an additional account as the controller to * perform restricted operations. * * Other changes include supporting role verification with a require method * in addition to the modifier option, and removing some unneeded functionality. * * Original contract here: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol */ contract OwnerController is IOwnerController { address private _owner; address private _controller; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); event ControlTransferred( address indexed previousController, address indexed newController ); constructor() { _owner = msg.sender; _controller = msg.sender; emit OwnershipTransferred(address(0), _owner); emit ControlTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view override returns (address) { return _owner; } /** * @dev Returns the address of the current controller. */ function controller() public view override returns (address) { return _controller; } /** * @dev Modifier that throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == msg.sender, "oc1"); _; } /** * @dev Modifier that throws if called by any account other than the controller. */ modifier onlyController() { require(_controller == msg.sender, "oc2"); _; } /** * @dev Throws if called by any account other than the owner. */ function requireOwner() internal view { require(_owner == msg.sender, "oc1"); } /** * @dev Throws if called by any account other than the controller. */ function requireController() internal view { require(_controller == msg.sender, "oc2"); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). This can * include renouncing ownership by transferring to the zero address. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override { requireOwner(); require(newOwner != address(0), "oc3"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } /** * @dev Transfers control of the contract to a new account (`newController`). * Can only be called by the owner. */ function transferControl(address newController) public virtual override { requireOwner(); require(newController != address(0), "oc4"); emit ControlTransferred(_controller, newController); _controller = newController; } }
/* TokenUtils https://github.com/gysr-io/core SPDX-License-Identifier: MIT */ pragma solidity 0.8.18; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title Token utilities * * @notice this library implements utility methods for token handling, * dynamic balance accounting, and fee processing */ library TokenUtils { using SafeERC20 for IERC20; uint256 constant INITIAL_SHARES_PER_TOKEN = 1e6; /** * @notice get token shares from amount * @param token erc20 token interface * @param total current total shares * @param amount balance of tokens */ function getShares( IERC20 token, uint256 total, uint256 amount ) internal view returns (uint256) { if (total == 0) return 0; return (total * amount) / token.balanceOf(address(this)); } /** * @notice get token amount from shares * @param token erc20 token interface * @param total current total shares * @param shares balance of shares */ function getAmount( IERC20 token, uint256 total, uint256 shares ) internal view returns (uint256) { if (total == 0) return 0; return (token.balanceOf(address(this)) * shares) / total; } /** * @notice transfer tokens from sender into contract and convert to shares * for internal accounting * @param token erc20 token interface * @param shares current total shares * @param sender token sender * @param amount number of tokens to be sent */ function receiveAmount( IERC20 token, uint256 shares, address sender, uint256 amount ) internal returns (uint256) { // transfer uint256 total = token.balanceOf(address(this)); token.safeTransferFrom(sender, address(this), amount); uint256 actual = token.balanceOf(address(this)) - total; // mint shares at current rate uint256 minted = (total > 0) ? (shares * actual) / total : actual * INITIAL_SHARES_PER_TOKEN; require(minted > 0); return minted; } /** * @notice transfer tokens from sender into contract, process protocol fee, * and convert to shares for internal accounting * @param token erc20 token interface * @param shares current total shares * @param sender token sender * @param amount number of tokens to be sent * @param feeReceiver address to receive fee * @param feeRate portion of amount to take as fee in 18 decimals */ function receiveWithFee( IERC20 token, uint256 shares, address sender, uint256 amount, address feeReceiver, uint256 feeRate ) internal returns (uint256) { // check initial token balance uint256 total = token.balanceOf(address(this)); // process fee uint256 fee; if (feeReceiver != address(0) && feeRate > 0 && feeRate < 1e18) { fee = (amount * feeRate) / 1e18; token.safeTransferFrom(sender, feeReceiver, fee); } // do transfer token.safeTransferFrom(sender, address(this), amount - fee); uint256 actual = token.balanceOf(address(this)) - total; // mint shares at current rate uint256 minted = (total > 0) ? (shares * actual) / total : actual * INITIAL_SHARES_PER_TOKEN; require(minted > 0); return minted; } }
{ "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"ModuleCreated","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"createModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611f45806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806320868d1814610030575b600080fd5b61004361003e36600461021e565b61006c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000602082146100e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100da9060208082526004908201527f736d663100000000000000000000000000000000000000000000000000000000604082015260600190565b60405180910390fd5b60006064359050600081306040516100fa90610211565b73ffffffffffffffffffffffffffffffffffffffff928316815291166020820152604001604051809103906000f08015801561013a573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101a557600080fd5b505af11580156101b9573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a295945050505050565b611c53806102bd83390190565b60008060006040848603121561023357600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461025757600080fd5b9250602084013567ffffffffffffffff8082111561027457600080fd5b818601915086601f83011261028857600080fd5b81358181111561029757600080fd5b8760208285010111156102a957600080fd5b602083019450809350505050925092509256fe60c06040523480156200001157600080fd5b5060405162001c5338038062001c53833981016040819052620000349162000102565b60008054336001600160a01b0319918216811783556001805490921681179091556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600080546040516001600160a01b0390911691907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a36001600160a01b038216620000cd57600080fd5b6001600160a01b039182166080521660a0526200013a565b80516001600160a01b0381168114620000fd57600080fd5b919050565b600080604083850312156200011657600080fd5b6200012183620000e5565b91506200013160208401620000e5565b90509250929050565b60805160a051611abb6200019860003960006102de01526000818161056001528181610609015281816108150152818161089a0152818161095a01528181610af101528181610b4101528181610dc101526110ba0152611abb6000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80639d63848a116100b2578063c45a015511610081578063dc16ceb911610066578063dc16ceb914610322578063f2fde38b1461032c578063f77c47911461033f57600080fd5b8063c45a0155146102dc578063ce7c2ac21461030257600080fd5b80639d63848a1461026e578063a32ce11e14610283578063c038a38e146102c1578063c4113b88146102c957600080fd5b80633e12170f116101095780636fd366b8116100ee5780636fd366b8146101da5780638da5cb5b146101ec5780638f0bc1521461022b57600080fd5b80633e12170f1461019f5780636d16fa41146101c757600080fd5b806302a688ed1461013b57806327e235e3146101615780633a98ef39146101815780633d140d211461018a575b600080fd5b61014e6101493660046116d1565b61035d565b6040519081526020015b60405180910390f35b61017461016f366004611724565b61038a565b604051610158919061173f565b61014e60035481565b61019d610198366004611794565b6103d9565b005b6101b26101ad3660046117cb565b610470565b60408051928352602083019190915201610158565b61019d6101d5366004611724565b610669565b61019d6101e8366004611825565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610158565b61023e6102393660046117cb565b610762565b6040805193845273ffffffffffffffffffffffffffffffffffffffff909216602084015290820152606001610158565b610276610876565b6040516101589190611867565b6102b16102913660046118b5565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610158565b610174610909565b61023e6102d73660046117cb565b6109fc565b7f0000000000000000000000000000000000000000000000000000000000000000610206565b61014e610310366004611724565b60026020526000908152604090205481565b61014e620f424081565b61019d61033a366004611724565b610b91565b60015473ffffffffffffffffffffffffffffffffffffffff16610206565b600061036a848484610c89565b73ffffffffffffffffffffffffffffffffffffffff1690505b9392505050565b604080516001808252818301909252606091602080830190803683370190505090506103b582610d7d565b816000815181106103c8576103c86118e8565b602002602001018181525050919050565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f1d3e246ebbc933bf65d3290db9f93d67ab91a12d2b19308a35806e04d1c174c5910160405180910390a35050565b60008054819073ffffffffffffffffffffffffffffffffffffffff1633146104df5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000851161052f5760405162461bcd60e51b815260206004820152600360248201527f736d31000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b600061053c878686610c89565b6003549091506000906105889073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908a8a610df0565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260408120805492935083929091906105c2908490611946565b9250508190555080600360008282546105db9190611946565b9091555050604080518881526020810183905273ffffffffffffffffffffffffffffffffffffffff848116927f0000000000000000000000000000000000000000000000000000000000000000821692918c169184917f020c82fffaa7f476edc4d209bc47371cb11635b2077978c27e7c39360146d2ed910160405180910390a49890975095505050505050565b610671610f90565b73ffffffffffffffffffffffffffffffffffffffff81166106d45760405162461bcd60e51b815260206004820152600360248201527f6f6334000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600080548190819073ffffffffffffffffffffffffffffffffffffffff1633146107ce5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60006107db888787610c89565b905060006107e98289610ff9565b604080518a81526020810183905291925073ffffffffffffffffffffffffffffffffffffffff808516927f0000000000000000000000000000000000000000000000000000000000000000821692918d169184917f636cc28d1dc3c5f8610bbd1cabdf6585ab2ef79f4b9ae78e840c1b8fd5ac887a91015b60405180910390a49990975095505050505050565b604080516001808252818301909252606091602080830190803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000816000815181106108cc576108cc6118e8565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505090565b60408051600180825281830190925260609160208083019080368337019050506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190611959565b816000815181106109ed576109ed6118e8565b60200260200101818152505090565b600080548190819073ffffffffffffffffffffffffffffffffffffffff163314610a685760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b6000610a75888787610c89565b90506000610a838289610ff9565b90508060036000828254610a979190611972565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054839290610ad1908490611972565b90915550610b18905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168a8a6111a8565b604080518981526020810183905273ffffffffffffffffffffffffffffffffffffffff808516927f0000000000000000000000000000000000000000000000000000000000000000821692918d169184917f31d5ceefd9ae9f1d896ec09a203f74a59524f36c970d3ede03478bb30c550a219101610861565b610b99610f90565b73ffffffffffffffffffffffffffffffffffffffff8116610bfc5760405162461bcd60e51b815260206004820152600360248201527f6f6333000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000811580610c985750602082145b610ce45760405162461bcd60e51b815260206004820152600360248201527f736d37000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b8115610d765760843573ffffffffffffffffffffffffffffffffffffffff81811660009081526004602090815260408083209389168352929052205460ff16610d6f5760405162461bcd60e51b815260206004820152600360248201527f736d38000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b9050610383565b5082610383565b6000600354600003610d9157506000919050565b60035473ffffffffffffffffffffffffffffffffffffffff808416600090815260026020526040902054610dea927f00000000000000000000000000000000000000000000000000000000000000009092169190611281565b92915050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa158015610e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e839190611959565b9050610ea773ffffffffffffffffffffffffffffffffffffffff8716853086611341565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090829073ffffffffffffffffffffffffffffffffffffffff8916906370a0823190602401602060405180830381865afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190611959565b610f449190611972565b90506000808311610f6157610f5c620f424083611985565b610f76565b82610f6c8389611985565b610f76919061199c565b905060008111610f8557600080fd5b979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ff75760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b565b600080821161104a5760405162461bcd60e51b815260206004820152600360248201527f736d33000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60006003541161109c5760405162461bcd60e51b815260206004820152600360248201527f736d34000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b6003546110e19073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690846113a5565b9050600081116111335760405162461bcd60e51b815260206004820152600360248201527f736d35000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054811115610dea5760405162461bcd60e51b815260206004820152600360248201527f736d36000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261127c9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261144f565b505050565b60008260000361129357506000610383565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528390839073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa158015611301573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113259190611959565b61132f9190611985565b611339919061199c565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261139f9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016111fa565b50505050565b6000826000036113b757506000610383565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114459190611959565b61132f8385611985565b60006114b1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115419092919063ffffffff16565b80519091501561127c57808060200190518101906114cf91906119d7565b61127c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016104d6565b606061133984846000858573ffffffffffffffffffffffffffffffffffffffff85163b6115b05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104d6565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516115d99190611a18565b60006040518083038185875af1925050503d8060008114611616576040519150601f19603f3d011682016040523d82523d6000602084013e61161b565b606091505b5091509150610f8582828660608315611635575081610383565b8251156116455782518084602001fd5b8160405162461bcd60e51b81526004016104d69190611a34565b803573ffffffffffffffffffffffffffffffffffffffff8116811461168357600080fd5b919050565b60008083601f84011261169a57600080fd5b50813567ffffffffffffffff8111156116b257600080fd5b6020830191508360208285010111156116ca57600080fd5b9250929050565b6000806000604084860312156116e657600080fd5b6116ef8461165f565b9250602084013567ffffffffffffffff81111561170b57600080fd5b61171786828701611688565b9497909650939450505050565b60006020828403121561173657600080fd5b6103838261165f565b6020808252825182820181905260009190848201906040850190845b818110156117775783518352928401929184019160010161175b565b50909695505050505050565b801515811461179157600080fd5b50565b600080604083850312156117a757600080fd5b6117b08361165f565b915060208301356117c081611783565b809150509250929050565b600080600080606085870312156117e157600080fd5b6117ea8561165f565b935060208501359250604085013567ffffffffffffffff81111561180d57600080fd5b61181987828801611688565b95989497509550505050565b6000806020838503121561183857600080fd5b823567ffffffffffffffff81111561184f57600080fd5b61185b85828601611688565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561177757835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101611883565b600080604083850312156118c857600080fd5b6118d18361165f565b91506118df6020840161165f565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610dea57610dea611917565b60006020828403121561196b57600080fd5b5051919050565b81810381811115610dea57610dea611917565b8082028115828204841417610dea57610dea611917565b6000826119d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156119e957600080fd5b815161038381611783565b60005b83811015611a0f5781810151838201526020016119f7565b50506000910152565b60008251611a2a8184602087016119f4565b9190910192915050565b6020815260008251806020840152611a538160408501602087016119f4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212201135d50a532ac887b2356b00448ff674851de8008430d64a5901689ccc0c422864736f6c63430008120033a2646970667358221220385b2b181f8a17ddd16e9584b4800846cdc16ec8101eacf3f408dfe775b4e44d64736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806320868d1814610030575b600080fd5b61004361003e36600461021e565b61006c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000602082146100e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100da9060208082526004908201527f736d663100000000000000000000000000000000000000000000000000000000604082015260600190565b60405180910390fd5b60006064359050600081306040516100fa90610211565b73ffffffffffffffffffffffffffffffffffffffff928316815291166020820152604001604051809103906000f08015801561013a573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101a557600080fd5b505af11580156101b9573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a295945050505050565b611c53806102bd83390190565b60008060006040848603121561023357600080fd5b833573ffffffffffffffffffffffffffffffffffffffff8116811461025757600080fd5b9250602084013567ffffffffffffffff8082111561027457600080fd5b818601915086601f83011261028857600080fd5b81358181111561029757600080fd5b8760208285010111156102a957600080fd5b602083019450809350505050925092509256fe60c06040523480156200001157600080fd5b5060405162001c5338038062001c53833981016040819052620000349162000102565b60008054336001600160a01b0319918216811783556001805490921681179091556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600080546040516001600160a01b0390911691907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a36001600160a01b038216620000cd57600080fd5b6001600160a01b039182166080521660a0526200013a565b80516001600160a01b0381168114620000fd57600080fd5b919050565b600080604083850312156200011657600080fd5b6200012183620000e5565b91506200013160208401620000e5565b90509250929050565b60805160a051611abb6200019860003960006102de01526000818161056001528181610609015281816108150152818161089a0152818161095a01528181610af101528181610b4101528181610dc101526110ba0152611abb6000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80639d63848a116100b2578063c45a015511610081578063dc16ceb911610066578063dc16ceb914610322578063f2fde38b1461032c578063f77c47911461033f57600080fd5b8063c45a0155146102dc578063ce7c2ac21461030257600080fd5b80639d63848a1461026e578063a32ce11e14610283578063c038a38e146102c1578063c4113b88146102c957600080fd5b80633e12170f116101095780636fd366b8116100ee5780636fd366b8146101da5780638da5cb5b146101ec5780638f0bc1521461022b57600080fd5b80633e12170f1461019f5780636d16fa41146101c757600080fd5b806302a688ed1461013b57806327e235e3146101615780633a98ef39146101815780633d140d211461018a575b600080fd5b61014e6101493660046116d1565b61035d565b6040519081526020015b60405180910390f35b61017461016f366004611724565b61038a565b604051610158919061173f565b61014e60035481565b61019d610198366004611794565b6103d9565b005b6101b26101ad3660046117cb565b610470565b60408051928352602083019190915201610158565b61019d6101d5366004611724565b610669565b61019d6101e8366004611825565b5050565b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610158565b61023e6102393660046117cb565b610762565b6040805193845273ffffffffffffffffffffffffffffffffffffffff909216602084015290820152606001610158565b610276610876565b6040516101589190611867565b6102b16102913660046118b5565b600460209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610158565b610174610909565b61023e6102d73660046117cb565b6109fc565b7f0000000000000000000000000000000000000000000000000000000000000000610206565b61014e610310366004611724565b60026020526000908152604090205481565b61014e620f424081565b61019d61033a366004611724565b610b91565b60015473ffffffffffffffffffffffffffffffffffffffff16610206565b600061036a848484610c89565b73ffffffffffffffffffffffffffffffffffffffff1690505b9392505050565b604080516001808252818301909252606091602080830190803683370190505090506103b582610d7d565b816000815181106103c8576103c86118e8565b602002602001018181525050919050565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f1d3e246ebbc933bf65d3290db9f93d67ab91a12d2b19308a35806e04d1c174c5910160405180910390a35050565b60008054819073ffffffffffffffffffffffffffffffffffffffff1633146104df5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000851161052f5760405162461bcd60e51b815260206004820152600360248201527f736d31000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b600061053c878686610c89565b6003549091506000906105889073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908a8a610df0565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260408120805492935083929091906105c2908490611946565b9250508190555080600360008282546105db9190611946565b9091555050604080518881526020810183905273ffffffffffffffffffffffffffffffffffffffff848116927f0000000000000000000000000000000000000000000000000000000000000000821692918c169184917f020c82fffaa7f476edc4d209bc47371cb11635b2077978c27e7c39360146d2ed910160405180910390a49890975095505050505050565b610671610f90565b73ffffffffffffffffffffffffffffffffffffffff81166106d45760405162461bcd60e51b815260206004820152600360248201527f6f6334000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600080548190819073ffffffffffffffffffffffffffffffffffffffff1633146107ce5760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60006107db888787610c89565b905060006107e98289610ff9565b604080518a81526020810183905291925073ffffffffffffffffffffffffffffffffffffffff808516927f0000000000000000000000000000000000000000000000000000000000000000821692918d169184917f636cc28d1dc3c5f8610bbd1cabdf6585ab2ef79f4b9ae78e840c1b8fd5ac887a91015b60405180910390a49990975095505050505050565b604080516001808252818301909252606091602080830190803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000816000815181106108cc576108cc6118e8565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505090565b60408051600180825281830190925260609160208083019080368337019050506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190611959565b816000815181106109ed576109ed6118e8565b60200260200101818152505090565b600080548190819073ffffffffffffffffffffffffffffffffffffffff163314610a685760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b6000610a75888787610c89565b90506000610a838289610ff9565b90508060036000828254610a979190611972565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054839290610ad1908490611972565b90915550610b18905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168a8a6111a8565b604080518981526020810183905273ffffffffffffffffffffffffffffffffffffffff808516927f0000000000000000000000000000000000000000000000000000000000000000821692918d169184917f31d5ceefd9ae9f1d896ec09a203f74a59524f36c970d3ede03478bb30c550a219101610861565b610b99610f90565b73ffffffffffffffffffffffffffffffffffffffff8116610bfc5760405162461bcd60e51b815260206004820152600360248201527f6f6333000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000811580610c985750602082145b610ce45760405162461bcd60e51b815260206004820152600360248201527f736d37000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b8115610d765760843573ffffffffffffffffffffffffffffffffffffffff81811660009081526004602090815260408083209389168352929052205460ff16610d6f5760405162461bcd60e51b815260206004820152600360248201527f736d38000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b9050610383565b5082610383565b6000600354600003610d9157506000919050565b60035473ffffffffffffffffffffffffffffffffffffffff808416600090815260026020526040902054610dea927f00000000000000000000000000000000000000000000000000000000000000009092169190611281565b92915050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa158015610e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e839190611959565b9050610ea773ffffffffffffffffffffffffffffffffffffffff8716853086611341565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090829073ffffffffffffffffffffffffffffffffffffffff8916906370a0823190602401602060405180830381865afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190611959565b610f449190611972565b90506000808311610f6157610f5c620f424083611985565b610f76565b82610f6c8389611985565b610f76919061199c565b905060008111610f8557600080fd5b979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ff75760405162461bcd60e51b815260206004820152600360248201527f6f6331000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b565b600080821161104a5760405162461bcd60e51b815260206004820152600360248201527f736d33000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60006003541161109c5760405162461bcd60e51b815260206004820152600360248201527f736d34000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b6003546110e19073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690846113a5565b9050600081116111335760405162461bcd60e51b815260206004820152600360248201527f736d35000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054811115610dea5760405162461bcd60e51b815260206004820152600360248201527f736d36000000000000000000000000000000000000000000000000000000000060448201526064016104d6565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261127c9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261144f565b505050565b60008260000361129357506000610383565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201528390839073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa158015611301573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113259190611959565b61132f9190611985565b611339919061199c565b949350505050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261139f9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016111fa565b50505050565b6000826000036113b757506000610383565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114459190611959565b61132f8385611985565b60006114b1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115419092919063ffffffff16565b80519091501561127c57808060200190518101906114cf91906119d7565b61127c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016104d6565b606061133984846000858573ffffffffffffffffffffffffffffffffffffffff85163b6115b05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104d6565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516115d99190611a18565b60006040518083038185875af1925050503d8060008114611616576040519150601f19603f3d011682016040523d82523d6000602084013e61161b565b606091505b5091509150610f8582828660608315611635575081610383565b8251156116455782518084602001fd5b8160405162461bcd60e51b81526004016104d69190611a34565b803573ffffffffffffffffffffffffffffffffffffffff8116811461168357600080fd5b919050565b60008083601f84011261169a57600080fd5b50813567ffffffffffffffff8111156116b257600080fd5b6020830191508360208285010111156116ca57600080fd5b9250929050565b6000806000604084860312156116e657600080fd5b6116ef8461165f565b9250602084013567ffffffffffffffff81111561170b57600080fd5b61171786828701611688565b9497909650939450505050565b60006020828403121561173657600080fd5b6103838261165f565b6020808252825182820181905260009190848201906040850190845b818110156117775783518352928401929184019160010161175b565b50909695505050505050565b801515811461179157600080fd5b50565b600080604083850312156117a757600080fd5b6117b08361165f565b915060208301356117c081611783565b809150509250929050565b600080600080606085870312156117e157600080fd5b6117ea8561165f565b935060208501359250604085013567ffffffffffffffff81111561180d57600080fd5b61181987828801611688565b95989497509550505050565b6000806020838503121561183857600080fd5b823567ffffffffffffffff81111561184f57600080fd5b61185b85828601611688565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561177757835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101611883565b600080604083850312156118c857600080fd5b6118d18361165f565b91506118df6020840161165f565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610dea57610dea611917565b60006020828403121561196b57600080fd5b5051919050565b81810381811115610dea57610dea611917565b8082028115828204841417610dea57610dea611917565b6000826119d2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156119e957600080fd5b815161038381611783565b60005b83811015611a0f5781810151838201526020016119f7565b50506000910152565b60008251611a2a8184602087016119f4565b9190910192915050565b6020815260008251806020840152611a538160408501602087016119f4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212201135d50a532ac887b2356b00448ff674851de8008430d64a5901689ccc0c422864736f6c63430008120033a2646970667358221220385b2b181f8a17ddd16e9584b4800846cdc16ec8101eacf3f408dfe775b4e44d64736f6c63430008120033
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.