Contract Overview
Balance:
0 CLV
CLV Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x927b2667aeebb26a531762a94e60e4da91e9464ad96cee2afd269f6c4db6095f | 0x60806040 | 2711661 | 12 days 14 hrs ago | 0xd134a7d9485c1aac0cbf82718cf6d6e3fd130945 | IN | Create: ERC20CompetitiveRewardModuleFactory | 0 CLV | 0.02667452 |
[ Download CSV Export ]
Contract Name:
ERC20CompetitiveRewardModuleFactory
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 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); } } }
/* ERC20BaseRewardModule 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 "./interfaces/IRewardModule.sol"; /** * @title ERC20 base reward module * * @notice this abstract class implements common ERC20 funding and unlocking * logic, which is inherited by other reward modules. */ abstract contract ERC20BaseRewardModule is IRewardModule { using SafeERC20 for IERC20; // single funding/reward schedule struct Funding { uint256 amount; uint256 shares; uint256 locked; uint256 updated; uint256 start; uint256 duration; } // constants uint256 public constant INITIAL_SHARES_PER_TOKEN = 10**6; uint256 public constant MAX_ACTIVE_FUNDINGS = 16; // funding/reward state fields mapping(address => Funding[]) private _fundings; mapping(address => uint256) private _shares; mapping(address => uint256) private _locked; /** * @notice getter for total token shares */ function totalShares(address token) public view returns (uint256) { return _shares[token]; } /** * @notice getter for total locked token shares */ function lockedShares(address token) public view returns (uint256) { return _locked[token]; } /** * @notice getter for funding schedule struct */ function fundings(address token, uint256 index) public view returns ( uint256 amount, uint256 shares, uint256 locked, uint256 updated, uint256 start, uint256 duration ) { Funding storage f = _fundings[token][index]; return (f.amount, f.shares, f.locked, f.updated, f.start, f.duration); } /** * @param token contract address of reward token * @return number of active funding schedules */ function fundingCount(address token) public view returns (uint256) { return _fundings[token].length; } /** * @notice compute number of unlockable shares for a specific funding schedule * @param token contract address of reward token * @param idx index of the funding * @return the number of unlockable shares */ function unlockable(address token, uint256 idx) public view returns (uint256) { Funding storage funding = _fundings[token][idx]; // funding schedule is in future if (block.timestamp < funding.start) { return 0; } // empty if (funding.locked == 0) { return 0; } // handle zero-duration period or leftover dust from integer division if (block.timestamp >= funding.start + funding.duration) { return funding.locked; } return ((block.timestamp - funding.updated) * funding.shares) / funding.duration; } /** * @notice fund pool by locking up reward tokens for future distribution * @param token contract address of reward token * @param amount number of reward tokens to lock up as funding * @param duration period (seconds) over which funding will be unlocked * @param start time (seconds) at which funding begins to unlock */ function _fund( address token, uint256 amount, uint256 duration, uint256 start ) internal { requireController(); // validate require(amount > 0, "Funding amount must be greater than 0"); require(start >= block.timestamp, "Invalid funding start time"); require(_fundings[token].length < MAX_ACTIVE_FUNDINGS, "Exceeds max funding rounds"); IERC20 rewardToken = IERC20(token); // do transfer of funding uint256 total = rewardToken.balanceOf(address(this)); rewardToken.safeTransferFrom(msg.sender, address(this), amount); uint256 actual = rewardToken.balanceOf(address(this)) - total; // mint shares at current rate uint256 minted = (total > 0) ? (_shares[token] * actual) / total : actual * INITIAL_SHARES_PER_TOKEN; _locked[token] += minted; _shares[token] += minted; // create new funding _fundings[token].push( Funding({ amount: amount, shares: minted, locked: minted, updated: start, start: start, duration: duration }) ); emit RewardsFunded(token, amount, minted, start); } /** * @dev internal function to clean up stale funding schedules * @param token contract address of reward token to clean up */ function _clean(address token) internal { // check for stale funding schedules to expire uint256 removed = 0; uint256 originalSize = _fundings[token].length; for (uint256 i = 0; i < originalSize; i++) { Funding storage funding = _fundings[token][i - removed]; uint256 idx = i - removed; if ( unlockable(token, idx) == 0 && block.timestamp >= funding.start + funding.duration ) { emit RewardsExpired( token, funding.amount, funding.shares, funding.start ); // remove at idx by copying last element here, then popping off last // (we don't care about order) _fundings[token][idx] = _fundings[token][ _fundings[token].length - 1 ]; _fundings[token].pop(); removed++; } } } /** * @dev unlocks reward tokens based on funding schedules * @param token contract addres of reward token * @return shares number of shares unlocked */ function _unlockTokens(address token) internal returns (uint256 shares) { // get unlockable shares for each funding schedule for (uint256 i = 0; i < _fundings[token].length; i++) { uint256 s = unlockable(token, i); Funding storage funding = _fundings[token][i]; if (s > 0) { funding.locked -= s; funding.updated = block.timestamp; shares += s; } } // do unlocking if (shares > 0) { _locked[token] -= shares; emit RewardsUnlocked(token, shares); } } /** * @dev distribute reward tokens to user * @param user address of user receiving rweard * @param token contract address of reward token * @param shares number of shares to be distributed * @return amount number of reward tokens distributed */ function _distribute( address user, address token, uint256 shares ) internal returns (uint256 amount) { // compute reward amount in tokens IERC20 rewardToken = IERC20(token); amount = (rewardToken.balanceOf(address(this)) * shares) / _shares[token]; // update overall reward shares _shares[token] -= shares; // do reward rewardToken.safeTransfer(user, amount); emit RewardsDistributed(user, token, amount, shares); } }
/* ERC20CompetitiveRewardModule https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "./interfaces/IRewardModule.sol"; import "./ERC20BaseRewardModule.sol"; import "./GysrUtils.sol"; /** * @title ERC20 competitive reward module * * @notice this reward module distributes a single ERC20 token as the staking reward. * It is designed to offer competitive and engaging reward mechanics. * * @dev share seconds are the primary unit of accounting in this module. They * are accrued over time and burned during reward distribution. Users can * earn a time multiplier as an incentive for longer term staking. They can * also receive a GYSR multiplier by spending GYSR at the time of unstaking. * * h/t https://github.com/ampleforth/token-geyser */ contract ERC20CompetitiveRewardModule is ERC20BaseRewardModule { using SafeERC20 for IERC20; using GysrUtils for uint256; // single stake by user struct Stake { uint256 shares; uint256 timestamp; } mapping(address => Stake[]) public stakes; // configuration fields uint256 public immutable bonusMin; uint256 public immutable bonusMax; uint256 public immutable bonusPeriod; IERC20 private immutable _token; address private immutable _factory; // global state fields uint256 public totalStakingShares; uint256 public totalStakingShareSeconds; uint256 public lastUpdated; uint256 private _usage; /** * @param token_ the token that will be rewarded * @param bonusMin_ initial time bonus * @param bonusMax_ maximum time bonus * @param bonusPeriod_ period (in seconds) over which time bonus grows to max * @param factory_ address of module factory */ constructor( address token_, uint256 bonusMin_, uint256 bonusMax_, uint256 bonusPeriod_, address factory_ ) { require(bonusMin_ <= bonusMax_, "Bonus value setting error"); _token = IERC20(token_); _factory = factory_; bonusMin = bonusMin_; bonusMax = bonusMax_; bonusPeriod = bonusPeriod_; lastUpdated = block.timestamp; } // -- IRewardModule ------------------------------------------------------- /** * @inheritdoc IRewardModule */ function tokens() external view override returns (address[] memory tokens_) { tokens_ = new address[](1); tokens_[0] = address(_token); } /** * @inheritdoc IRewardModule */ function balances() external view override returns (uint256[] memory balances_) { balances_ = new uint256[](1); balances_[0] = totalLocked(); } /** * @inheritdoc IRewardModule */ function usage() external view override returns (uint256) { return _usage; } /** * @inheritdoc IRewardModule */ function factory() external view override returns (address) { return _factory; } /** * @inheritdoc IRewardModule */ function stake( address account, address, uint256 shares, bytes calldata ) external override onlyOwner returns (uint256, uint256) { _update(); _stake(account, shares); return (0, 0); } /** * @inheritdoc IRewardModule */ function unstake( address account, address user, uint256 shares, bytes calldata data ) external override onlyOwner returns (uint256, uint256) { _update(); return _unstake(account, user, shares, data); } /** * @inheritdoc IRewardModule */ function claim( address account, address user, uint256 shares, bytes calldata data ) external override onlyOwner returns (uint256 spent, uint256 vested) { _update(); (spent, vested) = _unstake(account, user, shares, data); _stake(account, shares); } /** * @inheritdoc IRewardModule */ function update(address) external override { requireOwner(); _update(); } /** * @inheritdoc IRewardModule */ function clean() external override { requireOwner(); _update(); _clean(address(_token)); } // -- ERC20CompetitiveRewardModule ---------------------------------------- /** * @notice fund module by locking up reward tokens for distribution * @param amount number of reward tokens to lock up as funding * @param duration period (seconds) over which funding will be unlocked */ function fund(uint256 amount, uint256 duration) external { _update(); _fund(address(_token), amount, duration, block.timestamp); } /** * @notice fund module by locking up reward tokens for distribution * @param amount number of reward tokens to lock up as funding * @param duration period (seconds) over which funding will be unlocked * @param start time (seconds) at which funding begins to unlock */ function fund( uint256 amount, uint256 duration, uint256 start ) external { _update(); _fund(address(_token), amount, duration, start); } /** * @notice compute time bonus earned as a function of staking time * @param time length of time for which the tokens have been staked * @return bonus multiplier for time */ function timeBonus(uint256 time) public view returns (uint256) { if (time >= bonusPeriod) { return 10**DECIMALS + bonusMax; } // linearly interpolate between bonus min and bonus max uint256 bonus = bonusMin + ((bonusMax - bonusMin) * time) / bonusPeriod; return 10**DECIMALS + bonus; } /** * @return total number of locked reward tokens */ function totalLocked() public view returns (uint256) { if (lockedShares(address(_token)) == 0) { return 0; } return (_token.balanceOf(address(this)) * lockedShares(address(_token))) / totalShares(address(_token)); } /** * @return total number of unlocked reward tokens */ function totalUnlocked() public view returns (uint256) { uint256 unlockedShares = totalShares(address(_token)) - lockedShares(address(_token)); if (unlockedShares == 0) { return 0; } return (_token.balanceOf(address(this)) * unlockedShares) / totalShares(address(_token)); } /** * @param addr address of interest * @return number of active stakes for user */ function stakeCount(address addr) public view returns (uint256) { return stakes[addr].length; } // -- ERC20CompetitiveRewardModule internal ------------------------------- /** * @dev internal implementation of stake method * @param account address of staking account * @param shares number of shares burned */ function _stake(address account, uint256 shares) private { // update user staking info stakes[account].push(Stake(shares, block.timestamp)); // add newly minted shares to global total totalStakingShares += shares; } /** * @dev internal implementation of unstake method * @param account address of staking account * @param user address of user * @param shares number of shares burned * @param data additional data * @return spent amount of gysr spent * @return vested amount of gysr vested */ function _unstake( address account, address user, uint256 shares, bytes calldata data ) private returns (uint256 spent, uint256 vested) { // validate // note: we assume shares has been validated upstream require(data.length == 0 || data.length == 32, "Invalid calldata"); // parse GYSR amount from data if (data.length == 32) { assembly { spent := calldataload(164) } } uint256 bonus = spent.gysrBonus(shares, totalStakingShares, _usage); // do unstaking, first-in last-out, respecting time bonus uint256 shareSeconds; uint256 timeWeightedShareSeconds; (shareSeconds, timeWeightedShareSeconds) = _unstakeFirstInLastOut( account, shares ); // compute and apply GYSR token bonus uint256 gysrWeightedShareSeconds = (bonus * timeWeightedShareSeconds) / 10**DECIMALS; // get reward in shares uint256 unlockedShares = totalShares(address(_token)) - lockedShares(address(_token)); uint256 rewardShares = (unlockedShares * gysrWeightedShareSeconds) / (totalStakingShareSeconds + gysrWeightedShareSeconds); if (rewardShares == 0) { return (0, 0); } // reward if (rewardShares > 0) { _distribute(user, address(_token), rewardShares); // update usage uint256 ratio; if (spent > 0) { vested = spent; emit GysrSpent(user, spent); emit GysrVested(user, vested); ratio = ((bonus - 10**DECIMALS) * 10**DECIMALS) / bonus; } uint256 weight = (shareSeconds * 10**DECIMALS) / (totalStakingShareSeconds + shareSeconds); _usage = _usage - (weight * _usage) / 10**DECIMALS + (weight * ratio) / 10**DECIMALS; } } /** * @dev internal implementation of update method to * unlock tokens and do global accounting */ function _update() private { _unlockTokens(address(_token)); // global accounting totalStakingShareSeconds += (block.timestamp - lastUpdated) * totalStakingShares; lastUpdated = block.timestamp; } /** * @dev helper function to actually execute unstaking, first-in last-out, while computing and applying time bonus. This function also updates user and global totals for shares and share-seconds. * @param user address of user * @param shares number of staking shares to burn * @return rawShareSeconds raw share seconds burned * @return bonusShareSeconds time bonus weighted share seconds */ function _unstakeFirstInLastOut(address user, uint256 shares) private returns (uint256 rawShareSeconds, uint256 bonusShareSeconds) { // redeem first-in-last-out uint256 sharesLeftToBurn = shares; Stake[] storage userStakes = stakes[user]; while (sharesLeftToBurn > 0) { Stake storage lastStake = userStakes[userStakes.length - 1]; uint256 stakeTime = block.timestamp - lastStake.timestamp; require(stakeTime > 0, "Unstaking can't be done in same block with staking"); uint256 bonus = timeBonus(stakeTime); if (lastStake.shares <= sharesLeftToBurn) { // fully redeem a past stake bonusShareSeconds += (lastStake.shares * stakeTime * bonus) / 10**DECIMALS; rawShareSeconds += lastStake.shares * stakeTime; sharesLeftToBurn -= lastStake.shares; userStakes.pop(); } else { // partially redeem a past stake bonusShareSeconds += (sharesLeftToBurn * stakeTime * bonus) / 10**DECIMALS; rawShareSeconds += sharesLeftToBurn * stakeTime; lastStake.shares -= sharesLeftToBurn; sharesLeftToBurn = 0; } } // update global totals totalStakingShareSeconds -= rawShareSeconds; totalStakingShares -= shares; } }
/* ERC20CompetitiveRewardModuleFactory https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "./interfaces/IModuleFactory.sol"; import "./ERC20CompetitiveRewardModule.sol"; /** * @title ERC20 competitive reward module factory * * @notice this factory contract handles deployment for the * ERC20CompetitiveRewardModule contract * * @dev it is called by the parent PoolFactory and is responsible * for parsing constructor arguments before creating a new contract */ contract ERC20CompetitiveRewardModuleFactory is IModuleFactory { /** * @inheritdoc IModuleFactory */ function createModule(bytes calldata data) external override returns (address) { // validate require(data.length == 128, "crmf1"); // parse constructor arguments address token; uint256 bonusMin; uint256 bonusMax; uint256 bonusPeriod; assembly { token := calldataload(68) bonusMin := calldataload(100) bonusMax := calldataload(132) bonusPeriod := calldataload(164) } // create module ERC20CompetitiveRewardModule module = new ERC20CompetitiveRewardModule( token, bonusMin, bonusMax, bonusPeriod, address(this) ); module.transferOwnership(msg.sender); // output emit ModuleCreated(msg.sender, address(module)); return address(module); } }
/* GYSRUtils https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: MIT */ pragma solidity 0.8.4; import "./MathUtils.sol"; /** * @title GYSR utilities * * @notice this library implements utility methods for the GYSR multiplier * and spending mechanics */ library GysrUtils { using MathUtils for int128; // constants uint256 public constant DECIMALS = 18; uint256 public constant GYSR_PROPORTION = 10**(DECIMALS - 2); // 1% /** * @notice compute GYSR bonus as a function of usage ratio, stake amount, * and GYSR spent * @param gysr number of GYSR token applied to bonus * @param amount number of tokens or shares to unstake * @param total number of tokens or shares in overall pool * @param ratio usage ratio from 0 to 1 * @return multiplier value */ function gysrBonus( uint256 gysr, uint256 amount, uint256 total, uint256 ratio ) internal pure returns (uint256) { if (amount == 0) { return 0; } if (total == 0) { return 0; } if (gysr == 0) { return 10**DECIMALS; } // scale GYSR amount with respect to proportion uint256 portion = (GYSR_PROPORTION * total) / 10**DECIMALS; if (amount > portion) { gysr = (gysr * portion) / amount; } // 1 + gysr / (0.01 + ratio) uint256 x = 2**64 + (2**64 * gysr) / (10**(DECIMALS - 2) + ratio); return 10**DECIMALS + (uint256(int256(int128(uint128(x)).logbase10())) * 10**DECIMALS) / 2**64; } }
/* 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); }
/* 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; }
/* MathUtils https://github.com/FanbaseEU/Staking_Ethereum_SmartContracts SPDX-License-Identifier: BSD-4-Clause */ pragma solidity 0.8.4; /** * @title Math utilities * * @notice this library implements various logarithmic math utilies which support * other contracts and specifically the GYSR multiplier calculation * * @dev h/t https://github.com/abdk-consulting/abdk-libraries-solidity */ library MathUtils { /** * @notice calculate binary logarithm of x * * @param x signed 64.64-bit fixed point number, require x > 0 * @return signed 64.64-bit fixed point number */ function logbase2(int128 x) internal pure returns (int128) { unchecked { require(x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = (msb - 64) << 64; uint256 ux = uint256(int256(x)) << uint256(127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256(b); } return int128(result); } } /** * @notice calculate natural logarithm of x * @dev magic constant comes from ln(2) * 2^128 -> hex * @param x signed 64.64-bit fixed point number, require x > 0 * @return signed 64.64-bit fixed point number */ function ln(int128 x) internal pure returns (int128) { unchecked { require(x > 0); return int128( int256( (uint256(int256(logbase2(x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF) >> 128 ) ); } } /** * @notice calculate logarithm base 10 of x * @dev magic constant comes from log10(2) * 2^128 -> hex * @param x signed 64.64-bit fixed point number, require x > 0 * @return signed 64.64-bit fixed point number */ function logbase10(int128 x) internal pure returns (int128) { require(x > 0); return int128( int256( (uint256(int256(logbase2(x))) * 0x4d104d427de7fce20a6e420e02236748) >> 128 ) ); } // wrapper functions to allow testing function testlogbase2(int128 x) public pure returns (int128) { return logbase2(x); } function testlogbase10(int128 x) public pure returns (int128) { return logbase10(x); } }
/* 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; } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "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":"bytes","name":"data","type":"bytes"}],"name":"createModule","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50612f8b806100206000396000f3fe608060405234801561001057600080fd5b506004361061002a5760003560e01c8062ee8fe51461002f575b600080fd5b61004261003d366004610240565b61006b565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000608082146100db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f63726d6631000000000000000000000000000000000000000000000000000000604482015260640160405180910390fd5b60405160443590606435906084359060a435906000908590859085908590309061010490610233565b73ffffffffffffffffffffffffffffffffffffffff9586168152602081019490945260408401929092526060830152909116608082015260a001604051809103906000f08015801561015a573d6000803e3d6000fd5b506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815233600482015290915073ffffffffffffffffffffffffffffffffffffffff82169063f2fde38b90602401600060405180830381600087803b1580156101c557600080fd5b505af11580156101d9573d6000803e3d6000fd5b505060405173ffffffffffffffffffffffffffffffffffffffff841681523392507ff708942ec477396a151a5285651961dcab8e8a82ea4f5b31a5236f92f6c92710915060200160405180910390a2979650505050505050565b612ca8806102ae83390190565b60008060208385031215610252578182fd5b823567ffffffffffffffff80821115610269578384fd5b818501915085601f83011261027c578384fd5b81358181111561028a578485fd5b86602082850101111561029b578485fd5b6020929092019691955090935050505056fe6101206040523480156200001257600080fd5b5060405162002ca838038062002ca883398101604081905262000035916200015e565b60008054336001600160a01b0319918216811783556001805490921681179091556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3600080546040516001600160a01b0390911691907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f2908290a3828411156200010f5760405162461bcd60e51b815260206004820152601960248201527f426f6e75732076616c75652073657474696e67206572726f7200000000000000604482015260640160405180910390fd5b6001600160601b0319606095861b811660e052941b9093166101005260809190915260a05260c05242600855620001b2565b80516001600160a01b03811681146200015957600080fd5b919050565b600080600080600060a0868803121562000176578081fd5b620001818662000141565b9450602086015193506040860151925060608601519150620001a66080870162000141565b90509295509295909350565b60805160a05160c05160e05160601c6101005160601c612a1f6200028960003960006104bb01526000818161056701528181610710015281816107530152818161078c015281816107d001528181610aa201528181610c3e01528181610c6b01528181610cd101528181610d1701528181610fa501528181610fd0015281816115cf01528181611613015261169701526000818161032701528181610b090152610b690152600081816103d501528181610b300152610baf01526000818161028101528181610b8e0152610bed0152612a1f6000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c80637bb98a681161012a578063c148cf85116100bd578063dc16ceb91161008c578063f2fde38b11610071578063f2fde38b1461052e578063f77c479114610541578063fc4333cd1461055257600080fd5b8063dc16ceb9146104fb578063e336ac441461050557600080fd5b8063c148cf85146104a6578063c45a0155146104b9578063c7537f36146104df578063d0b06f5d146104f257600080fd5b8063a5be655c116100f9578063a5be655c14610459578063a65e2cfd14610462578063a779d08014610475578063bf6b874e1461047d57600080fd5b80637bb98a68146103f75780638da5cb5b1461040c5780639d63848a146104315780639e57e4911461044657600080fd5b80634af4a127116101bd5780635f5319931161018c5780636d811e71116101715780636d811e71146103bf57806370c6a17e146103c75780637aba86d2146103d057600080fd5b80635f5319931461036c5780636d16fa41146103ac57600080fd5b80634af4a127146103225780634b8456b8146103495780635689141214610351578063584b62a11461035957600080fd5b80632e0f2625116101f95780632e0f2625146102b657806333060d90146102be5780633f265ddb146102e75780634854b143146102fa57600080fd5b806304003d5b1461022b578063111d7d50146102675780631b87d58a1461027c5780631c1b8772146102a3575b600080fd5b6102546102393660046125ea565b6001600160a01b031660009081526002602052604090205490565b6040519081526020015b60405180910390f35b61027a610275366004612734565b61055a565b005b6102547f000000000000000000000000000000000000000000000000000000000000000081565b61027a6102b13660046125ea565b610593565b610254601281565b6102546102cc3660046125ea565b6001600160a01b031660009081526005602052604090205490565b6102546102f536600461269a565b6105a6565b61030d610308366004612604565b610676565b6040805192835260208301919091520161025e565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b610254601081565b610254610706565b61030d61036736600461269a565b61086b565b61037f61037a36600461269a565b6108a7565b604080519687526020870195909552938501929092526060840152608083015260a082015260c00161025e565b61027a6103ba3660046125ea565b610938565b600954610254565b61025460065481565b6102547f000000000000000000000000000000000000000000000000000000000000000081565b6103ff610a24565b60405161025e91906127c8565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161025e565b610439610a7e565b60405161025e919061277b565b6102546104543660046126e3565b610b05565b61025460075481565b61027a610470366004612713565b610c31565b610254610c69565b61025461048b3660046125ea565b6001600160a01b031660009081526003602052604090205490565b61030d6104b4366004612604565b610db3565b7f0000000000000000000000000000000000000000000000000000000000000000610419565b61030d6104ed366004612604565b610e3e565b61025460085481565b610254620f424081565b6102546105133660046125ea565b6001600160a01b031660009081526004602052604090205490565b61027a61053c3660046125ea565b610eca565b6001546001600160a01b0316610419565b61027a610f90565b610562610fcb565b61058e7f000000000000000000000000000000000000000000000000000000000000000084848461102b565b505050565b61059b611441565b6105a3610fcb565b50565b6001600160a01b03821660009081526002602052604081208054829190849081106105e157634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020190508060040154421015610607576000915050610670565b600281015461061a576000915050610670565b8060050154816004015461062e9190612833565b421061063f57600201549050610670565b6005810154600182015460038301546106589042612975565b6106629190612956565b61066c919061284b565b9150505b92915050565b6000805481906001600160a01b031633146106e35760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b60648201526084015b60405180910390fd5b6106eb610fcb565b6106f587866114a6565b5060009050805b9550959350505050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600460205260408120546107495750600090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600460205260409020546040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b15801561081a57600080fd5b505afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085291906126fb565b61085c9190612956565b610866919061284b565b905090565b6005602052816000526040600020818154811061088757600080fd5b600091825260209091206002909102018054600190910154909250905082565b6000806000806000806000600260008a6001600160a01b03166001600160a01b0316815260200190815260200160002088815481106108f657634e487b7160e01b600052603260045260246000fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939e929d50909b50995091975095509350505050565b610940611441565b6001600160a01b0381166109bb5760405162461bcd60e51b8152602060048201526024808201527f4e657720636f6e74726f6c6c657220616464726573732063616e27742062652060448201527f7a65726f0000000000000000000000000000000000000000000000000000000060648201526084016106da565b6001546040516001600160a01b038084169216907fa06677f7b64342b4bcbde423684dbdb5356acfe41ad0285b6ecbe6dc4bf427f290600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60408051600180825281830190925260609160208083019080368337019050509050610a4e610706565b81600081518110610a6f57634e487b7160e01b600052603260045260246000fd5b60200260200101818152505090565b604080516001808252818301909252606091602080830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000081600081518110610ae257634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b60007f00000000000000000000000000000000000000000000000000000000000000008210610b65577f0000000000000000000000000000000000000000000000000000000000000000610b5b6012600a6128ae565b6106709190612833565b60007f000000000000000000000000000000000000000000000000000000000000000083610bd37f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612975565b610bdd9190612956565b610be7919061284b565b610c11907f0000000000000000000000000000000000000000000000000000000000000000612833565b905080610c206012600a6128ae565b610c2a9190612833565b9392505050565b610c39610fcb565b610c657f000000000000000000000000000000000000000000000000000000000000000083834261102b565b5050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660009081526004602090815260408083205460039092528220548291610cb891612975565b905080610cc757600091505090565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166000908152600360205260409020546040516370a0823160e01b815230600482015282907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015610d6157600080fd5b505afa158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9991906126fb565b610da39190612956565b610dad919061284b565b91505090565b6000805481906001600160a01b03163314610e1b5760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b60648201526084016106da565b610e23610fcb565b610e30878787878761150f565b915091509550959350505050565b6000805481906001600160a01b03163314610ea65760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b60648201526084016106da565b610eae610fcb565b610ebb878787878761150f565b90925090506106fc87866114a6565b610ed2611441565b6001600160a01b038116610f285760405162461bcd60e51b815260206004820152601f60248201527f4e6577206f776e657220616464726573732063616e2774206265207a65726f0060448201526064016106da565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610f98611441565b610fa0610fcb565b610fc97f000000000000000000000000000000000000000000000000000000000000000061182a565b565b610ff47f0000000000000000000000000000000000000000000000000000000000000000611aa4565b506006546008546110059042612975565b61100f9190612956565b600760008282546110209190612833565b909155505042600855565b611033611be3565b600083116110a95760405162461bcd60e51b815260206004820152602560248201527f46756e64696e6720616d6f756e74206d7573742062652067726561746572207460448201527f68616e203000000000000000000000000000000000000000000000000000000060648201526084016106da565b428110156110f95760405162461bcd60e51b815260206004820152601a60248201527f496e76616c69642066756e64696e672073746172742074696d6500000000000060448201526064016106da565b6001600160a01b0384166000908152600260205260409020546010116111615760405162461bcd60e51b815260206004820152601a60248201527f45786365656473206d61782066756e64696e6720726f756e647300000000000060448201526064016106da565b6040516370a0823160e01b815230600482015284906000906001600160a01b038316906370a082319060240160206040518083038186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dd91906126fb565b90506111f46001600160a01b038316333088611c63565b6040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b15801561123857600080fd5b505afa15801561124c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127091906126fb565b61127a9190612975565b9050600080831161129757611292620f424083612956565b6112c7565b6001600160a01b03881660009081526003602052604090205483906112bd908490612956565b6112c7919061284b565b6001600160a01b0389166000908152600460205260408120805492935083929091906112f4908490612833565b90915550506001600160a01b03881660009081526003602052604081208054839290611321908490612833565b9250508190555060026000896001600160a01b03166001600160a01b031681526020019081526020016000206040518060c00160405280898152602001838152602001838152602001878152602001878152602001888152509080600181540180825580915050600190039060005260206000209060060201600090919091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a082015181600501555050876001600160a01b03167f0d2eac201c6bd25b979f0d9ebcf8ff27a476edde7006f42e843dc70727dbf90b88838860405161142f939291909283526020830191909152604082015260600190565b60405180910390a25050505050505050565b6000546001600160a01b03163314610fc95760405162461bcd60e51b815260206004820152602260248201527f4f6e6c79206f776e65722063616e20706572666f726d2074686973206163746960448201526137b760f11b60648201526084016106da565b6001600160a01b038216600090815260056020908152604080832081518083019092528482524282840190815281546001818101845592865293852092516002909402909201928355905191015560068054839290611506908490612833565b90915550505050565b60008082158061151f5750602083145b61156b5760405162461bcd60e51b815260206004820152601060248201527f496e76616c69642063616c6c646174610000000000000000000000000000000060448201526064016106da565b602083141561157a5760a43591505b6006546009546000916115909185918991611d14565b905060008061159f8a89611e56565b909250905060006115b26012600a6128ae565b6115bc8386612956565b6115c6919061284b565b905060006116097f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031660009081526004602052604090205490565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660009081526003602052604090205461164c9190612975565b905060008260075461165e9190612833565b6116688484612956565b611672919061284b565b90508061168b57600080975097505050505050506106fc565b801561181a576116bc8c7f0000000000000000000000000000000000000000000000000000000000000000836120af565b5060008815611788578897508c6001600160a01b03167fc16aaa1ae5a136c89a5275f4f29944ca4f17d3815f9122eae9455ae495b4c76f8a60405161170391815260200190565b60405180910390a28c6001600160a01b03167f18fe0f7ac77be33dd859236b08864eee2e81199a12f1ac17e688517ddc47ea808960405161174691815260200190565b60405180910390a28661175b6012600a6128ae565b6117676012600a6128ae565b611771908a612975565b61177b9190612956565b611785919061284b565b90505b6000866007546117989190612833565b6117a46012600a6128ae565b6117ae9089612956565b6117b8919061284b565b90506117c66012600a6128ae565b6117d08383612956565b6117da919061284b565b6117e66012600a6128ae565b6009546117f39084612956565b6117fd919061284b565b60095461180a9190612975565b6118149190612833565b60095550505b5050505050509550959350505050565b6001600160a01b038116600090815260026020526040812054815b81811015611a9e576001600160a01b038416600090815260026020526040812061186f8584612975565b8154811061188d57634e487b7160e01b600052603260045260246000fd5b60009182526020822060069091020191506118a88584612975565b90506118b486826105a6565b1580156118d45750816005015482600401546118d09190612833565b4210155b15611a8957815460018301546004840154604080519384526020840192909252908201526001600160a01b038716907fda2a262bf91f4f5d64d1083fcf0438477235659afee73ec3ead834792dd2fc3e9060600160405180910390a26001600160a01b0386166000908152600260205260409020805461195690600190612975565b8154811061197457634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020160026000886001600160a01b03166001600160a01b0316815260200190815260200160002082815481106119c657634e487b7160e01b600052603260045260246000fd5b6000918252602080832084546006909302019182556001808501549083015560028085015481840155600380860154908401556004808601549084015560059485015494909201939093556001600160a01b038916825290915260409020805480611a4157634e487b7160e01b600052603160045260246000fd5b6000828152602081206006600019909301928302018181556001810182905560028101829055600381018290556004810182905560050155905584611a85816129b8565b9550505b50508080611a96906129b8565b915050611845565b50505050565b6000805b6001600160a01b038316600090815260026020526040902054811015611b6b576000611ad484836105a6565b6001600160a01b03851660009081526002602052604081208054929350909184908110611b1157634e487b7160e01b600052603260045260246000fd5b906000526020600020906006020190506000821115611b565781816002016000828254611b3e9190612975565b9091555050426003820155611b538285612833565b93505b50508080611b63906129b8565b915050611aa8565b508015611bde576001600160a01b03821660009081526004602052604081208054839290611b9a908490612975565b90915550506040518181526001600160a01b038316907ff544cfde8481f9e7bc714e7e32a2b1a6b73688d87f1b32827ce45051e8e3b8e69060200160405180910390a25b919050565b6001546001600160a01b03163314610fc95760405162461bcd60e51b815260206004820152602760248201527f4f6e6c7920636f6e74726f6c6c65722063616e20706572666f726d207468697360448201527f20616374696f6e0000000000000000000000000000000000000000000000000060648201526084016106da565b6040516001600160a01b0380851660248301528316604482015260648101829052611a9e9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526121f4565b600083611d2357506000611e4e565b82611d3057506000611e4e565b84611d4857611d416012600a6128ae565b9050611e4e565b6000611d566012600a6128ae565b84611d6360026012612975565b611d6e90600a6128ae565b611d789190612956565b611d82919061284b565b905080851115611da45784611d978288612956565b611da1919061284b565b95505b600083611db360026012612975565b611dbe90600a6128ae565b611dc89190612833565b611ddb8868010000000000000000612956565b611de5919061284b565b611df89068010000000000000000612833565b905068010000000000000000611e106012600a6128ae565b611e1c83600f0b6122d9565b600f0b611e299190612956565b611e33919061284b565b611e3f6012600a6128ae565b611e499190612833565b925050505b949350505050565b6001600160a01b0382166000908152600560205260408120819083905b81156120745780546000908290611e8c90600190612975565b81548110611eaa57634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020190506000816001015442611ecc9190612975565b905060008111611f445760405162461bcd60e51b815260206004820152603260248201527f556e7374616b696e672063616e277420626520646f6e6520696e2073616d652060448201527f626c6f636b2077697468207374616b696e67000000000000000000000000000060648201526084016106da565b6000611f4f82610b05565b90508483600001541161200157611f686012600a6128ae565b83548290611f77908590612956565b611f819190612956565b611f8b919061284b565b611f959087612833565b8354909650611fa5908390612956565b611faf9088612833565b8354909750611fbe9086612975565b945083805480611fde57634e487b7160e01b600052603160045260246000fd5b60008281526020812060026000199093019283020181815560010155905561206c565b61200d6012600a6128ae565b816120188488612956565b6120229190612956565b61202c919061284b565b6120369087612833565b95506120428286612956565b61204c9088612833565b9650848360000160008282546120629190612975565b9091555060009550505b505050611e73565b83600760008282546120869190612975565b92505081905550846006600082825461209f9190612975565b9250508190555050509250929050565b6001600160a01b0382166000818152600360205260408082205490516370a0823160e01b8152306004820152919285928591906370a082319060240160206040518083038186803b15801561210357600080fd5b505afa158015612117573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213b91906126fb565b6121459190612956565b61214f919061284b565b6001600160a01b03851660009081526003602052604081208054929450859290919061217c908490612975565b9091555061219690506001600160a01b038216868461231a565b836001600160a01b0316856001600160a01b03167f1a4dfb075362880d700ede1cc31d284b1c3b2811e9f0b2ddde7bdb270042c13f84866040516121e4929190918252602082015260400190565b60405180910390a3509392505050565b6000612249826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123639092919063ffffffff16565b80519091501561058e578080602001905181019061226791906126c3565b61058e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106da565b60008082600f0b136122ea57600080fd5b60806122f583612372565b61231290600f0b6f4d104d427de7fce20a6e420e02236748612956565b901c92915050565b6040516001600160a01b03831660248201526044810182905261058e9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611cb0565b6060611e4e8484600085612456565b60008082600f0b1361238357600080fd5b6000600f83900b6801000000000000000081126123a2576040918201911d5b64010000000081126123b6576020918201911d5b6201000081126123c8576010918201911d5b61010081126123d9576008918201911d5b601081126123e9576004918201911d5b600481126123f9576002918201911d5b60028112612408576001820191505b603f19820160401b600f85900b607f8490031b6780000000000000005b600081131561244b5790800260ff81901c8281029390930192607f011c9060011d612425565b509095945050505050565b6060824710156124ce5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106da565b600080866001600160a01b031685876040516124ea919061275f565b60006040518083038185875af1925050503d8060008114612527576040519150601f19603f3d011682016040523d82523d6000602084013e61252c565b606091505b5091509150611e4987838387606083156125a457825161259d576001600160a01b0385163b61259d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106da565b5081611e4e565b611e4e83838151156125b95781518083602001fd5b8060405162461bcd60e51b81526004016106da9190612800565b80356001600160a01b0381168114611bde57600080fd5b6000602082840312156125fb578081fd5b610c2a826125d3565b60008060008060006080868803121561261b578081fd5b612624866125d3565b9450612632602087016125d3565b935060408601359250606086013567ffffffffffffffff80821115612655578283fd5b818801915088601f830112612668578283fd5b813581811115612676578384fd5b896020828501011115612687578384fd5b9699959850939650602001949392505050565b600080604083850312156126ac578182fd5b6126b5836125d3565b946020939093013593505050565b6000602082840312156126d4578081fd5b81518015158114610c2a578182fd5b6000602082840312156126f4578081fd5b5035919050565b60006020828403121561270c578081fd5b5051919050565b60008060408385031215612725578182fd5b50508035926020909101359150565b600080600060608486031215612748578283fd5b505081359360208301359350604090920135919050565b6000825161277181846020870161298c565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b818110156127bc5783516001600160a01b031683529284019291840191600101612797565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156127bc578351835292840192918401916001016127e4565b602081526000825180602084015261281f81604085016020870161298c565b601f01601f19169190910160400192915050565b60008219821115612846576128466129d3565b500190565b60008261286657634e487b7160e01b81526012600452602481fd5b500490565b600181815b808511156128a657816000190482111561288c5761288c6129d3565b8085161561289957918102915b93841c9390800290612870565b509250929050565b6000610c2a83836000826128c457506001610670565b816128d157506000610670565b81600181146128e757600281146128f15761290d565b6001915050610670565b60ff841115612902576129026129d3565b50506001821b610670565b5060208310610133831016604e8410600b8410161715612930575081810a610670565b61293a838361286b565b806000190482111561294e5761294e6129d3565b029392505050565b6000816000190483118215151615612970576129706129d3565b500290565b600082821015612987576129876129d3565b500390565b60005b838110156129a757818101518382015260200161298f565b83811115611a9e5750506000910152565b60006000198214156129cc576129cc6129d3565b5060010190565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220aabfa6678ecffe5668696e5e408ce44dcfed0a260b90247486f8fc1c3d9980b564736f6c63430008040033a26469706673582212204c726914eacedfbea85f8f11d6bdc70514c0e63c1b89727eeac23b55f8dc2dbb64736f6c63430008040033
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.