Contract Overview
Balance:
0 CLV
CLV Value:
$0.00
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
PoolFactory
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @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(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// 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.8.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.8.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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
/* IEvents https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @title GYSR event system * * @notice common interface to define GYSR event system */ interface IEvents { // staking event Staked( address indexed user, address indexed token, uint256 amount, uint256 shares ); event Unstaked( address indexed user, address indexed token, uint256 amount, uint256 shares ); event Claimed( address indexed user, address indexed token, uint256 amount, uint256 shares ); // 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 RewardsUnlocked(address indexed token, uint256 shares); event RewardsExpired( address indexed token, uint256 amount, uint256 shares, uint256 timestamp ); // gysr event GysrSpent(address indexed user, uint256 amount); event GysrVested(address indexed user, uint256 amount); event GysrWithdrawn(uint256 amount); }
/* IModuleFactory https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @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 data binary encoded construction parameters * @return address of newly created module */ function createModule(bytes calldata data) external returns (address); }
/* IPool https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @title Pool interface * * @notice this defines the core Pool contract interface */ interface IPool { /** * @return staking tokens for Pool */ function stakingTokens() external view returns (address[] memory); /** * @return reward tokens for Pool */ function rewardTokens() external view returns (address[] memory); /** * @return staking balances for user */ function stakingBalances(address user) external view returns (uint256[] memory); /** * @return total staking balances for Pool */ function stakingTotals() external view returns (uint256[] memory); /** * @return reward balances for Pool */ function rewardBalances() external view returns (uint256[] memory); /** * @return GYSR usage ratio for Pool */ function usage() external view returns (uint256); /** * @return address of staking module */ function stakingModule() external view returns (address); /** * @return address of reward module */ function rewardModule() external view returns (address); /** * @notice stake asset and begin earning rewards * @param amount number of tokens to stake * @param stakingdata data passed to staking module * @param rewarddata data passed to reward module */ function stake( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external; /** * @notice unstake asset and claim rewards * @param amount number of tokens to unstake * @param stakingdata data passed to staking module * @param rewarddata data passed to reward module */ function unstake( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external; /** * @notice claim rewards without unstaking * @param amount number of tokens to claim against * @param stakingdata data passed to staking module * @param rewarddata data passed to reward module */ function claim( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external; /** * @notice method called ad hoc to update user accounting */ function update() external; /** * @notice method called ad hoc to clean up and perform additional accounting */ function clean() external; /** * @return gysr balance available for withdrawal */ function gysrBalance() external view returns (uint256); /** * @notice withdraw GYSR tokens applied during unstaking * @param amount number of GYSR to withdraw */ function withdraw(uint256 amount) external; }
/* IPoolFactory https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @title Pool factory interface * * @notice this defines the Pool factory interface, primarily intended for * the Pool contract to interact with */ interface IPoolFactory { /** * @return GYSR treasury address */ function treasury() external view returns (address); /** * @return GYSR spending fee */ function fee() external view returns (uint256); }
/* IRewardModule https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IEvents.sol"; import "../OwnerController.sol"; /** * @title Reward module interface * * @notice this contract defines the common interface that any reward module * must implement to be compatible with the modular Pool architecture. */ abstract contract IRewardModule is OwnerController, IEvents { // constants uint256 public constant DECIMALS = 18; /** * @return array of reward tokens */ function tokens() external view virtual returns (address[] memory); /** * @return array of reward token balances */ function balances() external view virtual returns (uint256[] memory); /** * @return GYSR usage ratio for reward module */ function usage() external view virtual returns (uint256); /** * @return address of module factory */ function factory() external view virtual returns (address); /** * @notice perform any necessary accounting for new stake * @param account address of staking account * @param user address of user * @param shares number of new shares minted * @param data addtional data * @return amount of gysr spent * @return amount of gysr vested */ function stake( address account, address user, uint256 shares, bytes calldata data ) external virtual returns (uint256, uint256); /** * @notice reward user and perform any necessary accounting for unstake * @param account address of staking account * @param user address of user * @param shares number of shares burned * @param data additional data * @return amount of gysr spent * @return amount of gysr vested */ function unstake( address account, address user, uint256 shares, bytes calldata data ) external virtual returns (uint256, uint256); /** * @notice reward user and perform and necessary accounting for existing stake * @param account address of staking account * @param user address of user * @param shares number of shares being claimed against * @param data addtional data * @return amount of gysr spent * @return amount of gysr vested */ function claim( address account, address user, uint256 shares, bytes calldata data ) external virtual returns (uint256, uint256); /** * @notice method called by anyone to update accounting * @param user address of user for update * @dev will only be called ad hoc and should not contain essential logic */ function update(address user) external virtual; /** * @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 */ function clean() external virtual; }
/* IStakingModule https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IEvents.sol"; import "../OwnerController.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. */ abstract contract IStakingModule is OwnerController, IEvents { // constants uint256 public constant DECIMALS = 18; /** * @return array of staking tokens */ function tokens() external view virtual 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 virtual returns (uint256[] memory); /** * @return address of module factory */ function factory() external view virtual returns (address); /** * @notice get total staked amount * @return totals for each staking token */ function totals() external view virtual returns (uint256[] memory); /** * @notice stake an amount of tokens for user * @param user address of user * @param amount number of tokens to stake * @param data additional data * @return address of staking account * @return number of shares minted for stake */ function stake( address user, uint256 amount, bytes calldata data ) external virtual returns (address, uint256); /** * @notice unstake an amount of tokens for user * @param user address of user * @param amount number of tokens to unstake * @param data additional data * @return address of staking account * @return number of shares burned for unstake */ function unstake( address user, uint256 amount, bytes calldata data ) external virtual returns (address, uint256); /** * @notice quote the share value for an amount of tokens without unstaking * @param user address of user * @param amount number of tokens to claim with * @param data additional data * @return address of staking account * @return number of shares that the claim amount is worth */ function claim( address user, uint256 amount, bytes calldata data ) external virtual returns (address, uint256); /** * @notice method called by anyone to update accounting * @param user address of user for update * @dev will only be called ad hoc and should not contain essential logic */ function update(address user) external virtual; /** * @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 */ function clean() external virtual; }
/* OwnerController https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; /** * @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 { 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 returns (address) { return _owner; } /** * @dev Returns the address of the current controller. */ function controller() public view returns (address) { return _controller; } /** * @dev Modifier that throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == msg.sender, "Only owner can perform this action"); _; } /** * @dev Modifier that throws if called by any account other than the controller. */ modifier onlyController() { require(_controller == msg.sender, "Only controller can perform this action"); _; } /** * @dev Throws if called by any account other than the owner. */ function requireOwner() internal view { require(_owner == msg.sender, "Only owner can perform this action"); } /** * @dev Throws if called by any account other than the controller. */ function requireController() internal view { require(_controller == msg.sender, "Only controller can perform this action"); } /** * @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 { requireOwner(); require(newOwner != address(0), "New owner address can't be zero"); 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 { requireOwner(); require(newController != address(0), "New controller address can't be zero"); emit ControlTransferred(_controller, newController); _controller = newController; } }
/* Pool https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces/IPool.sol"; import "./interfaces/IPoolFactory.sol"; import "./interfaces/IStakingModule.sol"; import "./interfaces/IRewardModule.sol"; import "./interfaces/IEvents.sol"; import "./OwnerController.sol"; /** * @title Pool * * @notice this implements the GYSR core Pool contract. It supports generalized * incentive mechanisms through a modular architecture, where * staking and reward logic is contained in child contracts. */ contract Pool is IPool, IEvents, ReentrancyGuard, OwnerController { using SafeERC20 for IERC20; // constants uint256 public constant DECIMALS = 18; // modules IStakingModule private immutable _staking; IRewardModule private immutable _reward; // gysr fields IERC20 private immutable _gysr; IPoolFactory private immutable _factory; uint256 private _gysrVested; //anti flash loan mapping(address => uint256) public _updated; /** * @param staking_ the staking module address * @param reward_ the reward module address * @param gysr_ address for GYSR token * @param factory_ address for parent factory */ constructor( address staking_, address reward_, address gysr_, address factory_ ) { _staking = IStakingModule(staking_); _reward = IRewardModule(reward_); _gysr = IERC20(gysr_); _factory = IPoolFactory(factory_); } // -- IPool -------------------------------------------------------------- /** * @inheritdoc IPool */ function stakingTokens() external view override returns (address[] memory) { return _staking.tokens(); } /** * @inheritdoc IPool */ function rewardTokens() external view override returns (address[] memory) { return _reward.tokens(); } /** * @inheritdoc IPool */ function stakingBalances(address user) external view override returns (uint256[] memory) { return _staking.balances(user); } /** * @inheritdoc IPool */ function stakingTotals() external view override returns (uint256[] memory) { return _staking.totals(); } /** * @inheritdoc IPool */ function rewardBalances() external view override returns (uint256[] memory) { return _reward.balances(); } /** * @inheritdoc IPool */ function usage() external view override returns (uint256) { return _reward.usage(); } /** * @inheritdoc IPool */ function stakingModule() external view override returns (address) { return address(_staking); } /** * @inheritdoc IPool */ function rewardModule() external view override returns (address) { return address(_reward); } /** * @inheritdoc IPool */ function stake( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external override nonReentrant { (address account, uint256 shares) = _staking.stake(msg.sender, amount, stakingdata); (uint256 spent, uint256 vested) = _reward.stake(account, msg.sender, shares, rewarddata); _processGysr(spent, vested); _updated[msg.sender] = block.timestamp; } /** * @inheritdoc IPool */ function unstake( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external override nonReentrant { require(_updated[msg.sender] < block.timestamp, "Unstaking can't be done in same block with staking"); (address account, uint256 shares) = _staking.unstake(msg.sender, amount, stakingdata); (uint256 spent, uint256 vested) = _reward.unstake(account, msg.sender, shares, rewarddata); _processGysr(spent, vested); } /** * @inheritdoc IPool */ function claim( uint256 amount, bytes calldata stakingdata, bytes calldata rewarddata ) external override nonReentrant { (address account, uint256 shares) = _staking.claim(msg.sender, amount, stakingdata); (uint256 spent, uint256 vested) = _reward.claim(account, msg.sender, shares, rewarddata); _processGysr(spent, vested); } /** * @inheritdoc IPool */ function update() external override nonReentrant { _staking.update(msg.sender); _reward.update(msg.sender); } /** * @inheritdoc IPool */ function clean() external override nonReentrant { requireController(); _staking.clean(); _reward.clean(); } /** * @inheritdoc IPool */ function gysrBalance() external view override returns (uint256) { return _gysrVested; } /** * @inheritdoc IPool */ function withdraw(uint256 amount) external override { requireController(); require(amount > 0, "Withdraw amount must be greater than 0"); require(amount <= _gysrVested, "Insufficient amount to withdraw"); // do transfer _gysr.safeTransfer(msg.sender, amount); _gysrVested = _gysrVested - amount; emit GysrWithdrawn(amount); } /** * @notice transfer control of the Pool and modules to another account * @param newController address of new controller */ function transferControl(address newController) public override { super.transferControl(newController); _staking.transferControl(newController); _reward.transferControl(newController); } // -- Pool internal ----------------------------------------------------- /** * @dev private method to process GYSR spending and vesting * @param spent number of tokens spent by user * @param vested number of tokens vested */ function _processGysr(uint256 spent, uint256 vested) private { // spending if (spent > 0) { _gysr.safeTransferFrom(msg.sender, address(this), spent); } // vesting if (vested > 0) { uint256 fee = (vested * _factory.fee()) / 10**DECIMALS; if (fee > 0) { _gysr.safeTransfer(_factory.treasury(), fee); } _gysrVested = _gysrVested + vested - fee; } } }
/* PoolFactory https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "./interfaces/IPoolFactory.sol"; import "./interfaces/IModuleFactory.sol"; import "./interfaces/IStakingModule.sol"; import "./interfaces/IRewardModule.sol"; import "./OwnerController.sol"; import "./Pool.sol"; /** * @title Pool factory * * @notice this implements the Pool factory contract which allows any user to * easily configure and deploy their own Pool * * @dev it relies on a system of sub-factories which are responsible for the * creation of underlying staking and reward modules. This primary factory * calls each module factory and assembles the overall Pool contract. * * this contract also manages various privileged platform settings including * treasury address, fee amount, and module factory whitelist. */ contract PoolFactory is IPoolFactory, OwnerController { // events event PoolCreated(address indexed user, address pool); event FeeUpdated(uint256 previous, uint256 updated); event TreasuryUpdated(address previous, address updated); event WhitelistUpdated( address indexed factory, uint256 previous, uint256 updated ); // types enum ModuleFactoryType { Unknown, Staking, Reward } // constants uint256 public constant MAX_FEE = 20 * 10 ** 16; // 20% // fields mapping(address => bool) public map; address[] public list; address private _gysr; address private _treasury; uint256 private _fee; mapping(address => ModuleFactoryType) public whitelist; // time lock uint256 private constant _TIMELOCK = 2 days; uint256 public timelock; //time lock modifier notLocked() { require( timelock != 0 && timelock <= block.timestamp, "Function is timelocked" ); _; } /** * @param gysr_ address of GYSR token */ constructor(address gysr_, address treasury_) { _gysr = gysr_; _treasury = treasury_; _fee = MAX_FEE; } /** * @notice create a new Pool * @param staking address of factory that will be used to create staking module * @param reward address of factory that will be used to create reward module * @param stakingdata construction data for staking module factory * @param rewarddata construction data for reward module factory * @return address of newly created Pool */ function create( address staking, address reward, bytes calldata stakingdata, bytes calldata rewarddata ) external returns (address) { // validate require( whitelist[staking] == ModuleFactoryType.Staking, "Not found in whitelist of staking module" ); require( whitelist[reward] == ModuleFactoryType.Reward, "Not found in whitelist of reward module" ); // create modules address stakingModule = IModuleFactory(staking).createModule( stakingdata ); address rewardModule = IModuleFactory(reward).createModule(rewarddata); // create pool Pool pool = new Pool( stakingModule, rewardModule, _gysr, address(this) ); // set access IStakingModule(stakingModule).transferOwnership(address(pool)); IRewardModule(rewardModule).transferOwnership(address(pool)); pool.transferControl(msg.sender); // this also sets controller for modules pool.transferOwnership(msg.sender); // bookkeeping map[address(pool)] = true; list.push(address(pool)); // output emit PoolCreated(msg.sender, address(pool)); return address(pool); } //unlock timelock function unlockFunction() public onlyOwner { timelock = block.timestamp + _TIMELOCK; } //lock timelock function lockFunction() public onlyOwner { timelock = 0; } /** * @inheritdoc IPoolFactory */ function treasury() external view override returns (address) { return _treasury; } /** * @inheritdoc IPoolFactory */ function fee() external view override returns (uint256) { return _fee; } /** * @notice update the GYSR treasury address * @param treasury_ new value for treasury address */ function setTreasury(address treasury_) external notLocked { requireController(); emit TreasuryUpdated(_treasury, treasury_); _treasury = treasury_; } /** * @notice update the global GYSR spending fee * @param fee_ new value for GYSR spending fee */ function setFee(uint256 fee_) external notLocked { requireController(); require(fee_ <= MAX_FEE, "Fee can't be set as exceed Max value"); emit FeeUpdated(_fee, fee_); _fee = fee_; } /** * @notice set the whitelist status of a module factory * @param factory_ address of module factory * @param type_ updated whitelist status for module */ function setWhitelist(address factory_, uint256 type_) external { requireController(); require( type_ <= uint256(ModuleFactoryType.Reward), "Module Type Error!" ); require(factory_ != address(0), "Factory address can't be zero"); emit WhitelistUpdated(factory_, uint256(whitelist[factory_]), type_); whitelist[factory_] = ModuleFactoryType(type_); } /** * @return total number of Pools created by the factory */ function count() public view returns (uint256) { return list.length; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"gysr_","type":"address"},{"internalType":"address","name":"treasury_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousController","type":"address"},{"indexed":true,"internalType":"address","name":"newController","type":"address"}],"name":"ControlTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previous","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updated","type":"uint256"}],"name":"FeeUpdated","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":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previous","type":"address"},{"indexed":false,"internalType":"address","name":"updated","type":"address"}],"name":"TreasuryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"factory","type":"address"},{"indexed":false,"internalType":"uint256","name":"previous","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updated","type":"uint256"}],"name":"WhitelistUpdated","type":"event"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staking","type":"address"},{"internalType":"address","name":"reward","type":"address"},{"internalType":"bytes","name":"stakingdata","type":"bytes"},{"internalType":"bytes","name":"rewarddata","type":"bytes"}],"name":"create","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"list","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"map","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fee_","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"factory_","type":"address"},{"internalType":"uint256","name":"type_","type":"uint256"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newController","type":"address"}],"name":"transferControl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unlockFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"enum PoolFactory.ModuleFactoryType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506040516132e13803806132e183398101604081905261002f9161010d565b60008054336001600160a01b0319918216811783556001805490921681179091556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600080546040516001600160a01b0390911691907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a3600480546001600160a01b039384166001600160a01b031991821617909155600580549290931691161790556702c68af0bb14000060065561013f565b80516001600160a01b038116811461010857600080fd5b919050565b6000806040838503121561011f578182fd5b610128836100f1565b9150610136602084016100f1565b90509250929050565b6131938061014e6000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c8063b721ef6e116100b2578063ddca3f4311610081578063f0f4426011610066578063f0f442601461027c578063f2fde38b1461028f578063f77c4791146102a257600080fd5b8063ddca3f431461026c578063ef947a111461027457600080fd5b8063b721ef6e1461020e578063bc063e1a14610241578063bf14752a14610250578063d33219b41461026357600080fd5b806369fe0e2d1161010957806380c9419e116100ee57806380c9419e146101ba5780638da5cb5b146101cd5780639b19251a146101de57600080fd5b806369fe0e2d146101945780636d16fa41146101a757600080fd5b806306661abd1461013b5780630b651cd6146101525780631302d03a1461015c57806361d027b31461016f575b600080fd5b6003545b6040519081526020015b60405180910390f35b61015a6102b3565b005b61015a61016a366004611039565b61032f565b6005546001600160a01b03165b6040516001600160a01b039091168152602001610149565b61015a6101a2366004611064565b6104bb565b61015a6101b5366004610f68565b6105e0565b61017c6101c8366004611064565b6106cc565b6000546001600160a01b031661017c565b6102016101ec366004610f68565b60076020526000908152604090205460ff1681565b60405161014991906110ab565b61023161021c366004610f68565b60026020526000908152604090205460ff1681565b6040519015158152602001610149565b61013f6702c68af0bb14000081565b61017c61025e366004610fa7565b6106f6565b61013f60085481565b60065461013f565b61015a610c1d565b61015a61028a366004610f68565b610c89565b61015a61029d366004610f68565b610d66565b6001546001600160a01b031661017c565b6000546001600160a01b0316331461031d5760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b60648201526084015b60405180910390fd5b61032a6202a300426110d3565b600855565b610337610e2c565b60028111156103885760405162461bcd60e51b815260206004820152601260248201527f4d6f64756c652054797065204572726f722100000000000000000000000000006044820152606401610314565b6001600160a01b0382166103de5760405162461bcd60e51b815260206004820152601d60248201527f466163746f727920616464726573732063616e2774206265207a65726f0000006044820152606401610314565b6001600160a01b0382166000818152600760205260409020547f1f9a093b2e93f445118693693f1e05c8435a7c6081c00b7086c5aaf5ddbf95979060ff16600281111561043b57634e487b7160e01b600052602160045260246000fd5b60408051918252602082018590520160405180910390a280600281111561047257634e487b7160e01b600052602160045260246000fd5b6001600160a01b0383166000908152600760205260409020805460ff191660018360028111156104b257634e487b7160e01b600052602160045260246000fd5b02179055505050565b600854158015906104ce57504260085411155b61051a5760405162461bcd60e51b815260206004820152601660248201527f46756e6374696f6e2069732074696d656c6f636b6564000000000000000000006044820152606401610314565b610522610e2c565b6702c68af0bb14000081111561059f5760405162461bcd60e51b8152602060048201526024808201527f4665652063616e27742062652073657420617320657863656564204d6178207660448201527f616c7565000000000000000000000000000000000000000000000000000000006064820152608401610314565b60065460408051918252602082018390527f528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302910160405180910390a1600655565b6105e8610eae565b6001600160a01b0381166106635760405162461bcd60e51b8152602060048201526024808201527f4e657720636f6e74726f6c6c657220616464726573732063616e27742062652060448201527f7a65726f000000000000000000000000000000000000000000000000000000006064820152608401610314565b6001546040516001600160a01b038084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600381815481106106dc57600080fd5b6000918252602090912001546001600160a01b0316905081565b600060016001600160a01b03881660009081526007602052604090205460ff16600281111561073557634e487b7160e01b600052602160045260246000fd5b146107a85760405162461bcd60e51b815260206004820152602860248201527f4e6f7420666f756e6420696e2077686974656c697374206f66207374616b696e60448201527f67206d6f64756c650000000000000000000000000000000000000000000000006064820152608401610314565b60026001600160a01b03871660009081526007602052604090205460ff1660028111156107e557634e487b7160e01b600052602160045260246000fd5b146108585760405162461bcd60e51b815260206004820152602760248201527f4e6f7420666f756e6420696e2077686974656c697374206f662072657761726460448201527f206d6f64756c65000000000000000000000000000000000000000000000000006064820152608401610314565b6040517eee8fe50000000000000000000000000000000000000000000000000000000081526000906001600160a01b0389169062ee8fe5906108a0908990899060040161107c565b602060405180830381600087803b1580156108ba57600080fd5b505af11580156108ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f29190610f8b565b90506000876001600160a01b031662ee8fe586866040518363ffffffff1660e01b815260040161092392919061107c565b602060405180830381600087803b15801561093d57600080fd5b505af1158015610951573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109759190610f8b565b905060008282600460009054906101000a90046001600160a01b03163060405161099e90610f13565b6001600160a01b039485168152928416602084015290831660408301529091166060820152608001604051809103906000f0801580156109e2573d6000803e3d6000fd5b5060405163f2fde38b60e01b81526001600160a01b0380831660048301529192509084169063f2fde38b90602401600060405180830381600087803b158015610a2a57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b0384811660048301528516925063f2fde38b9150602401600060405180830381600087803b158015610a8557600080fd5b505af1158015610a99573d6000803e3d6000fd5b50506040517f6d16fa410000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0384169250636d16fa419150602401600060405180830381600087803b158015610af757600080fd5b505af1158015610b0b573d6000803e3d6000fd5b505060405163f2fde38b60e01b81523360048201526001600160a01b038416925063f2fde38b9150602401600060405180830381600087803b158015610b5057600080fd5b505af1158015610b64573d6000803e3d6000fd5b505050506001600160a01b0381166000818152600260209081526040808320805460ff191660019081179091556003805491820181559093527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b909201805473ffffffffffffffffffffffffffffffffffffffff191684179055905191825233917f4f2ce4e40f623ca765fc0167a25cb7842ceaafb8d82d3dec26ca0d0e0d2d4896910160405180910390a29998505050505050505050565b6000546001600160a01b03163314610c825760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b6064820152608401610314565b6000600855565b60085415801590610c9c57504260085411155b610ce85760405162461bcd60e51b815260206004820152601660248201527f46756e6374696f6e2069732074696d656c6f636b6564000000000000000000006044820152606401610314565b610cf0610e2c565b600554604080516001600160a01b03928316815291831660208301527f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a910160405180910390a16005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610d6e610eae565b6001600160a01b038116610dc45760405162461bcd60e51b815260206004820152601f60248201527f4e6577206f776e657220616464726573732063616e2774206265207a65726f006044820152606401610314565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610eac5760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920636f6e74726f6c6c65722063616e20706572666f726d207468697360448201527f20616374696f6e000000000000000000000000000000000000000000000000006064820152608401610314565b565b6000546001600160a01b03163314610eac5760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b6064820152608401610314565b61204e806200111083390190565b60008083601f840112610f32578182fd5b50813567ffffffffffffffff811115610f49578182fd5b602083019150836020828501011115610f6157600080fd5b9250929050565b600060208284031215610f79578081fd5b8135610f84816110f7565b9392505050565b600060208284031215610f9c578081fd5b8151610f84816110f7565b60008060008060008060808789031215610fbf578182fd5b8635610fca816110f7565b95506020870135610fda816110f7565b9450604087013567ffffffffffffffff80821115610ff6578384fd5b6110028a838b01610f21565b9096509450606089013591508082111561101a578384fd5b5061102789828a01610f21565b979a9699509497509295939492505050565b6000806040838503121561104b578182fd5b8235611056816110f7565b946020939093013593505050565b600060208284031215611075578081fd5b5035919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60208101600383106110cd57634e487b7160e01b600052602160045260246000fd5b91905290565b600082198211156110f257634e487b7160e01b81526011600452602481fd5b500190565b6001600160a01b038116811461110c57600080fd5b5056fe6101006040523480156200001257600080fd5b506040516200204e3803806200204e83398101604081905262000035916200010a565b600160008181558154336001600160a01b0319918216811790935560028054909116831790556040517f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36001546040516001600160a01b03909116906000907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a36001600160601b0319606094851b811660805292841b831660a05290831b821660c05290911b1660e05262000166565b80516001600160a01b03811681146200010557600080fd5b919050565b6000806000806080858703121562000120578384fd5b6200012b85620000ed565b93506200013b60208601620000ed565b92506200014b60408601620000ed565b91506200015b60608601620000ed565b905092959194509250565b60805160601c60a05160601c60c05160601c60e05160601c611e0f6200023f6000396000818161108701526111370152600081816105750152818161104901526111d00152600081816102c6015281816103cd015281816107e10152818161083f0152818161098501528181610aeb01528181610b6101528181610bbc01528181610de50152610f830152600081816101c5015281816103230152818161061e015281816106a801528181610768015281816108db01528181610a7401528181610c5301528181610d3b0152610f100152611e0f6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806396ce3f0b116100d8578063d12e56b41161008c578063f2fde38b11610066578063f2fde38b146102ea578063f77c4791146102fd578063fc4333cd1461030e57600080fd5b8063d12e56b4146102a9578063e0667165146102b1578063e70c20d9146102c457600080fd5b8063a2e62045116100bd578063a2e6204514610284578063b2e4a7e51461028c578063c2b18aa01461029457600080fd5b806396ce3f0b1461025157806398d0062c1461026457600080fd5b806361b8b5dc1161012f5780636d16fa41116101145780636d16fa41146102255780636d811e71146102385780638da5cb5b1461024057600080fd5b806361b8b5dc146101fd57806368ba5a421461021d57600080fd5b80632e0f2625116101605780632e0f2625146101a85780632e1a7d4d146101b0578063504b82bf146101c357600080fd5b806308aa325f1461017c5780632971c33e14610191575b600080fd5b61018f61018a3660046119be565b610316565b005b6003545b6040519081526020015b60405180910390f35b610195601281565b61018f6101be36600461198e565b610493565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161019f565b61021061020b3660046117da565b6105e3565b60405161019f9190611b50565b6102106106a4565b61018f6102333660046117da565b610740565b61019561083b565b6001546001600160a01b03166101e5565b61018f61025f3660046119be565b6108ce565b6101956102723660046117da565b60046020526000908152604090205481565b61018f610a57565b610210610b5d565b61029c610bb8565b60405161019f9190611b03565b61029c610c4f565b61018f6102bf3660046119be565b610caa565b7f00000000000000000000000000000000000000000000000000000000000000006101e5565b61018f6102f83660046117da565b610e37565b6002546001600160a01b03166101e5565b61018f610efe565b61031e610fdc565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638f0bc152338989896040518563ffffffff1660e01b81526004016103739493929190611ad0565b6040805180830381600087803b15801561038c57600080fd5b505af11580156103a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c49190611819565b915091506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c7537f368533868a8a6040518663ffffffff1660e01b815260040161041f959493929190611a9d565b6040805180830381600087803b15801561043857600080fd5b505af115801561044c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104709190611a35565b9150915061047e8282611036565b5050505061048c6001600055565b5050505050565b61049b611219565b600081116105165760405162461bcd60e51b815260206004820152602660248201527f576974686472617720616d6f756e74206d75737420626520677265617465722060448201527f7468616e2030000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6003548111156105685760405162461bcd60e51b815260206004820152601f60248201527f496e73756666696369656e7420616d6f756e7420746f20776974686472617700604482015260640161050d565b61059c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163383611299565b806003546105aa9190611d52565b6003556040518181527f9893b6ecc024ca2ea684c8b98d392ba3e47fd995e6f6ddddc1b0c7acf5b9dd2b9060200160405180910390a150565b6040517f27e235e30000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301526060917f0000000000000000000000000000000000000000000000000000000000000000909116906327e235e39060240160006040518083038186803b15801561066257600080fd5b505afa158015610676573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261069e91908101906118e7565b92915050565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c038a38e6040518163ffffffff1660e01b815260040160006040518083038186803b1580156106ff57600080fd5b505afa158015610713573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261073b91908101906118e7565b905090565b61074981611347565b604051636d16fa4160e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636d16fa4190602401600060405180830381600087803b1580156107ac57600080fd5b505af11580156107c0573d6000803e3d6000fd5b5050604051636d16fa4160e01b81526001600160a01b0384811660048301527f0000000000000000000000000000000000000000000000000000000000000000169250636d16fa419150602401600060405180830381600087803b15801561082757600080fd5b505af115801561048c573d6000803e3d6000fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636d811e716040518163ffffffff1660e01b815260040160206040518083038186803b15801561089657600080fd5b505afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073b91906119a6565b6108d6610fdc565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633e12170f338989896040518563ffffffff1660e01b815260040161092b9493929190611ad0565b6040805180830381600087803b15801561094457600080fd5b505af1158015610958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097c9190611819565b915091506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634854b1438533868a8a6040518663ffffffff1660e01b81526004016109d7959493929190611a9d565b6040805180830381600087803b1580156109f057600080fd5b505af1158015610a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a289190611a35565b91509150610a368282611036565b50503360009081526004602052604090204290555061048c90506001600055565b610a5f610fdc565b604051630e0dc3b960e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690631c1b877290602401600060405180830381600087803b158015610ac057600080fd5b505af1158015610ad4573d6000803e3d6000fd5b5050604051630e0dc3b960e11b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169250631c1b87729150602401600060405180830381600087803b158015610b3957600080fd5b505af1158015610b4d573d6000803e3d6000fd5b50505050610b5b6001600055565b565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637bb98a686040518163ffffffff1660e01b815260040160006040518083038186803b1580156106ff57600080fd5b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639d63848a6040518163ffffffff1660e01b815260040160006040518083038186803b158015610c1357600080fd5b505afa158015610c27573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261073b9190810190611846565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639d63848a6040518163ffffffff1660e01b815260040160006040518083038186803b158015610c1357600080fd5b610cb2610fdc565b336000908152600460205260409020544211610d365760405162461bcd60e51b815260206004820152603260248201527f556e7374616b696e672063616e277420626520646f6e6520696e2073616d652060448201527f626c6f636b2077697468207374616b696e670000000000000000000000000000606482015260840161050d565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c4113b88338989896040518563ffffffff1660e01b8152600401610d8b9493929190611ad0565b6040805180830381600087803b158015610da457600080fd5b505af1158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190611819565b915091506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c148cf858533868a8a6040518663ffffffff1660e01b815260040161041f959493929190611a9d565b610e3f611433565b6001600160a01b038116610e955760405162461bcd60e51b815260206004820152601f60248201527f4e6577206f776e657220616464726573732063616e2774206265207a65726f00604482015260640161050d565b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610f06610fdc565b610f0e611219565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fc4333cd6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f6957600080fd5b505af1158015610f7d573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fc4333cd6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b3957600080fd5b6002600054141561102f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161050d565b6002600055565b8115611071576110716001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330856114b3565b80156112155760006110856012600a611c8b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddca3f436040518163ffffffff1660e01b815260040160206040518083038186803b1580156110de57600080fd5b505afa1580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111691906119a6565b6111209084611d33565b61112a9190611c28565b905080156111f7576111f77f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166361d027b36040518163ffffffff1660e01b815260040160206040518083038186803b15801561118e57600080fd5b505afa1580156111a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c691906117fd565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169083611299565b80826003546112069190611c10565b6112109190611d52565b600355505b5050565b6002546001600160a01b03163314610b5b5760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920636f6e74726f6c6c65722063616e20706572666f726d207468697360448201527f20616374696f6e00000000000000000000000000000000000000000000000000606482015260840161050d565b6040516001600160a01b0383166024820152604481018290526113429084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261150a565b505050565b61134f611433565b6001600160a01b0381166113ca5760405162461bcd60e51b8152602060048201526024808201527f4e657720636f6e74726f6c6c657220616464726573732063616e27742062652060448201527f7a65726f00000000000000000000000000000000000000000000000000000000606482015260840161050d565b6002546040516001600160a01b038084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a36002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610b5b5760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201527f6f6e000000000000000000000000000000000000000000000000000000000000606482015260840161050d565b6040516001600160a01b03808516602483015283166044820152606481018290526115049085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016112de565b50505050565b600061155f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115ef9092919063ffffffff16565b805190915015611342578080602001905181019061157d919061196e565b6113425760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161050d565b60606115fe8484600085611606565b949350505050565b60608247101561167e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161050d565b600080866001600160a01b0316858760405161169a9190611a81565b60006040518083038185875af1925050503d80600081146116d7576040519150601f19603f3d011682016040523d82523d6000602084013e6116dc565b606091505b50915091506116ed878383876116f8565b979650505050505050565b6060831561176457825161175d576001600160a01b0385163b61175d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161050d565b50816115fe565b6115fe83838151156117795781518083602001fd5b8060405162461bcd60e51b815260040161050d9190611b88565b60008083601f8401126117a4578182fd5b50813567ffffffffffffffff8111156117bb578182fd5b6020830191508360208285010111156117d357600080fd5b9250929050565b6000602082840312156117eb578081fd5b81356117f681611dc1565b9392505050565b60006020828403121561180e578081fd5b81516117f681611dc1565b6000806040838503121561182b578081fd5b825161183681611dc1565b6020939093015192949293505050565b60006020808385031215611858578182fd5b825167ffffffffffffffff81111561186e578283fd5b8301601f8101851361187e578283fd5b805161189161188c82611bec565b611bbb565b80828252848201915084840188868560051b87010111156118b0578687fd5b8694505b838510156118db5780516118c781611dc1565b8352600194909401939185019185016118b4565b50979650505050505050565b600060208083850312156118f9578182fd5b825167ffffffffffffffff81111561190f578283fd5b8301601f8101851361191f578283fd5b805161192d61188c82611bec565b80828252848201915084840188868560051b870101111561194c578687fd5b8694505b838510156118db578051835260019490940193918501918501611950565b60006020828403121561197f578081fd5b815180151581146117f6578182fd5b60006020828403121561199f578081fd5b5035919050565b6000602082840312156119b7578081fd5b5051919050565b6000806000806000606086880312156119d5578081fd5b85359450602086013567ffffffffffffffff808211156119f3578283fd5b6119ff89838a01611793565b90965094506040880135915080821115611a17578283fd5b50611a2488828901611793565b969995985093965092949392505050565b60008060408385031215611a47578182fd5b505080516020909101519092909150565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008251611a93818460208701611d69565b9190910192915050565b60006001600160a01b038088168352808716602084015250846040830152608060608301526116ed608083018486611a58565b6001600160a01b0385168152836020820152606060408201526000611af9606083018486611a58565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611b445783516001600160a01b031683529284019291840191600101611b1f565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611b4457835183529284019291840191600101611b6c565b6020815260008251806020840152611ba7816040850160208701611d69565b601f01601f19169190910160400192915050565b604051601f8201601f1916810167ffffffffffffffff81118282101715611be457611be4611dab565b604052919050565b600067ffffffffffffffff821115611c0657611c06611dab565b5060051b60200190565b60008219821115611c2357611c23611d95565b500190565b600082611c4357634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115611c83578160001904821115611c6957611c69611d95565b80851615611c7657918102915b93841c9390800290611c4d565b509250929050565b60006117f68383600082611ca15750600161069e565b81611cae5750600061069e565b8160018114611cc45760028114611cce57611cea565b600191505061069e565b60ff841115611cdf57611cdf611d95565b50506001821b61069e565b5060208310610133831016604e8410600b8410161715611d0d575081810a61069e565b611d178383611c48565b8060001904821115611d2b57611d2b611d95565b029392505050565b6000816000190483118215151615611d4d57611d4d611d95565b500290565b600082821015611d6457611d64611d95565b500390565b60005b83811015611d84578181015183820152602001611d6c565b838111156115045750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611dd657600080fd5b5056fea2646970667358221220201021a46797956492cea12bf09eff46dc7c29613168662c61df002efcb5cabc64736f6c63430008040033a264697066735822122057db0fa22245ec5c9f48d73895408279a0645165a908b9eeb67cb5507b13b06364736f6c634300080400330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d134a7d9485c1aac0cbf82718cf6d6e3fd130945
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d134a7d9485c1aac0cbf82718cf6d6e3fd130945
-----Decoded View---------------
Arg [0] : gysr_ (address): 0x0000000000000000000000000000000000000000
Arg [1] : treasury_ (address): 0xd134a7d9485c1aac0cbf82718cf6d6e3fd130945
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 000000000000000000000000d134a7d9485c1aac0cbf82718cf6d6e3fd130945
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.