Contract Overview
Balance:
0 AVAX
AVAX Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x2ed3c98b77108665c4e7ddd1a5b4ae40570474b75c72f1f45058029f9e6b6708 | 0x61486061 | 18987313 | 168 days 21 hrs ago | Yield Yak: Deployer | IN | Create: StakeUtils | 0 AVAX | 0.162154 |
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
StakeUtils
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.7; import "@openzeppelin/contracts/proxy/Clones.sol"; import "../../interfaces/ISwap.sol"; import "../../interfaces/IgAVAX.sol"; import "../../WithdrawalPool/LPToken.sol"; import "./DataStoreLib.sol"; /** * @title StakeUtils library * @notice Exclusively contains functions related to Avax Liquid Staking designed by Geode Finance * @notice biggest part of the functionality is related to Withdrawal Pools * which relies on continuous buybacks for price peg with DEBT/SURPLUS calculations * @dev Contracts relying on this library must initialize StakeUtils.StakePool * @dev ALL "fee" variables are limited by FEE_DENOMINATOR = 100% * Note *suggested* refer to GeodeUtils before reviewing * Note refer to DataStoreUtils before reviewing * Note beware of the staking pool and operator implementations: * Operatores have properties like accumulatedFee, fee(as a percentage), maintainer. * Every staking pool(aka planet) is also an operator by design. * Planets(type 5) inherit operators (type 4), with additional properties like staking pools -relates to * params: pBalance, surplus, unclaimedFees-, withdrawal pool - relates to debt - and liquid asset(gAvax). */ library StakeUtils { using DataStoreUtils for DataStoreUtils.DataStore; event MaintainerFeeUpdated(uint256 id, uint256 fee); event MaxMaintainerFeeUpdated(uint256 newMaxFee); event PriceChanged(uint256 id, uint256 pricePerShare); event OracleUpdate( uint256 id, uint256 price, uint256 newPBalance, uint256 distributedFeeTotal, uint256 updateTimeStamp ); event OperatorActivated(uint256 id, uint256 activeOperator); event OperatorDeactivated(uint256 id, uint256 deactiveOperator); event debtPaid(uint256 id, uint256 operatorId, uint256 paidDebt); event SurplusClaimed(uint256 id, uint256 newSurplus); event FeeClaimed(uint256 id, uint256 claimerId, uint256 newSurplus); event PausedPool(uint256 id); event UnpausedPool(uint256 id); /** * @notice StakePool includes the parameters related to Staking Pool Contracts. * @notice A staking pool works with a *bound* Withdrawal Pool to create best pricing * for the staking derivative. Withdrawal Pools uses StableSwap algorithm. * @param gAVAX ERC1155 contract that keeps the totalSupply, pricepershare and balances of all StakingPools by ID * @dev gAVAX should not be changed ever! * @param DEFAULT_SWAP_POOL STABLESWAP pool that will be cloned to be used as Withdrawal Pool of given ID * @param DEFAULT_LP_TOKEN LP token implementation that will be cloned to be used for Withdrawal Pool of given ID * @param ORACLE https://github.com/Geodefi/Telescope * @param DEFAULT_A Withdrawal Pool parameter * @param DEFAULT_FEE Withdrawal Pool parameter * @param DEFAULT_ADMIN_FEE Withdrawal Pool parameter * @param FEE_DENOMINATOR represents 100% ALSO Withdrawal Pool parameter * @param MAX_MAINTAINER_FEE : limits operator.fee and planet.fee, set by GOVERNANCE * @dev changing any of address parameters (gAVAX, ORACLE, DEFAULT_SWAP_POOL, DEFAULT_LP_TOKEN) MUST require a contract upgrade to ensure security **/ struct StakePool { address gAVAX; address DEFAULT_SWAP_POOL; address DEFAULT_LP_TOKEN; address ORACLE; uint256 DEFAULT_A; uint256 DEFAULT_FEE; uint256 DEFAULT_ADMIN_FEE; uint256 FEE_DENOMINATOR; uint256 PERIOD_PRICE_INCREASE_LIMIT; uint256 MAX_MAINTAINER_FEE; } /** * @notice gAVAX lacks *decimals*, * @dev gAVAX_DENOMINATOR makes sure that we are taking care of decimals on calculations related to gAVAX */ uint256 public constant gAVAX_DENOMINATOR = 1e18; /// @notice Oracle is active for the first 30 min for a day uint256 public constant ORACLE_PERIOD = 1 days; uint256 public constant ORACLE_ACTIVE_PERIOD = 30 minutes; uint256 public constant DEACTIVATION_PERIOD = 15 days; uint256 public constant IGNORABLE_DEBT = 1 ether; /** * @notice whenever an operator is activated for a staking pool, it sets an activationExpiration date, which * means the op pay debt by burning gAvax tokens and collect fee from their validators. * While this implementation allows any two different ids to cooperate, with multiple interactions at any given time, * there can only be "1" activeOperator who can also claimSurplus to create new validators. */ modifier beforeActivationExpiration( DataStoreUtils.DataStore storage _DATASTORE, uint256 _poolId, uint256 _claimerId ) { require( _DATASTORE.readUintForId( _poolId, bytes32(keccak256(abi.encodePacked(_claimerId, "activationExpiration"))) ) > block.timestamp, "StakeUtils: operatorId activationExpiration has past" ); _; } modifier onlyMaintainer( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) { require( _DATASTORE.readAddressForId(_id, "maintainer") == msg.sender, "StakeUtils: sender not maintainer" ); _; } function _clone(address target) public returns (address) { return Clones.clone(target); } function getgAVAX(StakePool storage self) public view returns (IgAVAX) { return IgAVAX(self.gAVAX); } /** * @notice ** Maintainer specific functions ** * * @note "Maintainer" is a shared logic like "fee" by both operator and pools. * Maintainers have permissiones to maintain the given id like setting a new fee or interface as * well as paying debt etc. for operators. * @dev maintainer is set by CONTROLLER of given id */ /// @notice even if MAX_MAINTAINER_FEE is decreased later, it returns limited maximum function getMaintainerFee( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) public view returns (uint256) { return _DATASTORE.readUintForId(_id, "fee") > self.MAX_MAINTAINER_FEE ? self.MAX_MAINTAINER_FEE : _DATASTORE.readUintForId(_id, "fee"); } function setMaintainerFee( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _id, uint256 _newFee ) external onlyMaintainer(_DATASTORE, _id) { require( _newFee <= self.MAX_MAINTAINER_FEE, "StakeUtils: MAX_MAINTAINER_FEE ERROR" ); _DATASTORE.writeUintForId(_id, "fee", _newFee); emit MaintainerFeeUpdated(_id, _newFee); } function setMaxMaintainerFee(StakePool storage self, uint256 _newMaxFee) external { require( _newMaxFee <= self.FEE_DENOMINATOR, "StakeUtils: fee more than 100%" ); self.MAX_MAINTAINER_FEE = _newMaxFee; emit MaxMaintainerFeeUpdated(_newMaxFee); } function changeMaintainer( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id, address _newMaintainer ) external { require( _DATASTORE.readAddressForId(_id, "CONTROLLER") == msg.sender, "StakeUtils: not CONTROLLER of given id" ); require( _newMaintainer != address(0), "StakeUtils: maintainer can not be zero" ); _DATASTORE.writeAddressForId(_id, "maintainer", _newMaintainer); } /** * @notice ** Staking Pool specific functions ** */ /// @notice mints gAVAX tokens with given ID and amount. /// @dev shouldn't be accesible publicly function _mint( address _gAVAX, address _to, uint256 _id, uint256 _amount ) internal { require(_id > 0, "StakeUtils: _mint id should be > 0"); IgAVAX(_gAVAX).mint(_to, _id, _amount, ""); } /** * @notice conducts a buyback using the given withdrawal pool, * @param to address to send bought gAVAX(id). burns the tokens if to=address(0), transfers if not * @param poolId id of the gAVAX that will be bought * @param sellAvax AVAX amount to sell * @param minToBuy TX is expected to revert by Swap.sol if not meet * @param deadline TX is expected to revert by Swap.sol if deadline has past * @dev this function assumes that pool is deployed by deployWithdrawalPool * as index 0 is avax and index 1 is Gavax */ function _buyback( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, address to, uint256 poolId, uint256 sellAvax, uint256 minToBuy, uint256 deadline ) internal returns (uint256 outAmount) { // SWAP in WP outAmount = withdrawalPoolById(_DATASTORE, poolId).swap{ value: sellAvax }( 0, 1, sellAvax, minToBuy, deadline ); if (to == address(0)) { // burn getgAVAX(self).burn(address(this), poolId, outAmount); } else { // send back to user getgAVAX(self).safeTransferFrom(address(this), to, poolId, outAmount, ""); } } /** * @notice ** ORACLE specific functions ** */ /** * @notice sets pricePerShare parameter of gAVAX(id) * @dev only ORACLE should be able to reach this after sanity checks on new price */ function _setPricePerShare( StakePool storage self, uint256 pricePerShare_, uint256 _id ) internal { require(_id > 0, "StakeUtils: id should be > 0"); getgAVAX(self).setPricePerShare(pricePerShare_, _id); emit PriceChanged(_id, pricePerShare_); } /** * @notice Oracle is only allowed for a period every day & pool operations are stopped then * @return false if the last oracle update happened already (within the current daily period) */ function _isOracleActive( DataStoreUtils.DataStore storage _DATASTORE, uint256 _poolId ) internal view returns (bool) { return (block.timestamp % ORACLE_PERIOD <= ORACLE_ACTIVE_PERIOD) && (_DATASTORE.readUintForId(_poolId, "oracleUpdateTimeStamp") < block.timestamp - ORACLE_ACTIVE_PERIOD); } /** * @notice oraclePrice is a reliable source for any contract operation * @dev also the *mint price* when there is a no debt */ function oraclePrice(StakePool storage self, uint256 _id) public view returns (uint256 _oraclePrice) { _oraclePrice = getgAVAX(self).pricePerShare(_id); } /** * @notice in order to prevent attacks from malicious Oracle there are boundaries to price & fee updates. * @dev checks: * 1. Price should be increased & it should not be increased more than PERIOD_PRICE_INCREASE_LIMIT * with the factor of how many days since oracleUpdateTimeStamp has past. * To encourage report oracle each day, price increase limit is not calculated by considering compound effect * for multiple days. */ function _sanityCheck( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _id, uint256 _newPrice ) internal view { // need to put the lastPriceUpdate to DATASTORE to check if price is updated already for that day uint256 periodsSinceUpdate = (block.timestamp + ORACLE_ACTIVE_PERIOD - _DATASTORE.readUintForId(_id, "oracleUpdateTimeStamp")) / ORACLE_PERIOD; uint256 curPrice = oraclePrice(self, _id); uint256 maxPrice = curPrice + ((curPrice * self.PERIOD_PRICE_INCREASE_LIMIT * periodsSinceUpdate) / self.FEE_DENOMINATOR); require( _newPrice <= maxPrice && _newPrice >= curPrice, "StakeUtils: price did NOT met" ); } /** * @notice distribute fees to given operator Ids, by related to their fees. * Finally, distribute the fee of maintainer of the pool from total amounts. * * @dev fees can be higher than current MAX, if MAX is changed afterwards, we check that condition. */ function _distributeFees( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _poolId, uint256[] calldata _opIds, uint256[] calldata _pBalanceIncreases ) internal returns (uint256 totalPBalanceIncrease, uint256 totalFees) { require( _opIds.length == _pBalanceIncreases.length, "StakeUtils: Array lengths doesn't match" ); for (uint256 i = 0; i < _opIds.length; i++) { // do not double spend if pool maintainer is also maintaining the validators if (_opIds[i] != _poolId) { // below require checks activationExpiration[keccak256(abi.encodePacked(_id, operator))] logic require( _DATASTORE.readUintForId( _poolId, bytes32( keccak256(abi.encodePacked(_opIds[i], "activationExpiration")) ) ) > block.timestamp - ORACLE_PERIOD, "StakeUtils: _opId activationExpiration has past" ); uint256 opFee = getMaintainerFee(self, _DATASTORE, _opIds[i]); (uint256 _fee, bytes32 _key) = accumulatedFee( _DATASTORE, _poolId, _opIds[i] ); uint256 gainedOpFee = (opFee * _pBalanceIncreases[i]) / self.FEE_DENOMINATOR; _DATASTORE.writeUintForId(_poolId, _key, _fee + gainedOpFee); totalFees += gainedOpFee; } totalPBalanceIncrease += _pBalanceIncreases[i]; } // op_fee * _pBalanceIncrease[i] to calculate respective fee from the gained increase uint256 poolFee = getMaintainerFee(self, _DATASTORE, _poolId); uint256 gainedPoolFee = (poolFee * totalPBalanceIncrease) / self.FEE_DENOMINATOR; (uint256 fee, bytes32 key) = accumulatedFee(_DATASTORE, _poolId, _poolId); totalFees += gainedPoolFee; _DATASTORE.writeUintForId(_poolId, key, fee + gainedPoolFee); } /** * @notice only Oracle can report a new price. However price is not purely calculated by it. * the balance on P subchain is estimated by it, including the unrealized staking rewards. * Oracle has a pessimistic approach to make sure price will not decrease by a lot even in the case of loss of funds. * @param _reportedTimeStamp ensures prepeared report is prepeared within last activation period, prevent previous reports to be accepted. * @param _opIds all ids of all operators who still collect fees. * @param _pBalanceIncreases the amount of avax that has been gained by the operator as POS rewards, respective to _opIds * @dev simply the new price is found by (pBALANCE + surplus - fees) / totalSupply) * @return price : new price after sanitychecks, might be useful if onchain oracle in the future */ function reportOracle( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _reportedTimeStamp, uint256 _poolId, uint256[] calldata _opIds, uint256[] calldata _pBalanceIncreases ) external returns (uint256 price) { require(msg.sender == self.ORACLE, "StakeUtils: msg.sender NOT oracle"); require( _isOracleActive(_DATASTORE, _poolId), "StakeUtils: Oracle is NOT active" ); require( _reportedTimeStamp >= block.timestamp - ORACLE_ACTIVE_PERIOD, "StakeUtils: Reported timestamp is NOT valid" ); // distribute fees (uint256 totalPBalanceIncrease, uint256 totalFees) = _distributeFees( self, _DATASTORE, _poolId, _opIds, _pBalanceIncreases ); uint256 newPBalance = _DATASTORE.readUintForId(_poolId, "pBalance") + totalPBalanceIncrease; _DATASTORE.writeUintForId(_poolId, "pBalance", newPBalance); uint256 unclaimed = _DATASTORE.readUintForId(_poolId, "unclaimedFees") + totalFees; _DATASTORE.writeUintForId(_poolId, "unclaimedFees", unclaimed); // deduct unclaimed fees from surplus price = ((newPBalance + _DATASTORE.readUintForId(_poolId, "surplus") - unclaimed) * gAVAX_DENOMINATOR) / (getgAVAX(self).totalSupply(_poolId)); _sanityCheck(self, _DATASTORE, _poolId, price); _setPricePerShare(self, price, _poolId); _DATASTORE.writeUintForId( _poolId, "oracleUpdateTimeStamp", block.timestamp ); emit OracleUpdate( _poolId, price, newPBalance, totalFees, _reportedTimeStamp ); } /** * @notice ** DEBT/SURPLUS/FEE specific functions ** */ /** * @notice When a pool maintainer wants another operator's maintainer to be able to start claiming surplus and * creating validators, it activates the validator. * @notice Changes activeOperator of the given ID; old activeOperator can NOT claim surplus anymore * @dev However it can still continue holding its old balance until activationExpiration, and gain fees * @dev activationExpiration timestamp until new activeoperator continues getting fees from id's staking pool */ function activateOperator( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id, uint256 _activeId ) external onlyMaintainer(_DATASTORE, _id) returns (bool) { _DATASTORE.writeUintForId(_id, "activeOperator", _activeId); _DATASTORE.writeUintForId( _id, bytes32(keccak256(abi.encodePacked(_activeId, "activationExpiration"))), type(uint256).max ); emit OperatorActivated(_id, _activeId); return true; } /** * @notice deactivates an old operator for the given staking pool * @dev when activationExpiration is up, operator will NOT be able generate fees from pool, * it is expected for them to return the assets as surplus with payDebt function * @dev _deactivateAfter seconds until activation expires, */ function deactivateOperator( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id, uint256 _deactivedId ) external onlyMaintainer(_DATASTORE, _id) returns (bool) { if (_DATASTORE.readUintForId(_id, "activeOperator") == _deactivedId) _DATASTORE.writeUintForId(_id, "activeOperator", 0); _DATASTORE.writeUintForId( _id, bytes32( keccak256(abi.encodePacked(_deactivedId, "activationExpiration")) ), block.timestamp + DEACTIVATION_PERIOD //15 days ); emit OperatorDeactivated(_id, _deactivedId); return true; } /** * @notice Only an Operator is expected to pay for the DEBT of a staking pool. * When it is paid, p subChain balance decreases, effectively changing the price calculations! */ function payDebt( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _poolId, uint256 _operatorId ) external onlyMaintainer(_DATASTORE, _operatorId) beforeActivationExpiration(_DATASTORE, _poolId, _operatorId) { require( !_isOracleActive(_DATASTORE, _poolId), "StakeUtils: Oracle is active" ); //mgs.value should be bigger than 0 for everything to make sense require(msg.value > 0, "StakeUtils: no avax is sent"); // msg.value is assined to value, value is the variable to keep how much left in my hand to continue // paying the rest of the debts and or how much left after paying the debts to put the rest in to surplus uint256 value = msg.value; uint256 surplus = _DATASTORE.readUintForId(_poolId, "surplus"); uint256 unclaimedFees = _DATASTORE.readUintForId(_poolId, "unclaimedFees"); // this if statement checks if there is a operation fee that needs to be paid. // If distributed fee exceeds the surplus, there is a gap between fees and surplus // so we check if the unclaimedFees are bigger than surplus. if (unclaimedFees > surplus) { // the difference between unclaimedFees and the surplus is the debt for the fees. uint256 debtInFees = unclaimedFees - surplus; // need to check if the debtInFees is bigger than the value, if not, can only pay value amount of debtInFees // if not, we are paying all debtInFees by adding it to the surplus so that the difference might be 0(zero) after this action. if (debtInFees > value) { debtInFees = value; } // we pay for the debtInFees as we can surplus += debtInFees; // we substract the debtInFees from value since we cannot use that amount to pay the rest, it is already gone. value -= debtInFees; } // we check if remaining value is bigger than 0 to save gas, because it may be already used if (value > 0) { // we get the debt from the withdrawal pool uint256 debtToBurn = withdrawalPoolById(_DATASTORE, _poolId).getDebt(); // to save the gas we make sure that it is bigger then an ignorably low amount while we are doing a buyback if (debtToBurn > IGNORABLE_DEBT) { // same idea with the fee debt and values if (debtToBurn > value) { debtToBurn = value; } // burns _buyback( self, _DATASTORE, address(0), _poolId, debtToBurn, 0, type(uint256).max ); // we substract the debt from value to see how much left if there is any left to put it on surplus value -= debtToBurn; } // to save gas we are making sure that value is bigger than zero and if so, we add it to the surplus. if (value > 0) { surplus += value; } } _DATASTORE.writeUintForId(_poolId, "surplus", surplus + value); // in all cases, if we pass the require msg.value > 0, that money is coming from the p chain // and we need to decrease the pBalance for msg.value amount uint256 pBalance = _DATASTORE.readUintForId(_poolId, "pBalance"); if (pBalance > msg.value) { _DATASTORE.writeUintForId(_poolId, "pBalance", pBalance - msg.value); } else { _DATASTORE.writeUintForId(_poolId, "pBalance", 0); } emit debtPaid(_poolId, _operatorId, msg.value); } /** * @notice only authorized Operator is expected to claim the surplus of a staking pool * @notice current fees are not allowed to be claimed from surplus, * however oracle update can also make it hard since it increases unclaimedFees without touching the surplus */ function claimSurplus( DataStoreUtils.DataStore storage _DATASTORE, uint256 _poolId, uint256 _claimerId ) external onlyMaintainer(_DATASTORE, _claimerId) beforeActivationExpiration(_DATASTORE, _poolId, _claimerId) returns (bool) { require( !_isOracleActive(_DATASTORE, _poolId), "StakeUtils: Oracle is active" ); uint256 fees = _DATASTORE.readUintForId(_poolId, "unclaimedFees"); uint256 surplus = _DATASTORE.readUintForId(_poolId, "surplus"); require(surplus > fees, "StakeUtils: pool fees exceed surplus"); _DATASTORE.writeUintForId(_poolId, "surplus", fees); uint256 currentPBal = _DATASTORE.readUintForId(_poolId, "pBalance"); _DATASTORE.writeUintForId( _poolId, "pBalance", currentPBal + surplus - fees ); (bool sent, ) = payable( _DATASTORE.readAddressForId(_claimerId, "maintainer") ).call{ value: surplus - fees }(""); require(sent, "StakeUtils: Failed to send Avax"); emit SurplusClaimed(_poolId, surplus - fees); return sent; } /** * @notice accumulatedFee is stored with a key combines the poolId, claimerId & "accumulatedFee" * @dev function also returns the key for ease of use, please use. */ function accumulatedFee( DataStoreUtils.DataStore storage _DATASTORE, uint256 poolId, uint256 claimerId ) public view returns (uint256 fee, bytes32 key) { key = bytes32(keccak256(abi.encodePacked(claimerId, "accumulatedFee"))); fee = _DATASTORE.readUintForId(poolId, key); } /** * @notice anyone can call this function, but it sends AVAX to maintainer. * @notice reverts if there are not enough surplus. */ function claimFee( DataStoreUtils.DataStore storage _DATASTORE, uint256 poolId, uint256 claimerId ) external beforeActivationExpiration(_DATASTORE, poolId, claimerId) returns (uint256 feeToSend) { require( !_isOracleActive(_DATASTORE, poolId), "StakeUtils: Oracle is active" ); (uint256 fee, bytes32 key) = accumulatedFee(_DATASTORE, poolId, claimerId); uint256 surplus = _DATASTORE.readUintForId(poolId, "surplus"); require( fee > 0 && surplus > 0, "StakeUtils: fee and surplus should be bigger than zero" ); feeToSend = fee > surplus ? surplus : fee; _DATASTORE.writeUintForId(poolId, "surplus", surplus - feeToSend); uint256 _unclaimedFees = _DATASTORE.readUintForId(poolId, "unclaimedFees"); _DATASTORE.writeUintForId( poolId, "unclaimedFees", _unclaimedFees - feeToSend ); address receiver = payable( _DATASTORE.readAddressForId(claimerId, "maintainer") ); // set the accumulatedFee to zero _DATASTORE.writeUintForId(poolId, key, fee - feeToSend); (bool sent, ) = receiver.call{ value: feeToSend }(""); require(sent, "StakeUtils: Failed to send Avax"); emit FeeClaimed(poolId, claimerId, feeToSend); } /** * @notice ** WITHDRAWAL POOL specific functions ** */ function isStakingPausedForPool( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) public view returns (bool) { // minting is paused when length != 0 return _DATASTORE.readBytesForId(_id, "stakePaused").length != 0; } /** * @notice pausing only prevents new staking operations. * when a pool is paused for staking there are NO new funds to be minted, NO surplus. */ function pauseStakingForPool( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) external onlyMaintainer(_DATASTORE, _id) { _DATASTORE.writeBytesForId(_id, "stakePaused", bytes("1")); // meaning true, importantly length > 0 emit PausedPool(_id); } function unpauseStakingForPool( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) external onlyMaintainer(_DATASTORE, _id) { _DATASTORE.writeBytesForId(_id, "stakePaused", bytes("")); // meaning false, importantly length = 0 emit UnpausedPool(_id); } function withdrawalPoolById( DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) public view returns (ISwap) { return ISwap(_DATASTORE.readAddressForId(_id, "withdrawalPool")); } function LPTokenById(DataStoreUtils.DataStore storage _DATASTORE, uint256 _id) public view returns (LPToken) { return LPToken(_DATASTORE.readAddressForId(_id, "LPToken")); } /** * @notice deploys a new withdrawal pool using DEFAULT_SWAP_POOL * @dev sets the withdrawal pool with respective */ function deployWithdrawalPool( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 _id ) external returns (address WithdrawalPool) { require(_id > 0, "StakeUtils: id should be > 0"); require( _DATASTORE.readAddressForId(_id, "withdrawalPool") == address(0), "StakeUtils: withdrawalPool already exists" ); WithdrawalPool = _clone(self.DEFAULT_SWAP_POOL); address _LPToken = ISwap(WithdrawalPool).initialize( address(getgAVAX(self)), _id, string( abi.encodePacked( _DATASTORE.readBytesForId(_id, "name"), "-Geode WP Token" ) ), string(abi.encodePacked(_DATASTORE.readBytesForId(_id, "name"), "-WP")), self.DEFAULT_A, self.DEFAULT_FEE, self.DEFAULT_ADMIN_FEE, self.DEFAULT_LP_TOKEN ); // initially 1 AVAX = 1 gAVAX _setPricePerShare(self, 1 ether, _id); _DATASTORE.writeAddressForId(_id, "withdrawalPool", WithdrawalPool); _DATASTORE.writeAddressForId(_id, "LPToken", _LPToken); // approve token so we can use it in buybacks getgAVAX(self).setApprovalForAll(WithdrawalPool, true); LPTokenById(_DATASTORE, _id).approve(WithdrawalPool, type(uint256).max); } /** * @notice staking function. buys if price is low, mints new tokens if a surplus is sent (extra avax through msg.value) * @param poolId id of the staking pool, withdrawal pool and gAVAX to be used. * @param minGavax swap op param * @param deadline swap op param // d m.v // 100 10 => buyback // 100 100 => buyback // 10 100 => buyback + mint // 0 x => mint */ function stake( StakePool storage self, DataStoreUtils.DataStore storage _DATASTORE, uint256 poolId, uint256 minGavax, uint256 deadline ) external returns (uint256 totalgAvax) { require(msg.value > 0, "GeodePortal: no avax given"); require( !isStakingPausedForPool(_DATASTORE, poolId), "StakeUtils: minting is paused" ); uint256 debt = withdrawalPoolById(_DATASTORE, poolId).getDebt(); if (debt >= msg.value) { return _buyback( self, _DATASTORE, msg.sender, poolId, msg.value, minGavax, deadline ); } else { uint256 boughtGavax = 0; uint256 remAvax = msg.value; if (debt > IGNORABLE_DEBT) { boughtGavax = _buyback( self, _DATASTORE, msg.sender, poolId, debt, 0, deadline ); remAvax -= debt; } uint256 mintGavax = ( ((remAvax * gAVAX_DENOMINATOR) / oraclePrice(self, poolId)) ); _mint(self.gAVAX, msg.sender, poolId, mintGavax); _DATASTORE.writeUintForId( poolId, "surplus", _DATASTORE.readUintForId(poolId, "surplus") + remAvax ); require( boughtGavax + mintGavax >= minGavax, "StakeUtils: less than minGavax" ); return boughtGavax + mintGavax; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.7; import "./IgAVAX.sol"; interface ISwap { // pool data view functions function getERC1155() external view returns (address); function getA() external view returns (uint256); function getAPrecise() external view returns (uint256); function getToken() external view returns (uint256); function getTokenBalance(uint8 index) external view returns (uint256); function getVirtualPrice() external view returns (uint256); function getDebt() external view returns (uint256); function getAdminBalance(uint256 index) external view returns (uint256); // min return calculation functions function calculateSwap( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx ) external view returns (uint256); function calculateTokenAmount(uint256[] calldata amounts, bool deposit) external view returns (uint256); function calculateRemoveLiquidity(uint256 amount) external view returns (uint256[] memory); function calculateRemoveLiquidityOneToken( uint256 tokenAmount, uint8 tokenIndex ) external view returns (uint256 availableTokenAmount); // state modifying functions function initialize( address _gAvax, uint256 _pooledTokenId, string memory lpTokenName, string memory lpTokenSymbol, uint256 _a, uint256 _fee, uint256 _adminFee, address lpTokenTargetAddress ) external returns (address lpToken); function swap( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx, uint256 minDy, uint256 deadline ) external payable returns (uint256); function addLiquidity( uint256[] calldata amounts, uint256 minToMint, uint256 deadline ) external payable returns (uint256); function removeLiquidity( uint256 amount, uint256[] calldata minAmounts, uint256 deadline ) external returns (uint256[] memory); function removeLiquidityOneToken( uint256 tokenAmount, uint8 tokenIndex, uint256 minAmount, uint256 deadline ) external returns (uint256); function removeLiquidityImbalance( uint256[] calldata amounts, uint256 maxBurnAmount, uint256 deadline ) external returns (uint256); function withdrawAdminFees() external; function setAdminFee(uint256 newAdminFee) external; function setSwapFee(uint256 newSwapFee) external; function rampA(uint256 futureA, uint256 futureTime) external; function stopRampA() external; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.7; interface IgAVAX { function supportsInterface(bytes4 interfaceId) external view returns (bool); function uri(uint256) external view returns (string memory); function balanceOf(address account, uint256 id) external view returns (uint256); function balanceOfBatch(address[] memory accounts, uint256[] memory ids) external view returns (uint256[] memory); function setApprovalForAll(address operator, bool approved) external; function isApprovedForAll(address account, address operator) external view returns (bool); function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) external; function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) external; function burn( address account, uint256 id, uint256 value ) external; function burnBatch( address account, uint256[] memory ids, uint256[] memory values ) external; function totalSupply(uint256 id) external view returns (uint256); function exists(uint256 id) external view returns (bool); function mint( address to, uint256 id, uint256 amount, bytes memory data ) external; function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) external; function pause() external; function unpause() external; function pricePerShare(uint256 _id) external view returns (uint256); function setPricePerShare(uint256 pricePerShare_, uint256 _id) external; function isInterface(address operator, uint256 id) external view returns (bool); function setInterface( address _Interface, uint256 _id, bool isSet ) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.7; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; /** * @title Liquidity Provider Token * @notice This token is an ERC20 detailed token with added capability to be minted by the owner. * It is used to represent user's shares when providing liquidity to swap contracts. * @dev Only Swap contracts should initialize and own LPToken contracts. */ contract LPToken is ERC20BurnableUpgradeable, OwnableUpgradeable { /** * @notice Initializes this LPToken contract with the given name and symbol * @dev The caller of this function will become the owner. A Swap contract should call this * in its initializer function. * @param name name of this token * @param symbol symbol of this token */ function initialize(string memory name, string memory symbol) external initializer returns (bool) { __Context_init_unchained(); __ERC20_init_unchained(name, symbol); __Ownable_init_unchained(); return true; } /** * @notice Mints the given amount of LPToken to the recipient. * @dev only owner can call this mint function * @param recipient address of account to receive the tokens * @param amount amount of tokens to mint */ function mint(address recipient, uint256 amount) external onlyOwner { require(amount != 0, "LPToken: cannot mint 0"); _mint(recipient, amount); } /** * @dev Overrides ERC20._beforeTokenTransfer() which get called on every transfers including * minting and burning. This ensures that Swap.updateUserWithdrawFees are called everytime. * This assumes the owner is set to a Swap contract's address. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20Upgradeable) { super._beforeTokenTransfer(from, to, amount); require(to != address(this), "LPToken: cannot send to itself"); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.7; /** * @title Storage Management library for dynamic structs based on data types * * DataStoreUtils is a storage management tool designed to create a safe and scalable * storage layout with the help of ids and keys. * Mainly focusing on upgradable contracts with multiple user types to create a * sustainable development environment. * * In summary, extra gas cost that would be saved with Storage packing are * ignored to create upgradable structs. * * IDs are the representation of a user with any given key as properties. * Type for ID is not mandatory, not all IDs should have an explicit type. * Thus there is no checks of types or keys. * * @notice distinct id and key pairs return different storage slots * */ library DataStoreUtils { /** * @notice Main Struct for reading and writing data to storage for given id+key pairs * @param allIdsByType optional categorization for given ID, requires direct access, type => id[] * @param uintData keccak(id, key) => returns uint256 * @param bytesData keccak(id, key) => returns bytes * @param addressData keccak(id, key) => returns address * NOTE any other storage type can be expressed as bytes */ struct DataStore { mapping(uint256 => uint256[]) allIdsByType; mapping(bytes32 => uint256) uintData; mapping(bytes32 => bytes) bytesData; mapping(bytes32 => address) addressData; } /** * **DATA GETTERS ** **/ function readUintForId( DataStore storage self, uint256 _id, bytes32 _key ) public view returns (uint256 data) { data = self.uintData[keccak256(abi.encodePacked(_id, _key))]; } function readBytesForId( DataStore storage self, uint256 _id, bytes32 _key ) public view returns (bytes memory data) { data = self.bytesData[keccak256(abi.encodePacked(_id, _key))]; } function readAddressForId( DataStore storage self, uint256 _id, bytes32 _key ) public view returns (address data) { data = self.addressData[keccak256(abi.encodePacked(_id, _key))]; } /** * **DATA SETTERS ** **/ function writeUintForId( DataStore storage self, uint256 _id, bytes32 _key, uint256 data ) public { self.uintData[keccak256(abi.encodePacked(_id, _key))] = data; } function writeBytesForId( DataStore storage self, uint256 _id, bytes32 _key, bytes memory data ) public { self.bytesData[keccak256(abi.encodePacked(_id, _key))] = data; } function writeAddressForId( DataStore storage self, uint256 _id, bytes32 _key, address data ) public { self.addressData[keccak256(abi.encodePacked(_id, _key))] = data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal onlyInitializing { } function __ERC20Burnable_init_unchained() internal onlyInitializing { } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": { "contracts/Portal/utils/DataStoreLib.sol": { "DataStoreUtils": "0xc7332d9abef755c42b4df9d9db09beef15f8f9fb" } } }
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimerId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSurplus","type":"uint256"}],"name":"FeeClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"MaintainerFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxFee","type":"uint256"}],"name":"MaxMaintainerFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"activeOperator","type":"uint256"}],"name":"OperatorActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"deactiveOperator","type":"uint256"}],"name":"OperatorDeactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"distributedFeeTotal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updateTimeStamp","type":"uint256"}],"name":"OracleUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"PausedPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerShare","type":"uint256"}],"name":"PriceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSurplus","type":"uint256"}],"name":"SurplusClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UnpausedPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"operatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paidDebt","type":"uint256"}],"name":"debtPaid","type":"event"},{"inputs":[],"name":"DEACTIVATION_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IGNORABLE_DEBT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE_ACTIVE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gAVAX_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61486061003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106101985760003560e01c806376b05054116100e8578063b86aaf82116100a1578063e7345b691161007b578063e7345b691461040b578063fd34c1c01461042b578063fdf454fa1461043e578063fe406a7d1461045e57600080fd5b8063b86aaf82146103b0578063d163f89a146103d0578063d965692d146103e357600080fd5b806376b05054146103445780637c20672e1461035357806385c56cc51461035d57806386a51db514610370578063901b0a43146103445780639e8c22831461039057600080fd5b80633f4cdcda11610155578063569391b61161012f578063569391b6146102db5780635f365cb4146102fb5780636b4a7685146103045780636ecc89651461032457600080fd5b80633f4cdcda1461028d578063538b984f146102a857806355e66bad146102bb57600080fd5b8063053b592e1461019d5780630700d74b146101d057806313fec1c0146101f25780632f11d0021461021257806334e86093146102425780633c9caf1c1461027a575b600080fd5b8180156101a957600080fd5b506101bd6101b83660046143bf565b610468565b6040519081526020015b60405180910390f35b8180156101dc57600080fd5b506101f06101eb366004614257565b610789565b005b8180156101fe57600080fd5b506101bd61020d3660046142b2565b61081b565b81801561021e57600080fd5b5061023261022d3660046142b2565b610dfa565b60405190151581526020016101c7565b81801561024e57600080fd5b5061026261025d366004614159565b611433565b6040516001600160a01b0390911681526020016101c7565b610262610288366004614257565b611444565b61026261029b3660046142de565b546001600160a01b031690565b6101bd6102b6366004614257565b6114e9565b8180156102c757600080fd5b506101f06102d6366004614279565b611579565b8180156102e757600080fd5b506101f06102f6366004614257565b611773565b6101bd61070881565b81801561031057600080fd5b5061026261031f3660046142b2565b6118e7565b81801561033057600080fd5b5061023261033f3660046142b2565b611ecc565b6101bd670de0b6b3a764000081565b6101bd6213c68081565b61023261036b366004614257565b6120ff565b81801561037c57600080fd5b506101f061038b3660046142f7565b6121ae565b81801561039c57600080fd5b506101f06103ab366004614257565b61282b565b8180156103bc57600080fd5b506101bd6103cb366004614329565b612988565b6101bd6103de3660046142b2565b612f44565b6103f66103f13660046142b2565b613091565b604080519283526020830191909152016101c7565b81801561041757600080fd5b506102326104263660046142b2565b613171565b610262610439366004614257565b613446565b81801561044a57600080fd5b506101f06104593660046142f7565b61349f565b6101bd6201518081565b60008034116104be5760405162461bcd60e51b815260206004820152601a60248201527f47656f6465506f7274616c3a206e6f206176617820676976656e00000000000060448201526064015b60405180910390fd5b6104c885856120ff565b156105155760405162461bcd60e51b815260206004820152601d60248201527f5374616b655574696c733a206d696e74696e672069732070617573656400000060448201526064016104b5565b60006105218686613446565b6001600160a01b03166314a6bf0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561055957600080fd5b505afa15801561056d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059191906143fa565b90503481106105b1576105a987873388348989613672565b915050610780565b600034670de0b6b3a76400008311156105e3576105d48989338a8760008b613672565b91506105e08382614744565b90505b60006105ef8a896114e9565b610601670de0b6b3a764000084614725565b61060b9190614711565b8a54909150610625906001600160a01b0316338a84613837565b60405163f237bab360e01b815273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea400908b908b908690859063f237bab39061066c90869086906004016146b5565b60206040518083038186803b15801561068457600080fd5b505af4158015610698573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bc91906143fa565b6106c691906146f9565b6040518463ffffffff1660e01b81526004016106e4939291906146d3565b60006040518083038186803b1580156106fc57600080fd5b505af4158015610710573d6000803e3d6000fd5b5050505086818461072191906146f9565b101561076f5760405162461bcd60e51b815260206004820152601e60248201527f5374616b655574696c733a206c657373207468616e206d696e4761766178000060448201526064016104b5565b61077981846146f9565b9450505050505b95945050505050565b81600701548111156107dd5760405162461bcd60e51b815260206004820152601e60248201527f5374616b655574696c733a20666565206d6f7265207468616e2031303025000060448201526064016104b5565b600982018190556040518181527f885da6736df929c01d726b95426cc170346a259f1cfbd6b238f37fc58f420cfa9060200160405180910390a15050565b6000838383428373c7332d9abef755c42b4df9d9db09beef15f8f9fb63f237bab3909185856040516020016108509190614499565b604051602081830303815290604052805190602001206040518463ffffffff1660e01b8152600401610895939291909283526020830191909152604082015260600190565b60206040518083038186803b1580156108ad57600080fd5b505af41580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e591906143fa565b116109025760405162461bcd60e51b81526004016104b59061452b565b61090c878761390f565b156109295760405162461bcd60e51b81526004016104b59061457f565b600080610937898989613091565b60405163f237bab360e01b8152919350915060009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab390610978908d908d906004016146b5565b60206040518083038186803b15801561099057600080fd5b505af41580156109a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c891906143fa565b90506000831180156109da5750600081115b610a455760405162461bcd60e51b815260206004820152603660248201527f5374616b655574696c733a2066656520616e6420737572706c75732073686f756044820152756c6420626520626967676572207468616e207a65726f60501b60648201526084016104b5565b808311610a525782610a54565b805b965073c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008b8b610a7c8b86614744565b6040518463ffffffff1660e01b8152600401610a9a939291906146d3565b60006040518083038186803b158015610ab257600080fd5b505af4158015610ac6573d6000803e3d6000fd5b505060405163f237bab360e01b81526000925073c7332d9abef755c42b4df9d9db09beef15f8f9fb915063f237bab390610b06908e908e906004016145f7565b60206040518083038186803b158015610b1e57600080fd5b505af4158015610b32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5691906143fa565b905073c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008c8c610b7e8c86614744565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526c756e636c61696d65644665657360981b6044830152606482015260840160006040518083038186803b158015610bd857600080fd5b505af4158015610bec573d6000803e3d6000fd5b5050604051630143c90b60e71b81526000925073c7332d9abef755c42b4df9d9db09beef15f8f9fb915063a1e4858090610c2c908f908e9060040161464e565b60206040518083038186803b158015610c4457600080fd5b505af4158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c9190614176565b905073c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008d8d87610ca58e8b614744565b6040516001600160e01b031960e087901b168152600481019490945260248401929092526044830152606482015260840160006040518083038186803b158015610cee57600080fd5b505af4158015610d02573d6000803e3d6000fd5b505050506000816001600160a01b03168a60405160006040518083038185875af1925050503d8060008114610d53576040519150601f19603f3d011682016040523d82523d6000602084013e610d58565b606091505b5050905080610da95760405162461bcd60e51b815260206004820152601f60248201527f5374616b655574696c733a204661696c656420746f2073656e6420417661780060448201526064016104b5565b604080518d8152602081018d90529081018b90527f25722fddd3d0eee26ce8297d72e7b76fce040b1b7e9c3243ccfec84b0f3f24509060600160405180910390a15050505050505050509392505050565b604051630143c90b60e71b815260009084908390339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e4858090610e3c908690869060040161464e565b60206040518083038186803b158015610e5457600080fd5b505af4158015610e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8c9190614176565b6001600160a01b031614610eb25760405162461bcd60e51b81526004016104b5906145b6565b858585428373c7332d9abef755c42b4df9d9db09beef15f8f9fb63f237bab390918585604051602001610ee59190614499565b604051602081830303815290604052805190602001206040518463ffffffff1660e01b8152600401610f2a939291909283526020830191909152604082015260600190565b60206040518083038186803b158015610f4257600080fd5b505af4158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a91906143fa565b11610f975760405162461bcd60e51b81526004016104b59061452b565b610fa1898961390f565b15610fbe5760405162461bcd60e51b81526004016104b59061457f565b60405163f237bab360e01b815260009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab390610ffa908d908d906004016145f7565b60206040518083038186803b15801561101257600080fd5b505af4158015611026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104a91906143fa565b60405163f237bab360e01b815290915060009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab390611089908e908e906004016146b5565b60206040518083038186803b1580156110a157600080fd5b505af41580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d991906143fa565b90508181116111365760405162461bcd60e51b8152602060048201526024808201527f5374616b655574696c733a20706f6f6c20666565732065786365656420737572604482015263706c757360e01b60648201526084016104b5565b6040516223bfa960ea1b815273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea40090611170908e908e9087906004016146d3565b60006040518083038186803b15801561118857600080fd5b505af415801561119c573d6000803e3d6000fd5b505060405163f237bab360e01b81526000925073c7332d9abef755c42b4df9d9db09beef15f8f9fb915063f237bab3906111dc908f908f9060040161466f565b60206040518083038186803b1580156111f457600080fd5b505af4158015611208573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122c91906143fa565b905073c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008d8d8661125587876146f9565b61125f9190614744565b6040518463ffffffff1660e01b815260040161127d9392919061468e565b60006040518083038186803b15801561129557600080fd5b505af41580156112a9573d6000803e3d6000fd5b5050505060008c73c7332d9abef755c42b4df9d9db09beef15f8f9fb63a1e4858090918d6040518363ffffffff1660e01b81526004016112ea92919061464e565b60206040518083038186803b15801561130257600080fd5b505af4158015611316573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133a9190614176565b6001600160a01b031661134d8585614744565b604051600081818185875af1925050503d8060008114611389576040519150601f19603f3d011682016040523d82523d6000602084013e61138e565b606091505b50509050806113df5760405162461bcd60e51b815260206004820152601f60248201527f5374616b655574696c733a204661696c656420746f2073656e6420417661780060448201526064016104b5565b7fe72e921f860b05525da6c01e054f27683e8b04c1c82ef4335cc414a63c3f15198c61140b8686614744565b6040805192835260208301919091520160405180910390a19c9b505050505050505050505050565b600061143e826139e6565b92915050565b604051630143c90b60e71b815260048101839052602481018290526626282a37b5b2b760c91b604482015260009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e48580906064015b60206040518083038186803b1580156114aa57600080fd5b505af41580156114be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e29190614176565b9392505050565b60006114fc83546001600160a01b031690565b6001600160a01b031663f759cc3b836040518263ffffffff1660e01b815260040161152991815260200190565b60206040518083038186803b15801561154157600080fd5b505afa158015611555573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e291906143fa565b604051630143c90b60e71b815260048101849052602481018390526921a7a72a2927a62622a960b11b6044820152339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e485809060640160206040518083038186803b1580156115e057600080fd5b505af41580156115f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116189190614176565b6001600160a01b03161461167d5760405162461bcd60e51b815260206004820152602660248201527f5374616b655574696c733a206e6f7420434f4e54524f4c4c4552206f662067696044820152651d995b881a5960d21b60648201526084016104b5565b6001600160a01b0381166116e25760405162461bcd60e51b815260206004820152602660248201527f5374616b655574696c733a206d61696e7461696e65722063616e206e6f74206260448201526565207a65726f60d01b60648201526084016104b5565b60405163dff34ff160e01b815260048101849052602481018390526936b0b4b73a30b4b732b960b11b60448201526001600160a01b038216606482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb9063dff34ff19060840160006040518083038186803b15801561175657600080fd5b505af415801561176a573d6000803e3d6000fd5b50505050505050565b604051630143c90b60e71b815282908290339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e48580906117b2908690869060040161464e565b60206040518083038186803b1580156117ca57600080fd5b505af41580156117de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118029190614176565b6001600160a01b0316146118285760405162461bcd60e51b81526004016104b5906145b6565b60408051808201825260018152603160f81b60208201529051630eee4dd960e41b815273c7332d9abef755c42b4df9d9db09beef15f8f9fb9163eee4dd909161187891889188919060040161461b565b60006040518083038186803b15801561189057600080fd5b505af41580156118a4573d6000803e3d6000fd5b505050507fcf61a69571fcb149379b9264df303e430a464346ff265a1bf29782c491aba6d5836040516118d991815260200190565b60405180910390a150505050565b60008082116119385760405162461bcd60e51b815260206004820152601c60248201527f5374616b655574696c733a2069642073686f756c64206265203e20300000000060448201526064016104b5565b604051630143c90b60e71b815260048101849052602481018390526d1dda5d1a191c985dd85b141bdbdb60921b604482015260009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e485809060640160206040518083038186803b1580156119a457600080fd5b505af41580156119b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119dc9190614176565b6001600160a01b031614611a445760405162461bcd60e51b815260206004820152602960248201527f5374616b655574696c733a207769746864726177616c506f6f6c20616c72656160448201526864792065786973747360b81b60648201526084016104b5565b6001840154611a5b906001600160a01b0316611433565b90506000816001600160a01b031663303e9bea611a7f87546001600160a01b031690565b6040516301ae508b60e11b81526004810188905260248101879052636e616d6560e01b6044820152869073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063035ca1169060640160006040518083038186803b158015611ae057600080fd5b505af4158015611af4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b1c91908101906141b5565b604051602001611b2c919061443f565b60408051808303601f19018152908290526301ae508b60e11b8252600482018a905260248201899052636e616d6560e01b60448301529073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063035ca1169060640160006040518083038186803b158015611b9a57600080fd5b505af4158015611bae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bd691908101906141b5565b604051602001611be69190614472565b6040516020818303038152906040528a600401548b600501548c600601548d60020160009054906101000a90046001600160a01b03166040518963ffffffff1660e01b8152600401611c3f9897969594939291906144bf565b602060405180830381600087803b158015611c5957600080fd5b505af1158015611c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c919190614176565b9050611ca685670de0b6b3a764000085613a83565b60405163dff34ff160e01b815260048101859052602481018490526d1dda5d1a191c985dd85b141bdbdb60921b60448201526001600160a01b038316606482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb9063dff34ff19060840160006040518083038186803b158015611d1e57600080fd5b505af4158015611d32573d6000803e3d6000fd5b505060405163dff34ff160e01b815260048101879052602481018690526626282a37b5b2b760c91b60448201526001600160a01b038416606482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb925063dff34ff1915060840160006040518083038186803b158015611da757600080fd5b505af4158015611dbb573d6000803e3d6000fd5b50505050611dd085546001600160a01b031690565b60405163a22cb46560e01b81526001600160a01b03848116600483015260016024830152919091169063a22cb46590604401600060405180830381600087803b158015611e1c57600080fd5b505af1158015611e30573d6000803e3d6000fd5b50505050611e3e8484611444565b60405163095ea7b360e01b81526001600160a01b0384811660048301526000196024830152919091169063095ea7b390604401602060405180830381600087803b158015611e8b57600080fd5b505af1158015611e9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec39190614193565b50509392505050565b604051630143c90b60e71b815260009084908490339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e4858090611f0e908690869060040161464e565b60206040518083038186803b158015611f2657600080fd5b505af4158015611f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5e9190614176565b6001600160a01b031614611f845760405162461bcd60e51b81526004016104b5906145b6565b6040516223bfa960ea1b815260048101879052602481018690526d30b1ba34bb32a7b832b930ba37b960911b60448201526064810185905273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea4009060840160006040518083038186803b158015611ff357600080fd5b505af4158015612007573d6000803e3d6000fd5b505050508573c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4009091878760405160200161203a9190614499565b604051602081830303815290604052805190602001206000196040518563ffffffff1660e01b8152600401612088949392919093845260208401929092526040830152606082015260800190565b60006040518083038186803b1580156120a057600080fd5b505af41580156120b4573d6000803e3d6000fd5b505060408051888152602081018890527f21a1f9712a3958e2b18cbc36d5d46385602f172ccabcb4948e557731a3a7423193500190505b60405180910390a150600195945050505050565b6040516301ae508b60e11b815260048101839052602481018290526a1cdd185ad954185d5cd95960aa1b604482015260009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063035ca1169060640160006040518083038186803b15801561216857600080fd5b505af415801561217c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121a491908101906141b5565b5115159392505050565b604051630143c90b60e71b815283908290339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e48580906121ed908690869060040161464e565b60206040518083038186803b15801561220557600080fd5b505af4158015612219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223d9190614176565b6001600160a01b0316146122635760405162461bcd60e51b81526004016104b5906145b6565b848484428373c7332d9abef755c42b4df9d9db09beef15f8f9fb63f237bab3909185856040516020016122969190614499565b604051602081830303815290604052805190602001206040518463ffffffff1660e01b81526004016122db939291909283526020830191909152604082015260600190565b60206040518083038186803b1580156122f357600080fd5b505af4158015612307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061232b91906143fa565b116123485760405162461bcd60e51b81526004016104b59061452b565b612352888861390f565b1561236f5760405162461bcd60e51b81526004016104b59061457f565b600034116123bf5760405162461bcd60e51b815260206004820152601b60248201527f5374616b655574696c733a206e6f20617661782069732073656e74000000000060448201526064016104b5565b60405163f237bab360e01b8152349060009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab3906123fd908d908d906004016146b5565b60206040518083038186803b15801561241557600080fd5b505af4158015612429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244d91906143fa565b60405163f237bab360e01b815290915060009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39061248c908e908e906004016145f7565b60206040518083038186803b1580156124a457600080fd5b505af41580156124b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124dc91906143fa565b9050818111156125195760006124f28383614744565b9050838111156124ff5750825b61250981846146f9565b92506125158185614744565b9350505b82156125ee57600061252b8c8c613446565b6001600160a01b03166314a6bf0f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561256357600080fd5b505afa158015612577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259b91906143fa565b9050670de0b6b3a76400008111156125d957838111156125b85750825b6125cb8d8d60008e856000600019613672565b506125d68185614744565b93505b83156125ec576125e984846146f9565b92505b505b73c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008c8c61261487876146f9565b6040518463ffffffff1660e01b8152600401612632939291906146d3565b60006040518083038186803b15801561264a57600080fd5b505af415801561265e573d6000803e3d6000fd5b505060405163f237bab360e01b81526000925073c7332d9abef755c42b4df9d9db09beef15f8f9fb915063f237bab39061269e908f908f9060040161466f565b60206040518083038186803b1580156126b657600080fd5b505af41580156126ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ee91906143fa565b9050348111156127715773c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008d8d61271e3486614744565b6040518463ffffffff1660e01b815260040161273c9392919061468e565b60006040518083038186803b15801561275457600080fd5b505af4158015612768573d6000803e3d6000fd5b505050506127dd565b6040516223bfa960ea1b815273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea400906127ac908f908f9060009060040161468e565b60006040518083038186803b1580156127c457600080fd5b505af41580156127d8573d6000803e3d6000fd5b505050505b604080518c8152602081018c9052348183015290517fde3db790d888b38bebb70a5e7060eebb2bc072ab3e5de4c2b3e58bf9d057dc5d9181900360600190a150505050505050505050505050565b604051630143c90b60e71b815282908290339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e485809061286a908690869060040161464e565b60206040518083038186803b15801561288257600080fd5b505af4158015612896573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ba9190614176565b6001600160a01b0316146128e05760405162461bcd60e51b81526004016104b5906145b6565b60408051602081018252600081529051630eee4dd960e41b815273c7332d9abef755c42b4df9d9db09beef15f8f9fb9163eee4dd909161292791889188919060040161461b565b60006040518083038186803b15801561293f57600080fd5b505af4158015612953573d6000803e3d6000fd5b505050507fb65b578bda484b20413a2e121e50adf4c8d77c34c2459a2f658d8a228b8279cb836040516118d991815260200190565b60038801546000906001600160a01b031633146129f15760405162461bcd60e51b815260206004820152602160248201527f5374616b655574696c733a206d73672e73656e646572204e4f54206f7261636c6044820152606560f81b60648201526084016104b5565b6129fb888761390f565b612a475760405162461bcd60e51b815260206004820181905260248201527f5374616b655574696c733a204f7261636c65206973204e4f542061637469766560448201526064016104b5565b612a5361070842614744565b871015612ab65760405162461bcd60e51b815260206004820152602b60248201527f5374616b655574696c733a205265706f727465642074696d657374616d70206960448201526a1cc81393d5081d985b1a5960aa1b60648201526084016104b5565b600080612ac88b8b8a8a8a8a8a613b80565b60405163f237bab360e01b81529193509150600090839073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab390612b0b908f908e9060040161466f565b60206040518083038186803b158015612b2357600080fd5b505af4158015612b37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5b91906143fa565b612b6591906146f9565b6040516223bfa960ea1b815290915073c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea40090612ba2908e908d90869060040161468e565b60006040518083038186803b158015612bba57600080fd5b505af4158015612bce573d6000803e3d6000fd5b505050506000828c73c7332d9abef755c42b4df9d9db09beef15f8f9fb63f237bab390918d6040518363ffffffff1660e01b8152600401612c109291906145f7565b60206040518083038186803b158015612c2857600080fd5b505af4158015612c3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6091906143fa565b612c6a91906146f9565b6040516223bfa960ea1b8152600481018e9052602481018c90526c756e636c61696d65644665657360981b60448201526064810182905290915073c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea4009060840160006040518083038186803b158015612cdb57600080fd5b505af4158015612cef573d6000803e3d6000fd5b50505050612d048d546001600160a01b031690565b6001600160a01b031663bd85b0398b6040518263ffffffff1660e01b8152600401612d3191815260200190565b60206040518083038186803b158015612d4957600080fd5b505afa158015612d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d8191906143fa565b670de0b6b3a7640000828e73c7332d9abef755c42b4df9d9db09beef15f8f9fb63f237bab390918f6040518363ffffffff1660e01b8152600401612dc69291906146b5565b60206040518083038186803b158015612dde57600080fd5b505af4158015612df2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e1691906143fa565b612e2090866146f9565b612e2a9190614744565b612e349190614725565b612e3e9190614711565b9450612e4c8d8d8c88613f99565b612e578d868c613a83565b6040516223bfa960ea1b8152600481018d9052602481018b90527406f7261636c6555706461746554696d655374616d7605c1b604482015242606482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea4009060840160006040518083038186803b158015612ecc57600080fd5b505af4158015612ee0573d6000803e3d6000fd5b5050604080518d81526020810189905290810185905260608101869052608081018e90527fd6830e63bb637542d836b7e0c83b3f7f93ec3a7aa07ecbdd5e4be539ca8baded925060a001905060405180910390a15050505098975050505050505050565b600983015460405163f237bab360e01b815260048101849052602481018390526266656560e81b60448201526000919073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39060640160206040518083038186803b158015612fab57600080fd5b505af4158015612fbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe391906143fa565b116130835760405163f237bab360e01b815260048101849052602481018390526266656560e81b604482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39060640160206040518083038186803b15801561304657600080fd5b505af415801561305a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061307e91906143fa565b613089565b83600901545b949350505050565b600080826040516020016130be9181526d616363756d756c6174656446656560901b6020820152602e0190565b60408051808303601f1901815290829052805160209091012063f237bab360e01b8252600482018790526024820186905260448201819052915073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39060640160206040518083038186803b15801561312f57600080fd5b505af4158015613143573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061316791906143fa565b9150935093915050565b604051630143c90b60e71b815260009084908490339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e48580906131b3908690869060040161464e565b60206040518083038186803b1580156131cb57600080fd5b505af41580156131df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132039190614176565b6001600160a01b0316146132295760405162461bcd60e51b81526004016104b5906145b6565b60405163f237bab360e01b815260048101879052602481018690526d30b1ba34bb32a7b832b930ba37b960911b6044820152849073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39060640160206040518083038186803b15801561329457600080fd5b505af41580156132a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132cc91906143fa565b141561335a576040516223bfa960ea1b815260048101879052602481018690526d30b1ba34bb32a7b832b930ba37b960911b60448201526000606482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea4009060840160006040518083038186803b15801561334157600080fd5b505af4158015613355573d6000803e3d6000fd5b505050505b8573c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea400909187876040516020016133899190614499565b604051602081830303815290604052805190602001206213c680426133ae91906146f9565b6040516001600160e01b031960e087901b168152600481019490945260248401929092526044830152606482015260840160006040518083038186803b1580156133f757600080fd5b505af415801561340b573d6000803e3d6000fd5b505060408051888152602081018890527f01d08061ca1d76ec162ee0ace672e4f6b555823b72979c7881e786cc68ac3f7793500190506120eb565b604051630143c90b60e71b815260048101839052602481018290526d1dda5d1a191c985dd85b141bdbdb60921b604482015260009073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e4858090606401611492565b604051630143c90b60e71b815283908390339073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063a1e48580906134de908690869060040161464e565b60206040518083038186803b1580156134f657600080fd5b505af415801561350a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061352e9190614176565b6001600160a01b0316146135545760405162461bcd60e51b81526004016104b5906145b6565b85600901548311156135b45760405162461bcd60e51b8152602060048201526024808201527f5374616b655574696c733a204d41585f4d41494e5441494e45525f4645452045604482015263292927a960e11b60648201526084016104b5565b6040516223bfa960ea1b815260048101869052602481018590526266656560e81b60448201526064810184905273c7332d9abef755c42b4df9d9db09beef15f8f9fb90638efea4009060840160006040518083038186803b15801561361857600080fd5b505af415801561362c573d6000803e3d6000fd5b505060408051878152602081018790527f81a262d98ca887595ab153e1384407a02b7a2aaf612822e067f9dd6613a84ce2935001905060405180910390a1505050505050565b600061367e8786613446565b6040516348b4aac360e11b815260006004820152600160248201526044810186905260648101859052608481018490526001600160a01b039190911690639169558690869060a4016020604051808303818588803b1580156136df57600080fd5b505af11580156136f3573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061371891906143fa565b90506001600160a01b0386166137a15787546001600160a01b0316604051637a94c56560e11b815230600482015260248101879052604481018390526001600160a01b03919091169063f5298aca90606401600060405180830381600087803b15801561378457600080fd5b505af1158015613798573d6000803e3d6000fd5b5050505061382c565b87546001600160a01b0316604051637921219560e11b81523060048201526001600160a01b038881166024830152604482018890526064820184905260a06084830152600060a4830152919091169063f242432a9060c401600060405180830381600087803b15801561381357600080fd5b505af1158015613827573d6000803e3d6000fd5b505050505b979650505050505050565b600082116138925760405162461bcd60e51b815260206004820152602260248201527f5374616b655574696c733a205f6d696e742069642073686f756c64206265203e604482015261020360f41b60648201526084016104b5565b60405163731133e960e01b81526001600160a01b0384811660048301526024820184905260448201839052608060648301526000608483015285169063731133e99060a401600060405180830381600087803b1580156138f157600080fd5b505af1158015613905573d6000803e3d6000fd5b5050505050505050565b600061070861392162015180426147a6565b111580156114e2575061393661070842614744565b60405163f237bab360e01b815260048101859052602481018490527406f7261636c6555706461746554696d655374616d7605c1b604482015273c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39060640160206040518083038186803b1580156139a657600080fd5b505af41580156139ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139de91906143fa565b109392505050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116613a7e5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b60448201526064016104b5565b919050565b60008111613ad35760405162461bcd60e51b815260206004820152601c60248201527f5374616b655574696c733a2069642073686f756c64206265203e20300000000060448201526064016104b5565b82546001600160a01b03166040516322af599760e01b815260048101849052602481018390526001600160a01b0391909116906322af599790604401600060405180830381600087803b158015613b2957600080fd5b505af1158015613b3d573d6000803e3d6000fd5b505060408051848152602081018690527f8aa4fa52648a6d15edce8a179c792c86f3719d0cc3c572cf90f91948f0f2cb68935001905060405180910390a1505050565b600080848314613be25760405162461bcd60e51b815260206004820152602760248201527f5374616b655574696c733a204172726179206c656e6774687320646f65736e276044820152660e840dac2e8c6d60cb1b60648201526084016104b5565b60005b85811015613eb35787878783818110613c0057613c006147e6565b9050602002013514613e7b57613c196201518042614744565b73c7332d9abef755c42b4df9d9db09beef15f8f9fb63f237bab38b8b8b8b87818110613c4757613c476147e6565b90506020020135604051602001613c5e9190614499565b604051602081830303815290604052805190602001206040518463ffffffff1660e01b8152600401613ca3939291909283526020830191909152604082015260600190565b60206040518083038186803b158015613cbb57600080fd5b505af4158015613ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cf391906143fa565b11613d585760405162461bcd60e51b815260206004820152602f60248201527f5374616b655574696c733a205f6f7049642061637469766174696f6e4578706960448201526e1c985d1a5bdb881a185cc81c185cdd608a1b60648201526084016104b5565b6000613d7d8b8b8a8a86818110613d7157613d716147e6565b90506020020135612f44565b9050600080613da58c8c8c8c88818110613d9957613d996147e6565b90506020020135613091565b9150915060008d60070154898987818110613dc257613dc26147e6565b9050602002013585613dd49190614725565b613dde9190614711565b905073c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008e8e85613e0786896146f9565b6040516001600160e01b031960e087901b168152600481019490945260248401929092526044830152606482015260840160006040518083038186803b158015613e5057600080fd5b505af4158015613e64573d6000803e3d6000fd5b505050508086613e7491906146f9565b9550505050505b848482818110613e8d57613e8d6147e6565b9050602002013583613e9f91906146f9565b925080613eab8161478b565b915050613be5565b506000613ec18a8a8a612f44565b905060008a600701548483613ed69190614725565b613ee09190614711565b9050600080613ef08c8c8d613091565b9092509050613eff83866146f9565b945073c7332d9abef755c42b4df9d9db09beef15f8f9fb638efea4008d8d84613f2888886146f9565b6040516001600160e01b031960e087901b168152600481019490945260248401929092526044830152606482015260840160006040518083038186803b158015613f7157600080fd5b505af4158015613f85573d6000803e3d6000fd5b505050505050505097509795505050505050565b60405163f237bab360e01b815260048101849052602481018390527406f7261636c6555706461746554696d655374616d7605c1b6044820152600090620151809073c7332d9abef755c42b4df9d9db09beef15f8f9fb9063f237bab39060640160206040518083038186803b15801561401157600080fd5b505af4158015614025573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061404991906143fa565b614055610708426146f9565b61405f9190614744565b6140699190614711565b9050600061407786856114e9565b905060008660070154838860080154846140919190614725565b61409b9190614725565b6140a59190614711565b6140af90836146f9565b90508084111580156140c15750818410155b61176a5760405162461bcd60e51b815260206004820152601d60248201527f5374616b655574696c733a20707269636520646964204e4f54206d657400000060448201526064016104b5565b60008083601f84011261411f57600080fd5b50813567ffffffffffffffff81111561413757600080fd5b6020830191508360208260051b850101111561415257600080fd5b9250929050565b60006020828403121561416b57600080fd5b81356114e281614812565b60006020828403121561418857600080fd5b81516114e281614812565b6000602082840312156141a557600080fd5b815180151581146114e257600080fd5b6000602082840312156141c757600080fd5b815167ffffffffffffffff808211156141df57600080fd5b818401915084601f8301126141f357600080fd5b815181811115614205576142056147fc565b604051601f8201601f19908116603f0116810190838211818310171561422d5761422d6147fc565b8160405282815287602084870101111561424657600080fd5b61382c83602083016020880161475b565b6000806040838503121561426a57600080fd5b50508035926020909101359150565b60008060006060848603121561428e57600080fd5b833592506020840135915060408401356142a781614812565b809150509250925092565b6000806000606084860312156142c757600080fd5b505081359360208301359350604090920135919050565b6000602082840312156142f057600080fd5b5035919050565b6000806000806080858703121561430d57600080fd5b5050823594602084013594506040840135936060013592509050565b60008060008060008060008060c0898b03121561434557600080fd5b88359750602089013596506040890135955060608901359450608089013567ffffffffffffffff8082111561437957600080fd5b6143858c838d0161410d565b909650945060a08b013591508082111561439e57600080fd5b506143ab8b828c0161410d565b999c989b5096995094979396929594505050565b600080600080600060a086880312156143d757600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b60006020828403121561440c57600080fd5b5051919050565b6000815180845261442b81602086016020860161475b565b601f01601f19169290920160200192915050565b6000825161445181846020870161475b565b6e16a3b2b7b232902ba8102a37b5b2b760891b920191825250600f01919050565b6000825161448481846020870161475b565b6202d57560ec1b920191825250600301919050565b9081527330b1ba34bb30ba34b7b722bc3834b930ba34b7b760611b602082015260340190565b6001600160a01b03898116825260208201899052610100604083018190526000916144ec8483018b614413565b91508382036060850152614500828a614413565b92508760808501528660a08501528560c085015280851660e085015250509998505050505050505050565b60208082526034908201527f5374616b655574696c733a206f70657261746f7249642061637469766174696f6040820152731b915e1c1a5c985d1a5bdb881a185cc81c185cdd60621b606082015260800190565b6020808252601c908201527f5374616b655574696c733a204f7261636c652069732061637469766500000000604082015260600190565b60208082526021908201527f5374616b655574696c733a2073656e646572206e6f74206d61696e7461696e656040820152603960f91b606082015260800190565b91825260208201526c756e636c61696d65644665657360981b604082015260600190565b8381528260208201526a1cdd185ad954185d5cd95960aa1b60408201526080606082015260006107806080830184614413565b91825260208201526936b0b4b73a30b4b732b960b11b604082015260600190565b9182526020820152677042616c616e636560c01b604082015260600190565b9283526020830191909152677042616c616e636560c01b6040830152606082015260800190565b918252602082015266737572706c757360c81b604082015260600190565b928352602083019190915266737572706c757360c81b6040830152606082015260800190565b6000821982111561470c5761470c6147ba565b500190565b600082614720576147206147d0565b500490565b600081600019048311821515161561473f5761473f6147ba565b500290565b600082821015614756576147566147ba565b500390565b60005b8381101561477657818101518382015260200161475e565b83811115614785576000848401525b50505050565b600060001982141561479f5761479f6147ba565b5060010190565b6000826147b5576147b56147d0565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461482757600080fd5b5056fea2646970667358221220ece89a2b55e74d2dee56d9ca8947a2ab934026b2b5535643dcbdf1ddb60451c764736f6c63430008070033
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.