source code of the contract(SolidityStandard json inputFormat)
More options
Is this a proxy? NEWSimilarSol2UmlORSend invoice verificationComparison NEW
File 1 of 50: FarmingCenter.sol
// SPDX license identifier: BUSL-1.1pragma solidity =0.7.6;pragma abicoder v2;import './interfaces/IFarmingCenter.sol';import './interfaces/IFarmingCenterVault.sol';import 'algebra/contracts/ Interfaces/IAlgebraPool.sol';Import 'Algebra/Contracts/Interfaces/IERC20Minimal.sol';Import 'Algebra-Periphery/Contracts/Interfaces/INonfungiblePositionManager.sol';Import 'Algebra-Periphery/Contracts/Base/Multicall.sol'; import 'algebra-periphery/contracts/base/ERC721Permit.sol';import './base/PeripheryPayments.sol';import './libraries/IncentiveId.sol';/// @title Main Algebra Agricultural Contract/// @ dev Manages farms and performs input, output, and other actions. Contract FarmingCenter is IArmingCenter, ERC721Permit, Multicall, PeripheryPayments { IAlgebraLimitFarming public immutable override limitFarming; IAlgebraEternalFarming override public immutable eternal farming; INonfungiblePositionManager immutable public override nonfungiblePositionManager; IArmingCenterVault Immutable public override of FarmingCenterVault; /// @dev The ID of the next token to be minted. Ignores 0 uint256 private _nextId = 1; /// @dev store virtual pool addresses in pool mapping (Address => VirtualPoolAddresses) private _virtualPoolAddresses; /// @dev deposits[tokenId] => Deposit mapping (uint256 => Deposit) public override deposits; mapping (uint256 => L2Nft) public override l2Nfts; /// @notice Represents the deposit of an NFT liquidity structure Deposit { uint256 L2TokenId; uint32 numberOfFarms; bool inLimitFarming; address owner; } /// @notice Represents the NFT layer 2 structure L2Nft { uint96 nonce; // the nonce to allow the address operator; // the approved address to issue this token uint256 tokenId; ); = _farmingCenterVault; nonfungiblePositionManager = _nonfungiblePositionManager; farmCenterVault = _farmingCenterVault; } function checkAuthorizationForToken(uint256 tokenId) private view { require(_isApprovedOrOwner(msg.sender, tokenId), 'Not Approved'); } /// @notice When receiving an algebra ERC721 , sets the owner of the token deposit setting to "from". /// @inheritdoc function IERC721Receiver onERC721Received(address, address from, uint256 tokenId, bytes calldata ) outer substitution returns (bytes4) { require(msg.sender == address(nonfungiblePositionManager ) , 'not an algebra nft'); uint256 id = _nextId; bucket storage new deposit = deposits[tokenId]; (newDeposit.L2TokenId, newDeposit.owner) = (id, from); l2Nfts[id].tokenId = tokenId; _mint(from, ID); _nextId = ID + 1; emit DepositTransferred(tokenId, address(0), from); return this.onERC721Received.selector; } function _getTokenBalanceOfVault(address token) return private view(uint256 balance) { return IERC20Minimal(token).balanceOf(address(farmingCenterVault)); } /// @inheritdoc IArmingCenter function enterFarming(IncentiveKey storage key, uint256 token id, uint256 tokensLocked, bool isLimit) outer substitution { deposit storage _deposit = deposits [token id]; checkAuthorizationForToken(_deposit.L2TokenId); (uint32 numberOfFarms, bool inLimitFarming) = (_deposit.numberOfFarms, _deposit.inLimitFarming); NumberOfFarms++; IAlgebraFarming _farming; if (isLimit) { require(!inLimitFarming, 'Token already farmed'); inLimitFarming = true; _farming = IAlgebraFarming(limitFarming); } else _farming = IAlgebraFarming(eternalFarming); (_deposit.numberOfFarms, _deposit.inLimitFarming) = (numberOfFarms, inLimitFarming); Bytes32 IncentiveId = IncentiveId.compute(key); (, , , , , address multiplierToken, ) = _farming.incentives(incentiveId); if (tokensLocked > 0) { uint256 balanceBefore = _getTokenBalanceOfVault(multiplierToken); TransferHelper.safeTransferFrom(multiplierToken, msg.sender, address(farmingCenterVault), tokensLocked); uint256 balanceAfter = _getTokenBalanceOfVault(multiplierToken); require(balanceAfter > balanceBefore, 'Not enough tokens blocked'); tokensLocked = balanceAfter - balanceBefore; farmCenterVault.lockTokens(TokenId, IncentiveId, TokensLocked); } _farming.enterFarming(key, tokenId, tokensLocked); } /// @inheritdoc IArmingCenter function exitFarming( IncentiveKey memory key, uint256 tokenId, bool isLimit ) external override { Deposit storage deposit = deposits[tokenId]; checkAuthorizationForToken(deposit.L2TokenId); IAlgebraFarming _farming; deposit.numberOfFarms -= 1; deposit.owner = msg.sender; if (isLimit) { deposit.inLimitFarming = false; _farming = IAlgebraFarming(limitFarming); } else _farming = IAlgebraFarming(eternalFarming); _farming.exitFarming(key, tokenId, msg.sender); Bytes32 IncentiveId = IncentiveId.compute(key); (, , , , , address multiplierToken, ) = _farming.incentives(incentiveId); if (multiplierToken != address(0)) { farmCenterVault.claimTokens(multiplierToken, msg.sender, tokenId, IncentiveId); } } /// @inheritdoc IArmingCenter function collect(INonfungiblePositionManager.CollectParams storage parameters) returns external substitution (uint256 amount0, uint256 amount1) { checkAuthorizationForToken(deposits[params.tokenId].L2TokenId); if(params.recipient == address(0)) { params.recipient = address(this); } return nonfungiblePositionManager.collect(params); } /// @inheritdoc IArmingCenter function collectRewards(IncentiveKey storage key, uint256 TokenId) external replacement returns(uint256 Reward, uint256 BonusReward) { checkAuthorizationForToken(deposits[tokenId].L2TokenId); _virtualPooladdress = _virtualPoolAddresses[address(key.pool)].eternalVirtualPool; if (_virtualPool != address(0)) { IAlgebraVirtualPool(_virtualPool).increaseCumulative(uint32(block.timestamp)); } (Reward, BonusReward) = foreverFarming.CollectRewards(Key, TokenId, msg.sender); } function _claimRewardFromFarming ( IAlgebraFarming _farming, IERC20Minimal RewardToken, address to, uint256 amount requested ) Internal return (uint256 reward) { return _farming.claimRewardFrom(rewardToken, msg.sender, to, amount requested); } /// @inheritdoc IArmingCenter function ClaimReward( IERC20Minimal RewardToken, address to, uint256 AmountRequestedIncentive, uint256 AmountRequestedEternal ) outer override returns (uint256 reward) { if (amountRequestedIncentive != 0) { reward = _claimRewardFromFarming(limitFarming, RewardToken, until, AmountRequestedIncentive ) ; } if (amountRequestedEternal != 0) {reward += _claimRewardFromFarming(eternalFarming, rewardToken, to, amountRequestedEternal); } } /// @inheritdoc IArmingCenter function connectVirtualPool(IAlgebraPool pool, address newVirtualPool) external override { bool isLimitFarming = msg.sender == address(limitFarming); require(isLimitFarming || msg.sender == address(eternalFarming), 'Only farming can call this'); VirtualPoolAddresses storage virtualPools = _virtualPoolAddresses[address(pool)]; newIncentivo address; if (pool.activeIncentive() == address(0)) { newIncentive = newVirtualPool; // directly activate the pool } else { if (newVirtualPool == address(0)) { // directly activate another pool, if any newIncentive = isLimitFarming ? virtualPools.eternalVirtualPool: virtualPools.limitVirtualPool; } else { newIncentive = address(this); // call via "proxy" } } pool.setIncentive(newIncentive); if (isLimitFarming) { virtualPools.limitVirtualPool = newVirtualPool; } else { virtualPools.eternalVirtualPool = newVirtualPool; } } /// @inheritdoc IArmingCenter function pullToken( uint256 tokenId, address to, memory data bytes ) external substitution { require(to != address(this), 'cannot pull to farm'); deposit store deposit = Deposits[TokenId]; uint256 l2TokenId = Deposit.L2TokenId; checkAuthorizationForToken(l2TokenId); require(deposit.numberOfFarms == 0, 'Cannot withdraw token during farmd'); Delete l2Nfts[l2TokenId]; _burn(l2TokenId); Clear deposits[tokenId]; emit DepositTransferred(tokenId, msg.sender, address(0)); nonfungiblePositionManager.safeTransferFrom(address(this), to, tokenId, data); } /** * @dev This function is called from the main pool when an initialized hook is passed and two farms are active at the same time. * @param nextTick The cross line * @param zeroToOne The direction */ function cross(int24 nextTick, bool zeroToOne) Outer substitution { VirtualPoolAddresses storage _virtualPoolAddressesForPool = _virtualPoolAddresses[msg.sender]; IAlgebraVirtualPool(_virtualPoolAddressesForPool.eternalVirtualPool).cross(nextTick, zeroToOne); IAlgebraVirtualPool(_virtualPoolAddressesForPool.limitVirtualPool).cross(nextTick, zeroToOne); } /** * @dev This function is called at the start of the switch from the main pool when two farms are active at the same time. * @param blockTimestamp The timestamp of the current block, truncated * @return status The status of the current crop(s) */ function growthCumulative(uint32 blockTimestamp) returns the outer replacement (Status status) { VirtualPoolAddresses storage _virtualPoolAddressesForPool = _virtualPoolAddresses[msg.sender ]; Status eternalStatus = IAlgebraVirtualPool(_virtualPoolAddressesForPool.eternalVirtualPool).increaseCumulative( blockTimestamp ); Status limitStatus = IAlgebraVirtualPool(_virtualPoolAddressesForPool.limitVirtualPool).increaseCumulative(blockTimestamp); if (eternalStatus == Status.ACTIVE || limitStatus == Status.ACTIVE) { return Status.ACTIVE; } Else if (limitStatus == Status.NOT_STARTED) { return Status.NOT_STARTED; } return status.NOT_EXIST; } function virtualPoolAddresses(address pool) replace external display returns (limitVP address, eternalVP address) {(limitVP, eternalVP) = (_virtualPoolAddresses[Pool].limitVirtualPool, _virtualPoolAddresses[Pool].eternalVirtualPool); } function _getAndIncrementNonce(uint256 tokenId) inner replacement returns (uint256) { return uint256(l2Nfts[tokenId].nonce++); } /// @inheritdoc IERC721 function getApproved(uint256 tokenId) public view override(ERC721, IERC721) return (address) { require(_exists(tokenId), 'ERC721: Approved query for nonexistent token'); return l2Nfts[tokenId].operator; } /// @dev overrides _approve to use the in-position operator packaged with the position permission function nonce _approve(address to, uint256 tokenId) internal override(ERC721) { l2Nfts[tokenId].operator = to; issue permission(ownerOf(tokenId), to, tokenId); }}
File 2 of 50: IArmingCenter.sol
// SPDX-Lizenzkennung: MITpragma solidity =0.7.6;pragma acoder v2;import 'algebra/contracts/interfaces/IAlgebraPool.sol';import 'algebra/contracts/interfaces/IAlgebraVirtualPool.sol';import 'algebra/contracts /interfaces/IERC20Minimal.sol';Import 'Algebra-Periphery/Contracts/Interfaces/IMulticall.sol';Import 'Algebra-Periphery/Contracts/Interfaces/INonfungiblePositionManager.sol';Import 'Algebra-Periphery/Contracts/Interfaces/IPeripheryPayments. sol';import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';import '../farmings/limitFarming/interfaces/IAlgebraLimitFarming.sol';import '../farmings/eternalFarming/interfaces/IAlgebraEternalFarming.sol' ;importiere './IFarmingCenterVault.sol';importiere './IIncentiveKey.sol';interface IArmingCenter é IAlgebraVirtualPool, IERC721Receiver, IIncentiveKey, IMulticall, IERC721Permit, IPeripheryPayments{ struct VirtualPoolAddresses { endereço ewigVirtualPool; endereço limiteVirtualPool; } função virtualPoolAddresses(endereço) visualização externa retorna (endereço, endereço); /// @notice O gerente de posição não fungÃvel com o qual este contrato agrÃcola é compatÃvel função nonfungiblePositionManager() visão externa retorna (INonfungiblePositionManager); eine Funktion limitFarming() gibt eine externe Visualisierung zurück (IAlgebraLimitFarming); eine Funktion für ewigeFarming() gibt eine externe Visualisierung zurück (IAlgebraEternalFarming); eine Funktion farmCenterVault() gibt eine externe Visualisierung zurück (IFarmingCenterVault); a função l2Nfts(uint256) retorna a visualização externa ( uint96 nonce, operator de endereço, uint256 tokenId ); /// @notice Retorna informações sobre um NFT depositado /// @param tokenId O ID do deposito (e token) que está sendo transferido /// @return L2TokenId O nft layer2 id, /// numberOfFarms O número de fazendas, / // inLimitFarming O parametro que mostra se o token está no limite farm, /// owner O proprietário da função de depositories (uint256 tokenId) a visão externa retorna (uint256 L2TokenId, uint32 numberOfFarms, bool inLimitFarming, address owner ); /// @notice Atualiza activeIncentive in AlgebraPool /// @dev somente a agricultura pode fazê-lo /// @param pool O AlgebraPool für die Landwirtschaft für Criada /// @param virtualPool O pool virtual a ser conectado function connectVirtualPool (IAlgebraPool-Pool, beendet virtualPool) externo; /// @notice Entra no incentivo (cultivo por tempo limitado ou eterno) com token NFT-position /// @dev token deve ser depositado no FarmingCenter /// @param key A chave do evento de incentivo /// @param tokenId O id da posição NFT /// @param tokensLocked Quantidade of tokens a serem bloqueados para multiplicador of liquidez (se niveis forem usados) /// @param isLimit É uma função de incentivo limitada por tempo ou ewig enterFarming( Chave of memory IncentiveKey, uint256 tokenId, uint256 tokensLocked, bool isLimit ) externo; /// @notice Sai do incentivo (tempo limitado ou cultivo eterno) com token of position NFT /// @param key A chave do evento of incentivo /// @param tokenId O id of position NFT /// @param isLimit É begrenzte Anreizfunktion für das Tempo oder die Ewigkeit von exitFarming (Erinnerungsspeicher IncentiveKey, uint256 tokenId, bool isLimit ) extern; /// @notice Coleta até um valor máximo de taxas devidas a uma posição specÃfica para o destinatário /// @dev "proxies" para NonfungiblePositionManager /// @param params tokenId O ID do NFT para o qual os tokens estão sendo coletados, /// destinatário A conta que deve receber os tokens, /// amount0Max A quantidade máxima de token0 a coletar, /// amount1Max A quantidade máxima de token1 a coletar /// @return amount0 A quantidade de taxas cobradas em token0 // / @return amount1 O wert der Steuern, die Token1 função collect(INonfungiblePositionManager.CollectParams calldata params) retornos externos (uint256 amount0, uint256 amount1); /// @notice Usado para coletar a recompensa da agricultura eterna. Então a recompensa pode ser reivindicada. /// @param key A chave do evento de incentivo /// @param tokenId O id da posição NFT /// @return reward A quantidade de recompensa coletada /// @return bonusReward A quantidade de bônus coletado função de recompensa collectRewards( IncentiveKey Memory Key , uint256 tokenId) Retornos externos (recompensa uint256, uint256 bonusReward); /// @notice Usado para reivindicar e enviar recompensas da(s) fazenda(s) /// @dev pode ser usado via chamada estática para obter recompensas atuais para o usuário /// @param rewardToken O token que é uma recompensa / // @param to O endereço a ser recompensado /// @param amountRequestedIncentive Valor a reivindicar na agricultura de incentivo (limite) /// @param amountRequestedEternal Valor a reivindicar na agricultura eterna /// @return reward O valor resumido da função de recompensa reivindicada ClaimReward( IERC20Minimal rewardToken , endereço para, uint256 amountRequestedIncentive, uint256 amountRequestedEternal ) retornos externos (uint256 recompensa); /// @notice Withdraw Algebra NFT-Positionstoken /// @dev pode ser usado via chamada estática para obter recompensas atuais para o usuário /// @param tokenId O id da posição NFT /// @param para o novo proprietário da NFT positionieren /// @param data Os dados adicionais para a função NonfungiblePositionManager yieldToken( uint256 tokenId, endereço para, bytes memory bytes ) external; /// @notice Emitido quando a proprietade de um deposito muda /// @param tokenId O ID do deposito (e token) que está sendo transferido /// @param oldOwner O proprietário antes da transferência do deposito /// @param newOwner Ein Eigentums- oder Hinterlegungsgrund für die Übertragung von evento DepositTransferred(uint256 indexado tokenId, endender indexierter oldOwner, enderer indexierter newOwner);}
File 3 of 50: IArmingCenterVault.sol
// SPDX license identifier: GPL-2.0-or-later pragma solidity 0.7.6;interface IArmingCenterVault { function ClaimTokens( address token, address to, uint256 tokenId, bytes32 incentiveId ) external; external function setFarmingCenter(farming address); function lockTokens(uint256 TokenId, Bytes32 IncentiveId, uint256 TokenAmount) external; Function balances(uint256 tokenId, bytes32 incentiveId) returns (uint256 balance); }
File 4 of 50: IAlgebraPool.sol
// SPDX License ID: GPL-2.0-or-later Pragma Strength >=0.5.0;Import './pool/IAlgebraPoolImmutables.sol';Import './pool/IAlgebraPoolState.sol';Import './pool/IAlgebraPoolDerivedState .sol';import './pool/IAlgebraPoolActions.sol';import './pool/IAlgebraPoolPermissionedActions.sol';import './pool/IAlgebraPoolEvents.sol';/** * @title The interface to a pool of algebra * @dev The pool interface is divided into several smaller parts. * Credit to Uniswap Labs under license GPL-2.0 or later: * https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces */interface IAlgebraPool is IAlgebraPoolImmutables, IAlgebraPoolState, IAlgebraPoolDerivedState, IAlgebraPoolActions, IAlgebraPoolPermissionedActions, IAlgebraPoolEvents{ // only used for matching interfaces}
File 5 of 50: IERC20Minimal.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.5.0; /// @title Minimal ERC20 Interface for Algebra /// @notice Contains a subset of the full ERC20 interface used in Algebra / // @dev Credit to Uniswap Labs under GPL 2.0 or later license /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfacesinterface IERC20Minimal { /// @notice Returns the balance of a token /// @param account The account for which the number of tokens should be queried, d. H. its balance /// @return The number of tokens held by balanceOf(address account) uint256); /// @notice Transfer the token amount from `msg.sender` to the recipient /// @param recipient The account that will receive the transferred amount /// @param amount The number of tokens sent from the sender to the are to be Recipient /// @return Returns true for a successful transfer, false for an unsuccessful transfer function transfer(recipient address, uint256 amount) external return (bool); /// @notice Returns the current permission granted to a donor by an owner /// @param owner The token owner's account /// @param donor The token donor's account /// @return The current Permission granted by role 'owner' Permission for 'donor' (address owner, address issuer) external view returns (uint256); /// @notice Set a donor's permission from `msg.sender` to the value `amount` /// @param spender The account that is allowed to spend a certain amount of own tokens /// @param amount The amount of tokens , which may be used by `spender` /// @return Returns true for successful approval, false for unsuccessful function apply (donor address, uint256 value) external return (bool); /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the limit given to `msg.sender` /// @param sender The account that initiates the transfer /// @param receiver The recipient of the transfer /// @param amount The amount of the transfer /// @return Returns true for a successful transfer, false for an unsuccessful transfer. function transferFrom(sender's address, recipient's address, uint256 value) external return (bool); /// @notice Event issued when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`. /// @param of The account from which the tokens were sent, ie. H. the balance has decreased /// @param for The account to which the tokens were sent, d transfer(indexed address from, indexed address to, uint256 value); /// @notice Event emitted when the approval value for a specific owner's token donor changes. /// @param owner The account that approved the issuance of its tokens /// @param donor The account for which the spending allowance was changed /// @param value The new owner allowance for the donor event Approval(address indexed owner , dispenser indexed by address, value uint256);}
File 6 of 50: INonfungiblePositionManager.sol
// SPDX License ID: GPL-2.0-or-laterPragma Solidity >=0.7.5;Pragma Abicoder v2;import '@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol';import '@openzeppelin/contracts/token /ERC721 /IERC721Enumerable.sol';Import './IPeripheryInitializer.sol';Import './IERC721Permit.sol';Import './IPeripheryPayments.sol';Import './IPeripheryImmutableState.sol';Import '../libraries /PoolAddress .sol';/// @title Non-fungible token for positions/// @notice Wrap algebra positions in a non-fungible token interface that allows them to be ported /// and authorized./// @dev Credit to Uniswap Labs under license GPL-2.0-or-later:/// https://github.com/Uniswap/v3-peripheryinterface INonfungiblePositionManager is IPoolInitializer, IPeripheryPayments, IPeripheryImmutableState, IERC721Metadata, IERC721Enumerable, IERC721Permit{ /// @notice Emitted when liquidity is increased for an NFT position /// @dev Also issued when a token is minted /// @param tokenId The ID of the token for which liquidity was increased s /// @param liquidity The amount by which the liquidity for the NFT position was increased /// @param actualLiquidity the actual liquidity added to a pool. May differ from /// _liquidity_ when using FeeOnTransfer tokens /// @param amount0 The amount paid by Token0 to increase liquidity /// @param amount1 The amount paid by Token1 to increase liquidity event GrowthLiquidity was paid (tokenId indexed uint256, liquidity uint128, real liquidity uint128, value uint256, value uint256, address pool); /// @notice Is issued when the liquidity for an NFT position has been decreased /// @param tokenId The ID of the token for which the liquidity has been decreased /// @param liquidity The amount by which the liquidity for the NFT position was decreased / // @param amount0 The amount of Token0 counted for decreasing liquidity /// @param amount1 The amount of Token1 counted for decreasing liquidity event DecreaseLiquidity(uint256 indexed TokenId, uint128 liquidity, uint256 amount0, uint256 amount1); /// @notice Issued when tokens are accumulated for an NFT position /// @dev Reported values ​​may not exactly match transmitted values ​​due to rounding behavior /// @param tokenId The ID of the token, for the underlying token were collected /// @param Recipient The address of the account that received the collected tokens /// @param Amount0 The value of Token0 based on the position that was collected /// @param Amount1 The value of Token1 based on the position of the collected event Collect(tokenId indexed uint256, recipient address, uint256 value0, uint256 value1); /// @notice Returns the positional information associated with a given token id. /// @dev Throws if the token id is invalid. /// @param tokenId The id of the token representing the position /// @return nonce The nonce for permissions /// @return operator The address allowed to be returned /// @return token0 The address of token0 for a pool specific /// @return token1 The address of token1 for a specific pool /// @return tickLower The lower bound of the tick range for the position /// @return tickUpper The upper bound of the tick range for the position / // @return liquidity position liquidity /// @return feeGrowthInside0LastX128 Token0 interest growth from the last stock in a single position /// @return feeGrowthInside1LastX128 Token1 interest growth from the last stock in a single position // / @return tokensOwed0 The amount of Token0 not withdrawn based on position from last calculation /// @return tokensOwed1 Uncollected amount of token1 based on position from last calculation function positions (uint256 tokenId) returns external view return ( uint9 6 nonce , address operator, address token0, address1 token, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); struct MintParams { address token0; address token1; int24 tickLower; int24 tickUpper; uint256 quantity0desired; uint256 Quantity1 Desired; uint256 Amount0Min; uint256 Amount1Min; recipient address; term uint256; } /// @notice Create a new pooled location in an NFT /// @dev Call this when the pool exists and is initialized. Note that if the pool is created but /// not initialized, no method exists, i.e. H. the pool is considered initialized. /// @param params The parameters needed to mint a position, encoded as `MintParams` in calldata /// @return tokenId The ID of the token representing the minted position /// @return liquidity The amount of liquidity for this position / // @returnamount0 The amount of Token0 /// @returnamount1 The amount of Token1 function mint(MintParams calldata params) external payable returns ( uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ); struct GrowthLiquidityParams { uint256 tokenId; uint256 quantity0desired; uint256 Quantity1 Desired; uint256 Amount0Min; uint256 Amount1Min; term uint256; } /// @notice Increases the liquidity of a position paying tokens from `msg.sender` /// @param params tokenId The ID of the token for which the liquidity will be increased /// amount0Desired The desired amount of Token0 to spend, /// amount1Desired The desired amount of Token1 to spend, /// amount0Min The minimum amount of Token0 to spend, serving as a slippage check, /// amount1Min The minimum amount of Token1 to spend, serving B. as a slippage check, /// Deadline The time in which the transaction must be included to effect the change /// @return liquidity The new liquidity amount as a result of the increase /// @return amount0 The amount returned by Token0 to get the resulting liquidity /// @ReturnAmount1 The amount of Token1 to get the resulting liquidity. struct DecreaseLiquidityParams { uint256 tokenId; Liquidity uint128; uint256 Amount0Min; uint256 Amount1Min; term uint256; } /// @notice Decreases liquidity on a position, taking into account the position /// @param params tokenId The ID of the token for which the liquidity will be decreased /// amount The amount by which the liquidity will be decreased , / // amount0Min The minimum amount of Token0 that should be counted for burned liquidity /// amount1Min The minimum amount of Token1 that should be counted for burned liquidity /// Deadline The time when the transaction should take effect the change / // @return amount0 The amount of Token0 responsible for the position's tokens due /// @return amount1 The amount of Token1 responsible for the position's tokens due uint256 amount1); struct CollectParams { uint256 tokenId; recipient address; uint128 Quantity0Max; uint128 Quantity1Max; } /// @notice Fees up to a maximum amount of fees due to the recipient for a given position /// @param params tokenId The NFT ID for which tokens will be collected /// recipient The account that to receive the token , /// amount0Max The maximum Token0 amount to collect, /// amount1Max The maximum Token1 amount to collect /// @return amount0 The fee amount collected on Token0 /// @return amount1 The fee amount collected in function token1 collect(CollectParams calldata params) external payable returns(uint256-amount0, uint256-amount1); /// @notice Writes a token ID that excludes it from the NFT contract. The token must have 0 liquidity and all /// tokens must be collected first. /// @param tokenId The ID of the token being burned function burn(uint256 tokenId) payable externally;}
File 7 of 50: Multicall.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;pragma abicoder v2;import '../interfaces/IMulticall.sol'; /// @title Multicall /// @notice calls enable multiple methods in a single call to the contract abstract Multicall is IMulticall { /// @inheritdoc IMulticall function multicall(bytes[] calldata data) externally payable replacement returns (bytes[] memory results) { results = new bytes[ ](date. length ); for (uint256 i = 0; i <data.length; i++) {(bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { // Next 5 lines from https://ethereum.stackexchange.com/a/83577 if (result.length < 68) revert(); Assembly { result := add (result, 0x04) } revert (abi.decode (result, (string))); } results[i] = result; } }}
File 8 of 50: ERC721Permit.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;import '@openzeppelin/contracts/token/ERC721/ERC721.sol';import '@openzeppelin/contracts/utils/Address.sol' ;import '../libraries/ChainId.sol';import '../interfaces/external/IERC1271.sol';import '../interfaces/IERC721Permit.sol';import './BlockTimestamp.sol';// / @title ERC721 with Permit /// @notice Non-fungible tokens that support signature approval, ie. H. Permitabstract Contract ERC721Permit is BlockTimestamp, ERC721, IERC721Permit { /// @dev Gets the current nonce for a tokenid and then the increments, returning the original value Function _getAndIncrementNonce(uint256 tokenId) returns internal virtual(uint256); /// @dev The hash of the name used in credential signature verification bytes32 private immutable nameHash; /// @dev The hash of the version string used in the credential signature check bytes32 private immutable versionHash; /// @notice Computes constructor nameHash and versionHash( string memory name_, string memory symbol_, string memory version_ ) ERC721(name_, symbol_) { nameHash = keccak256(bytes(name_)); versionHash = keccak256 (bytes (version_)); } /// @inheritdoc IERC721Permit function DOMAIN_SEPARATOR() public view override returns (bytes32) { return keccak256( abi.encode( // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, nameHash , versionHash, ChainId.get(), address(this) ) ); } /// @inheritdoc IERC721Permit /// @dev value is equal to keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 term)"); Bytes32 public constant replacement PERMIT_TYPEHASH = 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad; /// @inheritdoc IERC721Permit function permission( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable override { require(_blockTimestamp() <= deadline, 'permit expired'); Bytes32 Digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR(), keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, _getAndIncrementNonce(tokenId), Frist)) ) ); address owner = ownerOf(tokenId); require(spender != owner, 'ERC721Permit: permission for current owner'); if (Address.isContract(owner)) {require(IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e, 'Unauthorized'); } else { address fetchedaddress = ecrecover(summary, v, r, s); require(recoveredAddress != address(0), 'Invalid Signature'); require(recoveredAddress == owner, 'Unauthorized'); } _approve(Donor, TokenId); }}
Arquivo 9 de 50: PeripheryPayments.sol
// SPDX license identifier: GPL-2.0-or-laterPragma Solidity >=0.7.5;import '@openzeppelin/contracts/token/ERC20/IERC20.sol';import 'algebra-periphery/contracts/interfaces/IPeripheryPayments. sol';Import 'Algebra Periphery/Contracts/Interfaces/external/IWNativeToken.sol';Import 'Algebra Periphery/Contracts/Libraries/TransferHelper.sol';contrato abstrato PeripheryPayments is IPeripheryPayments { address public immutable WNativeToken; constructor(endereço _WNativeToken) { WNativeToken = _WNativeToken; } Receive() external page { require(msg.sender == WNativeToken, 'Not WNativeToken'); } /// @inheritdoc function IPeripheryPayments unwrapWNativeToken(uint256 amountMinimum, end of destination) external page replacement { uint256 balanceWNativeToken = IWNativeToken(WNativeToken).balanceOf(address(this)); require(balanceWNativeToken >= amountMinimum, 'Insufficient WNativeToken'); if (balanceWNativeToken > 0) {IWNativeToken(WNativeToken).withdraw(balanceWNativeToken); TransferHelper.safeTransferNative(destination, balanceWNativeToken); } } /// @inheritdoc IPeripheryPayments function SweepToken(endtoken, uint256-amountMinimum, destination-address) Substituted external side { uint256 balanceToken = IERC20(token).balanceOf(address(this)); require(balanceToken >=mountMinimum, 'Token insufficient'); if (balanceToken > 0) {TransferHelper.safeTransfer(token, destination, balanceToken); } } /// @inheritdoc função IPeripheryPayments refundNativeToken() Substituição de pagamento externo { if (address(this).balance > 0) TransferHelper.safeTransferNative(msg.sender, address(this).balance); }}
File 10 of 50: IncentiveId.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;pragma abicoder v2;import '../interfaces/IIncentiveKey.sol';library IncentiveId { /// @notice Calculate the key for a Bet Incentive /// @param key The components used to calculate the incentive identifier /// @return IncentiveId The identifier for the incentive function compute(IIncentiveKey.IncentiveKey Memory Key) internal pure returns (Bytes32 IncentiveId) { return keccak256(abi .encode(key)); }}
File 11 of 50: IAlgebraVirtualPool.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;interface IAlgebraVirtualPool { enum Status { NOT_EXIST, ACTIVE, NOT_STARTED } /** * @dev This function is called from the main pool when a tick booted is ticked there. * If the tick is also initialized in a virtual pool, it must also be crossed * @param nextTick The crossed tick * @param zeroToOne The direction */ function cross(int24 nextTick, bool zeroToOne) external; /** * @dev This function is called before each exchange from the main pool. To increase seconds per liquidity * cumulative considering previous timestamp and liquidity. Liquidity is stored in a virtual pool * @param currentTimestamp The timestamp of the current swap * @return Status The status of the virtual pool */ function growthCumulative(uint32 currentTimestamp) returns external(Status);}
File 12 of 50: IMulticall.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.7.5;pragma abicoder v2; /// @title Multicall interface /// @notice Enables calling multiple methods in a single call to contractinterface IMulticall { /// @notice Calls multiple functions in the current contract and returns the data for all if they all succeed /// @dev `msg.value` should not be trusted for methods that can be called multicall. /// @param data The encoded function data for each call to make to this contract. /// @return results The results of each call passed through the data function multicall(bytes[] calldata data) externally payable returns ( bytes[] results from memory); }
File 13 of 50: IPeripheryPayments.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.7.5 /// @title Periphery Payments /// @notice Functions to facilitate NativeToken deposits and withdrawals /// @dev Credit to Uniswap Labs licensed under GPL-2.0-or-later:/// https://github.com/Uniswap/v3-peripheryinterface IPeripheryPayments { /// @notice Unwraps the WNativeToken balance from the contract and sends it to as NativeToken the recipient. /// @dev The amountMinimum parameter prevents malicious contracts from stealing users' WNativeToken. /// @param amountMinimum The minimum amount of WNativeToken to unwrap /// @param Recipient The address that the NativeToken function will receive unwrapWNativeToken(uint256 amountMinimum, recipient address) payable externally; /// @notice Returns any NativeToken balance held by this contract to `msg.sender` /// @dev Useful for pooling with Mint or increasing liquidity using Ether or exact exit Swaps /// take ether as input value refundNativeToken() function to pay externally; /// @notice Transfers the full value of a token held by this contract to the recipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users /// @param token The contract address of the token , which will be sent to `recipient` /// @param amountMinimum The minimum amount of tokens required for a transfer /// @param receiver The destination address of the token function sweepToken( address token, uint256 amountMinimum, address receiver ) payable externally ;}
File 14 of 50: IERC721Receiver.sol
// SPDX License Identifier: MITpragma solidity ^0.7.0;/** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * of ERC721 asset contracts. */interface IERC721Receiver { /** * @dev Whenever a {IERC721} `tokenId` token is transferred from `from` to this contract via {IERC721-safeTransferFrom} * per `operator`, this function is called. **You must return your solidity selector to confirm the token transfer. * If a different value is returned or the interface is not implemented by the recipient, the transfer is rolled back. ** The selector can be obtained from Solidity using `IERC721.onERC721Received.selector`. */ function onERC721Received(operator address, address from, uint256 tokenId, bytes calldata data) returns external (bytes4);}
File 15 of 50: IAlgebraLimitFarming.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;pragma abicoder v2;import '../../../interfaces/IAlgebraFarming.sol';/// @title Algebra Farming Interface/// @notice Allows farming of non-fungible liquidity tokens in exchange for reward tokensinterface IAlgebraLimitFarming is IAlgebraFarming { struct IncentiveParams { uint256 reward; // The amount of reward tokens to distribute uint256 bonusReward; // The amount of Bonus Reward Tokens to distribute uint24 minimalPositionWidth; // The minimum allowed position width (tickUpper - tickLower) address multiplierToken; // The address of the token that can be blocked to get the liquidity multiplier uint32 enterStartTime; // The time when input should be possible } /// @notice The maximum duration of an incentive in seconds function maxIncentiveDuration() returns the external display (uint256); /// @notice The maximum number of seconds into the future that the startTime incentive can be set. function maxIncentiveStartLeadTime() returns an external indicator (uint256); /// @notice Returns information about a farm liquidity NFT /// @param tokenId The ID of the farm token /// @param IncentiveId The ID of the incentive the token is being farmed for /// @return liquidity A lot of liquidity in the NFT since the last calculation of rewards /// tickLower The lower limit of the tick range for the position /// tickUpper The upper limit of the tick range for the position Yields ( uint128 liquidity, int24 tickLower, int24 tickUpper ); function createLimitFarming (storage key IncentiveKey, tiers calldata Tiers, storage parameter IncentiveParams) external returns (virtualPool address); function addRewards (storage key IncentiveKey, reward uint256, bonus reward uint256) external; function LowerRewardsAmount(storage key IncentiveKey, uint256 rewardAmount, uint256 bonusRewardAmount ) external; /// @notice Event issued when a liquidity mining reward is created /// @param rewardToken The token that will be distributed as a reward /// @param bonusRewardToken The token that will be distributed as a bonus reward // / @param pool The Algebra pool /// @param startTime The time the incentive program starts /// @param endTime The time the rewards end /// @param reward The amount of reward tokens to be distributed / // @param bonusReward The amount of bonus reward tokens to distribute /// @param tiers The amount of tokens that will be blocked for liquidity multipliers /// @param multiplierToken The address of the tokens that can be blocked for receiving liquidity multipliers // / @param minimalAllowedPositionWidth The minimum allowed position width (tickUpper - tickLower) /// @param enterStartTime The time when entry will be allowed event LimitFarmingCreated( IERC20Minimum Indexed RewardToken, IERC20 Minimal i ndexed bonusRewardToken, IAlgebraPool Indexed Pool, uint256 startTime, uint256 endTime, ui nt256 Reward, uint256 bonusReward, Tiers Tiers, Address MultiplierToken, uint24 minimalAllowedPositionWidth, uint32 enterStartTime ); Event RewardAmountsDecreased(uint256 Reward, uint256 BonusReward, Bytes32 IncentiveId);}
File 16 of 50: IAlgebraEternalFarming.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;pragma abicoder v2;import '../../../interfaces/IAlgebraFarming.sol';/// @title Algebra Eternal Farming Interface /// @notice Allows farming of non-fungible liquidity tokens in exchange for reward tokens without blocking NFT for Incentive Time Interface IAlgebraEternalFarming is IAlgebraFarming { struct IncentiveParams { uint256 reward; // The amount of reward tokens to distribute uint256 bonusReward; // The amount of bonus reward tokens to give away uint128 rewardRate; // The reward distribution rate per second uint128 bonusRewardRate; // The bonus reward distribution rate per second uint24 minimalPositionWidth; // The minimum allowed position width (tickUpper - tickLower) address multiplierToken; // The address of the token that can be blocked to get the liquidity multiplier } /// @notice Event that is issued when the reward rates have changed /// @param rewardRate The token's new main distribution rate per second // / @param bonusRewardRate The new bonus token payout rate per second /// @param IncentiveId The incentive ID for which rates were changed. /// @notice Event issued when bonuses are added /// @param tokenId The ID of the token for which bonuses were collected /// @param IncentiveId The ID of the incentive for which bonuses were collected /// @ param rewardAmount Collected reward amount /// @param bonusRewardAmount Bonus reward event collected amount RewardsCollected(uint256 tokenId, bytes32 IncentiveId, uint256 rewardAmount, uint256 bonusRewardAmount); /// @notice Returns information about a farm liquidity NFT /// @param tokenId The ID of the farm token /// @param IncentiveId The ID of the incentive the token is being farmed for /// @return liquidity Amount of liquidity in the NFT since the last rewards calculation, /// tickLower The lower tick of the position, /// tickUpper The upper tick of the position, /// innerRewardGrowth0 The last reward0 growth stored in the position, / / / innerRewardGrowth1 The last reward1 growth stored inside the position function farms(uint256 tokenId, bytes32 incentiveId) outdoor indicator returns ( uint128 liquidity, int24 tickLower, int24 tickUpper, uint256 innerRewardGrowth0, uint256 innerRewardGrowth1 ); /// @notice Create a new liquidity mining incentive program /// @param Keys Details of the incentive to create /// @param params Incentive parameters /// @param Tiers The token amounts used for multipliers -Liquidity are locked /// @ return virtualPool The virtual pool function createEternalFarming (storage key IncentiveKey, storage parameter IncentiveParams, tiers calldata Tiers) returns extern (virtualPool address); function addRewards(storage key IncentiveKey, uint256 rewardAmount, uint256 bonusRewardAmount ) external; function setRates (storage key IncentiveKey, uint128 rewardRate, uint128 bonusRewardRate ) external; function collectRewards(storage key IncentiveKey, uint256 tokenId, address _owner ) external returns(uint256 Reward, uint256 BonusReward); /// @notice Event issued when a liquidity mining reward is created /// @param rewardToken The token that will be distributed as a reward /// @param bonusRewardToken The token that will be distributed as a bonus reward // / @param pool The Algebra pool /// @param virtualPool The address of the virtual pool /// @param startTime The time when the incentive program starts /// @param endTime The time when bonuses stop accumulating /// @param reward The number of bonus tokens to expect to be distributed /// @param bonusReward The amount of bonus reward tokens to be distributed /// @param tiers The locked token amounts for liquidity multipliers /// @param multiplierToken The address of the token which can be locked to get liquidity multipliers /// / @param minimalAllowedPositionWidth The minimal allowed position width (tickUpper - tickLower) event EternalFarmingCreated( IERC20Minimal Indexed RewardToken, IERC20Minimal i indexed bonusR }
File 17 of 50: IIncentiveKey.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;import 'algebra/contracts/interfaces/IERC20Minimal.sol';import 'algebra/contracts/interfaces/IAlgebraPool.sol';interface IIncentiveKey { /// @param rewardToken The token that will be distributed as a reward /// @param bonusRewardToken The bonus token that will be distributed as a reward /// @param pool The algebra pool /// @param startTime The time the program started /// @param endTime The time when rewards stop accumulating. struct IncentiveKey { IERC20Minimal rewardToken; IERC20Minimum BonusRewardToken; pool IAlgebraPool; uint256 start time; uint256 end time; }}
File 18 of 50: IAlgebraPoolImmutables.sol
// SPDX LicenseID: GPL-2.0-or-laterPragma-proof >=0.5.0; import '../IDataStorageOperator.sol'; /// @title pool status that never changes /// @dev credit to Uniswap Labs licensed under GPL-2.0-or-later:/// https://github.com/Uniswap/v3-core/tree /main/contracts/interfacesinterface IAlgebraPoolImmutables { /** * @notice The contract that stores points all times and can perform actions on them * @return The address of the operator */ function dataStorageOperator() the external view returns (address); /** * @notice The contract that provided the pool, which must conform to the IAlgebraFactory interface * @return The address of the contract */ function factory() external view return (address); /** * @notice The first of the two tokens in the pool, sorted by address * @return The contract address of the token */ function token0() the external indicator returns (address); /** * @notice The second of the two tokens in the pool, sorted by address * @return The contract address of the token */ function token1() the external indicator returns (address); /** * @notice The tick spacing of the pool * @dev Ticks can only be used in multiples of this value * e.g. B.: a TickSpacing of 60 means that ticks can be initialized every 60 ticks, i. 0, 60, 120, ... * This value is an int24 to avoid conversion, although it is always positive. * @return The tick spacing */ function tickSpacing() returns the external view (int24); /** * @notice The maximum amount of position liquidity that can use each tick in the range * @dev This parameter is applied per tick to prevent liquidity from exceeding a uint128 at any time and * also prevents Liquidity out of range is used Prevent adding in-range liquidity to a pool * @return The maximum amount of liquidity per tick */ function maxLiquidityPerTick() external view return(uint128);}
File 19 of 50: IAlgebraPoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/// @title Pool state that can change /// @dev Credit to Uniswap Labs under GPL-2.0-or-late- License :/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfacesinterface IAlgebraPoolState { /** * @notice The globalState structure in the pool stores many values, but only needs one slot * and is disclosed as the only gas saving method when accessed externally. * @return price The current pool price as a value sqrt(token1/token0) Q64.96; * Returns tick The current tick of the pool, ie according to the last executed tick transition; * Returns This value need not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) when price is on a ticking * boundary; * Return Rate The last pool rate value in hundredths of a beep, ie 1e-6; * Returns timepointIndex The index of the last time written; * Returns communityFeeToken0 The community fee percentage of the exchange rate in Mils (1e-3) for Token0; * Returns communityFeeToken1 The community fee as a percentage of the exchange rate in Mils (1e-3) for Token1; * Returns unlocked if the pool is currently locked for re-entry; */ function globalState() returns the external display ( price uint160, tick int24, rate uint16, uint16 timepointIndex, uint8 communityFeeToken0, uint8 communityFeeToken1, bool unlocked ); /** * @notice The rate growth as Q128,128 Token0 fees accumulated per liquidity unit over the lifetime of the pool * @dev This value may overflow uint256 */ function totalFeeGrowth0Token() returns external display (uint256) ; /** * @notice The fee growth as Q128,128 Token1 fees accumulated per liquidity unit over the lifetime of the pool * @dev This value may overflow uint256 */ function totalFeeGrowth1Token() returns an external indicator (uint256 ); /** * @notice The liquidity currently available to the pool * @dev This value bears no relation to the total liquidity of all ticks. * The return value must not exceed type(uint128).max */ function liquidity() external view returns (uint128); /** * @notice Searches the pool for information about a specific tick * @dev This is a public framework, so the `return` natspec tags are omitted. * @param tick The tick to look for * @return liquidityTotal the total liquidity of the position using the pool as lower tick or * higher tick; * Returns the liquidity delta, by how much the liquidity changes when the pool price crosses the tick; * Returns outerFeeGrowth0Token the growth rate on the other tick side of the current tick on Token0; * Returns outerFeeGrowth1Token the growth rate on the other tick side of the current tick on Token1; * Returns outerTickCumulative the cumulative tick value on the other tick side of the current tick; * returns outerSecondsPerLiquidity the seconds that liquidity spent on the other tick side of the current tick; * returns outerSecondsSpent the seconds elapsed on the other tick side of the current tick; * Returns initialized. Set to true if the tick is initialized, ie LiquidityTotal is greater than 0 * otherwise equal to false. External values ​​can only be used if the tick is initialized. * Also, these values ​​are relative only and should only be used against previous * snapshots for a given position. ); /** @notice Returns 256 initialized boolean values ​​from the packed tag. For more information, see TickTable */ function tickTable(int16 wordPosition) External View Returns (uint256); /** * @notice Returns information about a position by position key * @dev This is a public framework mapping, so the `return` natspec tags are omitted. * @param key The position key is a hash of a pre-image composed of the owner, bottomTick and topTick. * @return LiquidityAmount The amount of liquidity in the position; * Returns lastLiquidityAddTimestamp Timestamp of the last liquidity addition; * Returns innerFeeGrowth0Token growth rate of token0 within tick range from last mint/burn/sting; * Returns innerFeeGrowth1Token Growth rate of Token1 within tick range since last mint/burn/prick; * Return Fees0 The amount of tokens0 calculated based on position to the last mint/burn/sting; * Returns Fees1 The calculated amount of Token1 based on the position to the last Mint/Burn/Sting */ Function positions (Keybytes32) External display returns ( uint128 liquidAmount, uint32 lastLiquidityAddTimestamp, uint256 innerFeeGrowth0Token, uint256 innerFeeGrowth1Token, uint1280, uint128 Fees1 ); /** * @notice Returns data about a specific point in time index * @param index The element of the timepoint array to get * @dev You probably want to use #getTimepoints() instead of this method to get a specific point in time value * ago, rather than at a specific index in the array. * This is a public framework mapping, so the "return" natspec tags are omitted. * @return initialized when the point in time has been initialized and the values ​​are safe to use; * Returns blockTimestamp The timestamp of the point in time; * Returns tickCumulative, the tick multiplied by the seconds elapsed through the lifetime of the pool since the point in time timestamp; * Returns secondPerLiquidityCumulative the seconds per liquidity interval for the lifetime of the pool from the point in time timestamp; * Returns volatilityCumulative Cumulative standard deviation for the lifetime of the pool from the point in time timestamp; * Returns averageTick Time-weighted average tick; * Returns volumePerLiquidityCumulative Cumulative swap volume per liquidity over the lifetime of the pool from the point in time timestamp; ); /** * @notice Returns information about active stimuli * @dev if no stimulus is currently active, virtualPool,endTimestamp,startTimestamp would be 0 * @return virtualPool The address of a virtual pool associated with the current active stimulus */ function activeIncentive() external view returns (virtualPool address); /** * @notice Returns the block time for added liquidity */ the liquidityCooldown() function, which returns the external view (uint32 cooldownInSeconds);}
File 20 of 50: IAlgebraPoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/** * @title Status of the pool not saved * @notice Contains view functions to provide information about the pool calculated as stored on the *blockchain. Functions here may have variable gas costs. * @dev credit to Uniswap Labs under GPL-2.0-or-later license: * https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces */interface IAlgebraPoolDerivedState { /** * @ notice Returns the cumulative tick and liquidity of each `secondsAgo` timestamp of the current block timestamp * @dev To get a time-weighted average tick or liquidity in the range, you need to call this with two values, one of which is the beginning * of the period represents range and the other represents the end of the period. For example, to get the time-weighted average tick for the last hour, * you would call it with secondAgos = [3600, 0]. * @dev's time-weighted average tick represents the pool's geometric time-weighted average price, in * log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a scaled value to a ratio. * @param secondAgos How long each cumulative tick and liquidity value to return * @return tickCumulatives Cumulative tick values ​​from each `secondsAgos` of the current block's timestamp * @return secondPerLiquidityCumulatives Cumulative seconds per liquidity value in the range starting every `secondsAgos ` * of the current block's timestamp Blocks * @return volatilityCumulatives Cumulative standard deviation starting every `secondsAgos` * @return volumePerAvgLiquiditys Swap volume accumulated by liquidity from every `secondsAgos ` */ function getTimepoints(uint32[] calldata secondAgos) external view returns ( int56[ ] Memory TickCumulatives , uint160[] Memory SecondsPerLiquidityCumulatives, uint112[] Memory VolatilityCumulatives, uint256[] Memory volumePerAvgLiquiditys ); /** * @notice Returns a cumulative tick snapshot, seconds after liquidity and seconds within a tick range * @dev snapshots are only compared to other snapshots taken during a period in which a position existed. * That is, snapshots cannot be compared if a position is not held for the entire period between the * first snapshot and the second snapshot. * @param bottomTick The bottom tick of the range * @param topTick The top tick of the range * @return innerTickCumulative The tick accumulator snapshot of the range * @return innerSecondsSpentPerLiquidity The seconds-per-liquidity snapshot for the range * @return innerSecondsSpent The Snapshot of the number of seconds the price has been in this range */ function getInnerCumulatives(int24 bottomTick, int24 topTick) return external view ( int56 innerTickCumulative, uint160 innerSecondsSpentPerLiquidity, uint32 innerSecondsSpent );}
File 21 of 50: IAlgebraPoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/// @title Permissionless pool actions/// @dev Credit to Uniswap Labs under GPL-2.0-or-later-license: / // https://github.com/Uniswap/v3-core/tree/main/contracts/interfacesinterface IAlgebraPoolActions { /** * @notice Sets the starting price for the pool * @dev The price is represented as sqrt( amountToken1 / amountToken0) Q64.96 value * @param price the pool's initial sqrt price as Q64.96 */ function initialize(uint160 price) external; /** * @notice Adds liquidity to the provided Receiver/BottomTick/TopTick position * @dev The caller of this method receives a callback in the form of IAlgebraMintCallback# AlgebraMintCallback * in which it must pay any liquidity Token0 or Token1 due . The amount of Token0/Token1 owed depends * on BottomTick, TopTick, liquidity amount and current price. * @param sender The address that will receive potentially overpaid tokens * @param receiver The address to which liquidity will be created * @param bottomTick The bottom tick of the position to add liquidity to * @param topTick The top tick of the position which Liquidity to add * @param amount The desired amount of liquidity to mint * @param data Any data to pass to the callback * @return amount0 The amount of Token0 paid by the given amount of shape liquidity. Matches the value in the callback * @ReturnAmount1 The amount paid by Token1 to mint the specified amount of liquidity. Corresponds to the value in the callback * @return ActualLiquidity The actual amount of liquidity */ function mint(sender address, receiver address, int24 bottomTick, int24 topTick, uint128 value, bytes calldata data ) outer returns ( uint256 value0, uint256 value1, uint128 RealLiquid ); /** * @notice Collects tokens owed to a position * @dev Does not recalculate earned fees, which must be done by minting or burning liquidity. * Pickup must be called by the position owner. To withdraw only Token0 or only Token1, Amount0Requested or *amount1Requested can be set to zero. To withdraw all tokens owed, the caller can pass any value greater than * the actual tokens owed, e.g. e.g. type(uint128).max. Owed tokens can come from accrued swap fees or burned liquidity. * @param receiver The address to charge for * @param bottomTick The bottom tick of the position to charge for * @param topTick The top tick of the position to charge for * @param amount0Requested How much to withdraw token0 fees owed * @param amount1Requested how much to deduct from token1 of fees owed * @return amount0 the amount of fees collected on token0 * @return amount1 the amount of fees collected on token1 */ function collect( recipient address, int24 bottomTick, int24 topTick , uint128 amount0requested, uint128 amount1requested ) external returns(uint128 amount0, uint128 amount1); /** * @notice Burn sender liquidity and account tokens owed for the position * @dev Can be used to trigger a recalculation of fees for a calling position with a value of 0 * @dev fees must be collected separately via a call to # collect * @param bottomTick The bottom tick of the position to burn liquidity for * @param topTick The top tick of the position to burn liquidity for * @param amount How much liquidity to burn * @return amount0 The amount of Token0 sent to receiver * @return amount1 The amount of token1 sent to receiver */ function burn( int24 bottomTick, int24 topTick, uint128 amount ) returns outer(uint256 amount0, uint256 amount1); /** * @notice Swaps token0 for token1 or token1 for token0 * @dev The caller of this method receives a callback in the form of IAlgebraSwapCallback# AlgebraSwapCallback * @param receiver The address to send the output of the swap to * @param zeroToOne The direction of the swap, true for Token0 to Token1, false for Token1 to Token0 * @param amountSpecified The amount of swap that implicitly sets the swap to be exactly on (positive) or exactly off (negative) * @param limitSqrtPrice The Q64.96 Exchange limit square price. If zero times one, the price cannot be lower than this * value after the change. If one through zero, the price after the toggle cannot be greater than this value * @param data Any data to be passed to the callback. If using a router, it should contain * SwapRouter#SwapCallbackData * @return amount0 The balance delta of pool token0, exact if negative, minimum if positive * @return amount1 The delta balance of pool token1, exact if negative, minimum if positive */ function swap (recipient address, bool zeroToOne, int256 amountspecified, uint160 limitSqrtPrice, byte data of the call data) external returns (int256 amount0, int256 amount1); /** * @notice Swaps token0 for token1 or token1 for token0 (transfer fee tokens) * @dev The caller of this method receives a callback in the form of I AlgebraSwapCallback# AlgebraSwapCallback * @param sender The called address function (comes from the router) * @param Recipient The address to receive the output of the swap * @param zeroToOne The direction of the swap, true for Token0 to Token1, false for Token1 to Token0 * @param amountSpecified The swap amount you implicitly set the trade as exact input ( positive) or exact outcome (negative) * @param limitSqrtPrice The price limit Q64.96 sqrt. If zero times one, the price cannot be lower than this * value after the change. If one through zero, the price after the toggle cannot be greater than this value * @param data Any data to be passed to the callback. If using a router, it should contain * SwapRouter#SwapCallbackData * @return amount0 The balance delta of pool token0, exact if negative, minimum if positive * @return-amount1 The delta balance of pool token1, exact if negative, minimum if positive */ function swapSupportingFeeOnInputTokens(from address, to address, bool zeroToOne, int256 specified value, uint160 limitSqrtPrice, bytes calldata data) external returns(int256 value0, int256 value1); /** * @notice Receives Token0 and/or Token1 and pays back in callback plus fee * @dev The caller of this method gets a callback in the form of IAlgebraFlashCallback# AlgebraFlashCallback * @dev Any excess tokens paid on callbacks are added as additional Fee distributed to liquidity providers. Therefore, this method can be used to * donate underlying tokens to liquidity providers that are currently in range by calling with a value of 0 {0,1} and * sending the callback donation value(s). * @param recipient The address that will receive the values ​​of token0 and token1 * @param amount0 The amount of token0 to send * @param amount1 The amount of token1 to send * @param data Any data to pass to the callback * / function flash( recipient address, uint256 value0, uint256 value1 , bytes call data data ) extern;}
File 22 of 50: IAlgebraPoolPermissionedActions.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/** * @title Permission Pool Actions * @notice Contains pool methods that can only be called by Factory Owner or Tokennomics * @ dev credit to Uniswap Labs under GPL 2.0 or later license: * https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces */interface IAlgebraPoolPermissionedActions { /** * @notice Set community participation in fees. Cannot exceed 25% (250) * @param communityFee0 new community fee percentage for pool token0 in mils (1e-3) * @param communityFee1 new community fee percentage for pool token1 in mils (1e-3) */ function setCommunityFee (uint8 communityFee0 , uint8 communityFee1) external; /** * @notice Sets an active incentive * @param virtualPoolAddress The address of a virtual pool associated with the incentive */ function setIncentive(address virtualPoolAddress) external; /** * @notice Sets the new lock time for additional liquidity * @param newLiquidityCooldown The time in seconds */ function setLiquidityCooldown(uint32 newLiquidityCooldown) external;}
File 23 of 50: IAlgebraPoolEvents.sol
// SPDX LicenseID: GPL-2.0-or-laterPragma-proof >=0.5.0; /// @title Events emitted by a pool /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license :/// https://github.com/Uniswap/v3-core/tree /main/contracts/interfacesinterface IAlgebraPoolEvents { /** * @notice Is issued exactly once by a pool the first time #initialize is called on the pool * @dev Mint/Burn/Swap cannot be issued by the pool before initialization * @param price The pool's initial sqrt price as Q64.96 * @param tick The pool's initial tick, d price */ event Initialize(uint160 price, int24 tick); /** * @notice Issued when liquidity is minted for a specific position * @param sender The address that minted the liquidity * @param owner The position owner and recipient of any liquidity minted * @param bottomTick The bottom tick of the position * @param topTick The top tick of the position * @param liquidityAmount The amount of minted liquidity for the position range * @param amount0 How much Token0 was needed for minted liquidity * @param amount1 How much Token1 was needed for minted liquidity */ event Mint ( Address Sender, Address Indexed Owner, int24 Indexed BottomTick, int24 Indexed TopTick, uint128 Liquidity Amount, uint256 Amount0, uint256 Amount1 ); /** * @notice Emitted when the owner of a position is charging * @dev Collect events can be emitted with a value of null0 and a value of 1 if the caller chooses not to charge * @param owner The owner of the position for which the fees are charged * @param recipient The address that received the fees * @param bottomTick The bottom tick of the position * @param topTick The top tick of the position * @param amount0 The amount of Token0 fees charged * @param amount1 The amount of Token1 fees collected */ Collect event(indexed address owner, address receiver, indexed bottomTick int24, indexed topTick int24, uint128 value0, uint128 value1); /** * @notice Issued when liquidity is removed from a position * @dev Does not deduct fees received for the liquidity position that need to be deducted via #collect * @param owner The owner of the position for which liquidity is being removed * @ param bottomTick The bottom tick of the position * @param topTick The top tick of the position * @param LiquidityAmount The amount of liquidity to remove * @param amount0 The amount of Token0 withdrawn * @param amount1 The amount of Token1 withdrawn */ event Burn (indexed address owner, int24 indexed bottom tick, int24 indexed top tick, uint128 liquidity amount, uint256 amount0, uint256 amount1); /** * @notice Issued by the pool for all exchanges between Token0 and Token1 * @param sender The address that initiated the exchange call and received the callback * @param receiver The address that received the output of the exchange * @param amount0 The pool token0 balance delta * @param amount1 The pool token1 balance delta * @param price The pool square (price) after the swap, like Q64.96 * @param liquidity The pool Liquidity after swap * @param-tick Logarithmic base 1.0001 of pool price after swap */ event Swap(send indexed address, receiver indexed address, int256 value0, int256 value1, uint160 price, uint128 liquidity, int24 tick) ; /** * @notice Issued by the pool to any Token0/Token1 flash * @param sender The address that initiated the exchange call and received the callback * @param receiver The address that received the tokens from the flash * @param amount0 The amount of Token0 that was displayed * @param amount1 The amount of Token1 that was displayed * @parampaid0 The amount of Token0 that was paid via flash, which can exceed Amount0 plus fee * @parampaid1 The amount of Token1 paid by flash flash that can exceed value1 plus rate */ event Flash(indexed sender address, indexed recipient address, uint256 value0, uint256 value1, uint256paid0, uint256paid1); /** * @notice Is issued when the community fee is changed by the pool * @param communityFee0New The updated community fee percentage token0 * @param communityFee1New The updated community fee percentage token1 */ event CommunityFee(uint8 communityFee0New, uint8 communityFee1New); /** * @notice Issued when a new activeIncentive is defined * @param virtualPoolAddress The address of a virtual pool associated with the current active incentive */ event Incentive(address indexed virtualPoolAddress); /** * @notice Printed when the fee changes * @param fee The fee value of the token */ event Fee(uint16 fee); /** * @notice Issued when LiquidityCooldown changes * @param LiquidityCooldown The hold time value for added liquidity */ event LiquidityCooldown(uint32 LiquidityCooldown);}
File 24 of 50: IDataStorageOperator.sol
// SPDX license identifier: GPL-2.0-or-laterPragma Solidity >=0.5.0;Pragma Abicoder v2;import '../libraries/AdaptiveFee.sol';interface IDataStorageOperator { event FeeConfiguration(AdaptiveFee.Configuration feeConfig); /** * @notice Returns data at a specific point in time * @param index The index of the point in time in the array * @dev There is a more convenient function to get a point in time: Observe(). Which does not require an index, but initializes seconds * @return If the point in time has been initialized and the values ​​are safe to use, * blockTimestamp The timestamp of the observation, * tickCumulative The tick multiplied by the elapsed seconds for the lifetime of the pool from the timestamp point in time, *secondsPerLiquidityCumulative The seconds per liquidity interval for the pool lifetime from the point in time, * volatilityCumulative Cumulative standard deviation for the pool lifetime from the point in time timestamp, * averageTick Time- weighted average tick, * volumePerLiquidityCumulative Cumulative swap volume per liquidity for the Pool lifetime from timestamp */ function timepoints(uint256 index) external display returns ( bool initialized, uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulative, uint88 volatilityCumulative , int24 averageTick, uint144 volume PerLiquidityCumulative ); /// @notice Initialize the dataStorage array by writing the first slot. Called once for the lifetime of the time array /// @param time The initialization time of the dataStorage, shortened to uint32 via block.timestamp /// @param tick Initial tick function initialize(uint32 time, int24 tick) external ; /// @dev Returns if a point in time equal to or earlier than the desired point in time's timestamp does not exist. /// 0 can be passed as `secondsAgo' to return the current cumulative values. /// If called with a timestamp between two points in time, return the counterfactual accumulator values ​​/// at the exact timestamp between the two points in time. /// @param time The current timestamp of the block /// @param secondAgo The backward time in seconds at which to return a point in time /// @param tick The current tick /// @param index The index of the point in time last written to the point in time array /// @param liquidity The current pool liquidity within the range /// @return tickCumulative The cumulative tick since the pool was first initialized, from `secondsAgo ` /// @return secondPerLiquidityCumulative Die cumulative seconds / max(1,Liquidity) since the pool was first initialized, from `secondsAgo` /// @return volatilityCumulative The cumulative volatility value since the pool was first initialized, from `secondsAgo` /// @return volumePerAvgLiquidity The cumulative volume after Liquidity value since the pool was first initialized, from the `secondsAgo` function getSingleTimepoint( uint32 time, uint32 secon dsAgo, int24 Tick, uint16 Index, uint128 Liquidity ) external A display returns ( int56 tickCumulative, uint160 secondPerLiquidCumulative, uint112 volatilityCumulative, uint256 volumePerAvgLiquid ); /// @notice Returns the accumulator values, starting every hour before seconds, from the time specified in the array of `secondsAgos` /// @dev Returns if `secondsAgos` > earlier time /// @ param time The current block.timestamp /// @param secondAgos The time back in seconds at which to return a point in time /// @param tick The current tick /// @param index The last index recorded time the timepoints array // / @paramliquidity The current liquidity of the pool within the range /// @return tickCumulatives The cumulative tick since the pool was first initialized, each starting at `secondsAgo` /// @return secondPerLiquidityCumulatives The cumulative seconds / max( 1, liquidity) since the first initialization of the pool every `secondsAgo` /// @return volatilityCumulatives The cumulative volatility values ​​since the first initialization of the pool every `secondsAgo` /// @return volumePerAvgLiquiditys The cumulative volume per liquidity values ​​since the pool was first initialized, from each `secondsAgo` function getTimepoints( uint32 time, uint32[] memory secondAgos, int24 tick, uint16 index, uint128 liquidity ) the external view returns (int56[] memory TickCumulatives, uint160[ ] Storage SecondsPerLiquidityCumulatives, uint112[] Storage VolatilityCumulatives, uint256[] Storage VolumePerAvgLiquiditys ); /// @notice Returns the average volatility in the WINDOW time range up to the time /// @param time The current block.timestamp /// @param tick The current tick /// @param index The index of the time last in the timepoint array was written /// @param liquidity The current liquidity of the pool within the range /// @return TWVolatilityAverage The average volatility over the last interval /// @return TWVolumePerLiqAverage The average volume per liquidity in the current range getAverages function ( time uint32, tick int24, index uint16, liquidity uint128 ) external view returns (uint112 TWVolatilityAverage, uint256 TWVolumePerLiqAverage); /// @notice Writes a dataStorage point in time to the array /// @dev Writable at most once per block. The index represents the last item written. Index must be crawled externally. /// @param index The index of the point in time that was last written into the point in time array /// @param blockTimestamp The timestamp of the new point in time /// @param tick The active tick at the time of the new point in time // / @param liquidity Die Total liquidity within the range at the new time /// @param volumePerLiquidity The gmean(volumes)/liquidity at the new time /// @return indexUpdated The new index from the last element written to the dataStorage array function write( uint16 index, uint32 blockTimestamp, int24 tick, uint128 liquidity, uint128 volumePerLiquidity ) external returns (uint16 indexUpdated); /// @notice Change the fee setting for the pool function changeFeeConfiguration(AdaptiveFee.Configuration calldata feeConfig) external; /// @notice Calculates gmean(volume/liquidity) for the block /// @paramliquidity The current pool liquidity within the range /// @paramamount0 total value of exchanged token0 /// @paramamount1 total value of exchanged token1 / // @return volumePerLiquidity gmean(volume/liquidity) bounded by 100000 << 64 functioncalculateVolumePerLiquidity( uint128 liquidity, int256 amount0, int256 amount1 ) outer pure returns (uint128 volumePerLiquidity); /// @return windowLength Length of window used to calculate averages function window() returns from external view (uint32 windowLength); /// @notice Calculates the rate based on the combination of sigmoids /// @param time The current block.timestamp /// @param tick The current tick /// @param index The index of the time that was recorded more recently in array timepoints /// @param liquidity The current liquidity of the pool within the range /// @rate of return The rate in hundredths of a beep, i.e. H. Function 1e-6 getFee( uint32 time, int24 tick, uint16 index , uint128 liquidity ) outside yields (rate uint16);}
File 25 of 50: AdaptiveFee.sol
// SPDX License Identifier: BUSL-1.1pragma solidity =0.7.6;import './Constants.sol';/// @title AdaptiveFee/// @notice Calculates the fee based on the combination of sigmoidlibrary AdaptiveFee { / / alpha1 + alpha2 + baseFee must <= type(uint16).max struct Configuration { uint16 alpha1; // maximum value of the first sigmoid uint16 alpha2; // Maximum value of the second sigmoid uint32 beta1; // offset along the x-axis for the first sigmoid uint32 beta2; // offset along the x-axis for the second sigmoid uint16 gamma1; // horizontal stretch factor for the first sigmoid uint16 gamma2; // horizontal stretch factor for the second sigmoid uint32 volumeBeta; // offset along the x-axis for the outer volume sigmoid uint16 volumeGamma; // horizontal stretch factor of the outer sigmoid volume uint16 baseFee; // minimum possible fee } /// @notice Calculates the fee based on the formula: /// baseFee + sigmoidVolume(sigmoid1(volatility, volumePerLiquidity) + sigmoid2(volatility, volumePerLiquidity)) /// maximum value limited by baseFee + alpha1 + alpha2 function getFee( uint88 volatility, uint256 volumePerLiquidity, configuration store configuration) internal pure returns (uint16 rate) { uint256 sumOfSigmoids = sigmoid(volatility, config.gamma1, config.alpha1, config.beta1) + sigmoid(volatility, config. gamma2 , config.alpha2, config.beta2); if (sumOfSigmoids > type(uint16).max) { // must be impossible if sumOfSigmoids = type(uint16).max; } return uint16(config.baseFee + sigmoid(volumePerLiquidity, config.volumeGamma, uint16(sumOfSigmoids), config.volumeBeta)); // sure since alpha1 + alpha2 + baseFee _must_ be <= type(uint16).max } /// @notice calculates α / (1 + e^( (β-x) / γ)) /// which is a sigmoid with a maximum value of α, x shifted by β and extended by γ /// @dev returns uint256 for fuzzy testing. Guarantees that the result is no larger than the function alpha sigmoid( uint256 x, uint16 g, uint16 alpha, uint256 beta ) returns pure inner (uint256 res) { if (x > beta) { x = x - beta; if (x >= 6 * uint256(g)) return alpha; // then x < 19 bits uint256 g8 = uint256(g)**8; // < 128 bits (8*16) uint256 ex = exp(x, g, g8); // < 155 bits res = (alpha * ex) / (g8 + ex); // worst case: (16 + 155 bits) / 155 bits // so res <= alpha } else { x = beta - x; if (x >= 6 * uint256(g)) returns 0; // then x < 19 bits uint256 g8 = uint256(g)**8; // < 128 bits (8*16) uint256 ex = g8 + exp(x, g, g8); // < 156 bits res = (alpha * g8) / ex; // worst case: (16 + 128 bits) / 156 bits // g8 <= ex, so res <= alpha } } /// @notice calculates e^(x/g) * g^8 in a row, since (around zero): /// e^x = 1 + x + x^2/2 + ... + x^n/n! + ... /// e^(x/g) = 1 + x/g + x^2/(2*g^2) + ... + x^(n)/(g^n * n! ) + ... function exp( uint256 x, uint16 g, uint256 gHighestDegree ) returns purely inner (uint256 res) { // calculation: // g**8 + x * g**7 + (x**2 * g**6) / 2 + (x**3 * g**5) / 6 + (x**4 * g**4) / 24 + (x**5 * g**3) / 120 + ( x**6 * g^2) / 720 + x**7 * g / 5040 + x**8 / 40320 // x**8 < 152 bits (19*8) e.g.**8 < 128 bits ( 8 *16) // then each addend is < 152 bits and res < 155 bits uint256 xLowestDegree = x; res = gMajorGrade; // g**8 gHighestDegree /= g; // g**7 res += xLowestDegree * gHighestDegree; gMajorGrade /= g; // g**6 xLowestDegree *= x; // x**2 res += (xLowestDegree * gHighestDegree) / 2; gMajorGrade /= g; // g**5 xLowestDegree *= x; // x**3 res += (xLowestDegree * gHighestDegree) / 6; gMajorGrade /= g; // g**4 xLowestDegree *= x; // x**4 res += (xLowestDegree * gHighestDegree) / 24; gMajorGrade /= g; // g**3 xLowestDegree *= x; // x**5 res += (xLowestDegree * gHighestDegree) / 120; gMajorGrade /= g; // g**2 xLowestDegree *= x; // x**6 res += (xLowestDegree * gHighestDegree) / 720; xSub grade *= x; // x**7 res += (xLowestDegree * g) / 5040 + (xLowestDegree * x) / (40320); }}
File 26 of 50: Constants.sol
// SPDX-Lizenz-Identifikator: GPL-2.0-oder-späteres Pragma solidity =0.7.6;library Constants {uint8 internal constant RESOLUTION = 96; konstante interne uint256 Q96 = 0x1000000000000000000000000; konstante interne uint256 Q128 = 0x1000000000000000000000000000000000; // Valor da taxa em centésimos de bip, ou seja, 1e-6 uint16 constante interna BASE_FEE = 100; konstante interne int24 TICK_SPACING = 60; // max(uint128) / ( (MAX_TICK - MIN_TICK) / TICK_SPACING ) uint128 interne Konstante MAX_LIQUIDITY_PER_TICK = 11505743598341114571880798222544994; konstante interne uint32 MAX_LIQUIDITY_COOLDOWN = 1 dias; konstante interne uint8 MAX_COMMUNITY_FEE = 250; konstante interne uint256 COMMUNITY_FEE_DENOMINATOR = 1000;}
File 27 of 50: IERC721Metadata.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;import "./IERC721.sol";/** * @title ERC-721 Non-Fungible Token Standard, metadata extension optional * @dev See https:// / eips.ethereum.org/EIPS/eip-721 */interface IERC721Metadata is IERC721 { /** * @dev Returns the name of the token collection. */ functionname() returns the external view (string memory); /** * @dev Returns the token from the token collection. */ function symbol() returns the external view (memory string); /** * @dev Returns the Uniform Resource Identifier (URI) for the token `tokenId`. */ function tokenURI(uint256 tokenId) returns external display (string memory);}
File 28 of 50: IERC721Enumerable.sol
// SPDX License Identifier: MITpragma solidity ^0.7.0;import "./IERC721.sol";/** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https:// / eips.ethereum.org/EIPS/eip-721 */interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() the external display returns (uint256); /** * @dev Returns a token id owned by the `owner` at a given `index` of your token list. * Use in conjunction with {balanceOf} to list all "owner" tokens. */ function tokenOfOwnerByIndex(owner address, index uint256) returns external view(uint256 tokenId); /** * @dev Returns a token ID at a given "index" of all tokens stored by the contract. * Used with {totalSupply} to list all tokens. */ function tokenByIndex(uint256 index) the outer view returns (uint256);}
File 29 of 50: IPoolInitializer.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.7.5;pragma abicoder v2; /// @title create and initialize V3 pools /// @notice Provides a method to create and initialize a pool, if necessary, to bundle with other methods that /// require the pool to exist. /// @dev credit to Uniswap Labs under GPL-2.0-or-later license /// https://github.com/Uniswap/ v3-peripheryinterface IPoolInitializer { /// @notice Create a new pool if it's not exists, then initialize it if uninitialized /// @dev This method can be grouped with others via IMulticall for the first action performed (e.g. mint) against a pool /// @param token0 The pool tokens0 -contract address /// @param token1 The pool token1 contract address /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value /// @return pool Returns the pool address based on the token and rate pair , returns the newly created pool address if the createAndInitializePoolIfNe function is needed cessary( token0 address, token1 address, uint160 sqrtPriceX96 ) externally payable returns (address pool);}
File 30 of 50: IERC721Permit.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.7.5;import '@openzeppelin/contracts/token/ERC721/IERC721.sol';/// @title ERC721 with permission/// @ Note An extension to ERC721 that includes a permission function for the IERC721Permit signature-based permission interface is IERC721 { /// @notice The permission type hash used in the permission signature /// @return The type hash for the permission function PERMIT_TYPEHASH() External Pure Returns ( Bytes32 ) ; /// @notice The domain separator used in the authorization signature /// @return The domain separator used in the encoding of the authorization signature function DOMAIN_SEPARATOR() returns the external display (bytes32); /// @notice Approve a specific token id for issuance by the donor via signature /// @param dispenser The account that will be approved /// @param tokenId The id of the token that will be approved for issuance / // @deadline from param The timestamp of the deadline by which the call must be cleared down in order for it to work /// @param v Must output a valid secp256k1 signature of the holder along with `r` and `s` /// @param r Must emit valid secp256k1 owner signature along with `v` and `s` /// @param s Must emit valid secp256k1 owner signature along with `r` and `v` role permission (donor address, uint256 tokenId, term uint256, uint8 v , bytes32 r, bytes32 s ) externally payable;}
File 31 of 50: IPeripheryImmutableState.sol
// SPDX License Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/// @title Immutable State/// @notice Functions returning the router's immutable state /// @dev Credit to Uniswap Labs licensed under GPL-2.0-or-later:/// https://github.com/Uniswap/v3-peripheryinterface IPeripheryImmutableState { /// @return Returns the address of the algebra factory function The external view returns factory () back ( address ); /// @return Returns the address of the pool deployer function poolDeployer() returning the external view (address); /// @return Returns the address of the WNativeToken function The external indicator WNativeToken() returns (address);}
File 32 of 50: PoolAddress.sol
// SPDX-License-Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/// @title Provides functions for deriving a factory pool address, tokens, and rate /// @dev credit for Uniswap Labs licensed under GPL-2.0 or higher /// https://github.com/Uniswap/v3-peripherylibrary PoolAddress {bytes32 internal constant POOL_INIT_CODE_HASH = 0x6ec6c6c9c8091d160c0aa74b2b14ba9c1717e95093bd3ac085cee99a49;aab4a key1kenadress29tokena49;aab4a;aab294a4;address29tokenadress29tokena4; } /// @notice Returns PoolKey: the sorted tokens with the corresponding fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted // / @return Poolkey Die Pool details with assignments of Token0 and Token1 ordered function getPoolKey(tokenA address, tokenB address) returns pure internals (PoolKey storage) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB}); } /// @notice Calculates the address of the pool deterministically given the factory and PoolKey /// @param factory The address of the algebra factory contract /// @param key The PoolKey /// @return pool The address of the V3 pool function contract computeAddress(address factory, PoolKey storage key) internal pure returns(address pool) { require(key.token0 < key.token1); pool = address(uint256(keccak256(abi.encodePacked(hex'ff', factory, keccak256(abi.encode(key.token0, key.token1)), POOL_INIT_CODE_HASH))); }}
File 33 of 50: IERC721.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;import "../../introspection/IERC165.sol";/** * @dev Required interface from an ERC721 compliant contract. */interface IERC721 is IERC165 { /** * @dev Is issued when token "tokenId" is transferred from "from" to "to". */ event Transfer(indexed address from, indexed address to, indexed tokenId uint256); /** * @dev Printed when `owner` allows `approved` to manage token `tokenId`. */ event Approval(Owner Indexed Address, Approved Indexed Address, Indexed uint256 TokenId); /** * @dev Emitted when the `owner` allows or authorizes the `operator` to manage all of its assets. */ event ApprovalForAll(owner-indexed address, operator-indexed address, bool approved); /** * @dev Returns the number of tokens in the owner account. */ function balanceOf(address owner) the external display returns (balance uint256); /** * @dev Returns the owner of the token `tokenId`. ** Prerequisites: ** - `tokenId` must be present. */ function ownerOf(uint256 tokenId) the external view returns (owner's address); /** * @dev Transfers the token `tokenId` securely from `from` to `to`, first checking that the contract recipients * are aware of the ERC721 protocol to avoid locking tokens forever. ** Requirements: ** - `from` must not be the null address. * - "to" cannot be the address null. * - The token "tokenId" must exist and belong to "from". * - If the caller is not "de", they must have permission to move this token by {approve} or {setApprovalForAll}. * - If "to" refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called on secure transfer. * * Dispatches a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers the token `tokenId` from `from` to `to`. * * WARNING: Use of this method is discouraged, use {safeTransferFrom} whenever possible. ** Requirements: ** - `from` must not be the null address. * - "to" cannot be the address null. * - The token `tokenId` must belong to `from`. * - If the caller is not `de`, moving this token must be approved by {approve} or {setApprovalForAll}. * * Dispatches a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Allows `to` to transfer the token `tokenId` to another account. * Permission is released when the token is transferred. * * Only one account can be approved at a time, so approving address zero will cancel previous approvals. ** Requirements: ** - The caller must have the token or be an allowed operator. * - `tokenId` must be present. * * Dispatches an {Approval} event. */ authorize function (address to, uint256 tokenId) external; /** * @dev Returns the approved account for the token "tokenId". ** Prerequisites: ** - `tokenId` must be present. */ function getApproved(uint256 tokenId) the external display returns (address operator); /** * @dev Allows or removes `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. ** Prerequisites: ** - The `Operator` must not be the caller. * * Dispatches an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns whether the "operator" has permission to manage all "owner" assets. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers the token `tokenId` from `from` to `to`. ** Requirements: ** - `from` must not be the null address. * - "to" cannot be the address null. * - The token "tokenId" must exist and belong to "from". * - If the caller is not `de`, moving this token must be approved by {approve} or {setApprovalForAll}. * - If "to" refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called on secure transfer. * * Dispatches a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, data bytes of call data) external;}
File 34 of 50: IERC165.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;/** * @dev ERC165 standard interface as defined in * https://eips.ethereum.org/EIPS/eip-165[EIP] . * * Implementers can declare support for contract interfaces, which can then be * queried by others ({ERC165Checker}). * * See {ERC165} for an implementation. */interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the relevant *https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]* to learn more about how these IDs are created. * * This function call must use fewer than 30,000 gases. */ function supportInterface(bytes4 interfaceId) the external view returns (bool);}
File 35 of 50: IAlgebraFarming.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;pragma acoder v2;import 'algebra/contracts/interfaces/IAlgebraPoolDeployer.sol';import 'algebra/contracts/interfaces/IAlgebraPool.sol' ;import 'algebra/contracts/interfaces/IERC20Minimal.sol';import 'algebra-periphery/contracts/interfaces/INonfungiblePositionManager.sol';import './IFarmingCenter.sol';import './IIncentiveKey.sol';/// @title Algebra Farming Interface/// @notice Allows farming of non-fungible liquidity tokens in exchange for reward tokensinterface IAlgebraFarming is IIncentiveKey { /// @notice The non-fungible position manager this farming contract is compatible with function nonfungiblePositionManager() External View Returns (INonfungiblePositionManager) ; /// @notice The external view of the farming center function FarmingCenter() returns (IFarmingCenter); /// @notice The pool deployer function deployer() is returned externally (IAlgebraPoolDeployer); /// @notice Updates the IncentiveMaker /// @param _incentiveMaker The new IncentiveMaker address function setIncentiveMaker(address _incentiveMaker) external; struct Tiers { // Amount of tokens to reach the tier uint256 tokenAmountForTier1; uint256 tokenAmountForTier2; uint256 tokenAmountForTier3; // 1 = 0.01% uint32 tier1 multiplier; uint32 tier2multiplier; uint32 tier3multiplier; } /// @notice Represents a farming incentive /// @param IncentiveId The ID of the incentive calculated from its parameters Function Incentives(Bytes32 IncentiveId) Returns the external view ( uint256 totalReward, uint256 bonusReward, address virtualPoolAddress, uint24 minimalPositionWidth, uint224 totalLiquidity, address multiplierToken, Tiers Tiers ); /// Resolve @notice incentive from the pool /// @param key The key of the incentive function resolveIncentive(IncentiveKey memory key) external; /// Add @notice incentive to the pool /// @param key The key of the incentive function attachmentIncentive(IncentiveKey memory key) external; /// @notice Returns the amounts of reward tokens owed to a given address according to the last time all farms were updated /// @param owner The owner for whom the rewards owed are being checked /// @param rewardToken The token to check for rewards /// @return rewardsOwed The reward token amount that is claimable by the owner function Rewards(Address owner, IERC20Minimal RewardToken) external view returns(uint256 RewardsOwed); /// @notice Updates the address of the farming center /// @param _farmingCenter The new contract address of the farming center function setFarmingCenterAddress(address _farmingCenter) external; /// @notice Enter Farming for Algebra LP tokens /// @param key The key of the incentive for which to farm the NFT /// @param tokenId The ID of the token for exitFarming /// @param tokensLocked The amount locked to token for boost function enterFarming(IncentiveKey storage key, uint256 tokenId, uint256 tokensLocked) external; /// @notice exitFarmings for Algebra LP token /// @param key The key of the incentive for which to terminate the NFT /// @param tokenId The ID of the token for exitFarming /// @param _owner Owner of the token function exitFarming(IncentiveKey storage key, uint256 tokenId, address _owner) external; /// @notice Transfers `amountRequested` of the accumulated `rewardToken` rewards from the contract to the recipient `to` /// @param rewardToken The token that will be distributed as a reward /// @param to The address where the Claimed rewards will be sent to /// @param amountRequested The amount of reward tokens to claim. Requests the total bounty amount if set to 0. /// @return reward The amount of reward tokens claimed Function ClaimReward( IERC20Minimal RewardToken, address to, uint256 amountRequested ) External Returns (uint256 Reward); /// @notice Transfers `amountRequested` of the accrued `rewardToken` rewards from the contract to the recipient `to` /// @notice for FarmingCenter only /// @param rewardToken The token that will be distributed as a reward /// @ param from The address of the position holder /// @param to The address to which the claimed rewards will be sent /// @param amountRequested The amount of reward tokens to claim. Requests the total bounty amount if set to 0. /// @return reward The amount of reward tokens claimed Function ClaimRewardFrom( IERC20Minimal RewardToken, Address From, Address To, uint256 AmountRequested ) External Returns (uint256 Reward); /// @notice Calculates the reward amount received for the given farm /// @param key The key of the incentive /// @param tokenId The ID of the token /// @return reward The reward accrued for the previous NFT for the given incentive /// @return bonusReward The bonus reward that has accrued to the NFT so far for the given incentive. /// @notice Event issued when a liquidity mining incentive is stopped from outside /// @param rewardToken The token that will be distributed as a reward /// @param bonusRewardToken The token that will be distributed as a bonus reward /// @param pool The algebra pool /// @param virtualPool The address of the disconnected virtual pool /// @param startTime The time when the incentive program starts /// @param endTime The time when none bonuses accrue , IAlgebraPool indexed pool, address virtualPool, uint256 startTime, uint256 endTime ); /// @notice Event that is issued when a liquid mining incentive is executed again from the outside /// @param rewardToken The token that is distributed as a reward /// @param bonusRewardToken The token that is distributed as a bonus reward becomes /// @param pool The algebra pool /// @param virtualPool The attached address of the virtual pool /// @param startTime The time the incentive program starts /// @param endTime The time the bonusRewardToken, IAlgebraPool indexed pool, address virtualPool, uint256 startTime, uint256 endTime ); /// @notice Event emitted when an algebra LP token is farmed /// @param tokenId The unique identifier of an algebra LP token /// @param IncentiveId The incentive in which the token is farmed /// @param liquidity The amount of liquidity farmd /// @param tokensLocked The amount of tokens locked for the FarmEntered multiplier event (uint256 indexed TokenId, bytes32 indexed IncentiveId, uint128 liquidity, uint256 tokensLocked); /// @notice Event issued when an algebra LP token is completed Token distributed as a reward /// @param bonusRewardToken The token distributed as a bonus reward /// @param owner Die Address where the claimed rewards were sent /// @param reward The amount of reward tokens to be distributed /// / @param bonusReward The amount of bonus reward tokens to be distributed event FarmEnded( uint256 indexed tokenId, bytes32 indexed incentiveId, address indexed reward address, address bonusRewardToken, address owner, uint256 reward, uint256 bonusReward ); /// @notice Is issued when the incentive maker is changed /// @param IncentiveMaker The incentive maker after the address has been changed event IncentiveMaker(address indexed IncentiveMaker); /// @notice Issued when the farming center is changed /// @param FarmingCenter The farming center after the address is changed event FarmingCenter(address indexed FarmingCenter); /// @notice Event issued when rewards are added /// @param rewardAmount The additional amount of the main token /// @param bonusRewardAmount The additional amount of the bonus token /// @param IncentiveId The ID of the Incentive for which rewards were added event RewardsAdded(uint256 rewardAmount, uint256 bonusRewardAmount, bytes32 IncentiveId); /// @notice Event issued when a reward token is claimed /// @param to The address to which the claimed rewards were sent /// @param reward The amount of reward tokens claimed /// @param rewardAddress Die Token reward address /// @param owner The address to which the claimed rewards were sent to the RewardClaimed event (address indexed to, uint256 reward, address indexed reward address, address indexed owner);}
File 36 of 50: IAlgebraPoolDeployer.sol
// SPDX License Identifier: GPL-2.0-or-laterpragma solidity >=0.5.0;/** * @title An interface to a contract that can provide algebra pools * @notice A contract that creates a pool , must implement this to pass arguments to the pool* @dev This is used to avoid constructor arguments in the pool contract, resulting in the hash of the pool's init* code being constant, making the pool's CREATE2 address cheap in the chain can be calculated. * Credit to Uniswap Labs under GPL 2.0 license or higher: * https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces */interface IAlgebraPoolDeployer { /** * @notice Is issued, if address factory is used has been changed * @param factory The address of the factory after the address has been changed */ event Factory(address indexed factory); /** * @notice Gets the parameters to use when building the pool, which are temporarily set during pool creation. * @dev Called by the pool's constructor to get the pool's parameters. * Returns dataStorage. The associated pool dataStorage. * Returns factory the address of the factory. * returns token0 the pool by address sort order */ function parameters () external view returns ( dataStorage address, factory address, token0 address, token1 address ); /** * @dev Provisions a pool with the specified parameters by temporarily configuring the parameter space * and then deleting it after the pool is provisioned. * @param dataStorage The associated pools dataStorage * @param factory The address of the algebra factory contract * @param token0 The first pool token by address sort order * @param token1 The second pool token by address sort order * @return pool The address of the deployed pool */ function deploy( address dataStorage, address factory, address token0, address token1 ) returns external (address pool); /** * @dev Sets the factory address for the poolDeployer for allowed actions * @param factory The address of the algebra factory */ function setFactory(address factory) external;}
File 37 of 50: ERC721.sol
// SPDX-License-Identifier: MITpragma solidity ^0.7.0;import "../../utils/Context.sol";import "./IERC721.sol";import "./IERC721Metadata.sol";import "./IERC721Enumerable.sol";import "./IERC721Receiver.sol";import "../../introspection/ERC165.sol";import "../../math/SafeMath.sol";import "../../utils/Address.sol";import "../../utils/EnumerableSet.sol";import "../../utils/EnumerableMap.sol";import "../../utils/Strings.sol";/** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }}
File 38 of 50: Address.sol
// SPDX License Identifier: MITpragma solidity ^0.7.0;/** * @dev Collection of functions related to address type */library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is not safe to assume that an address for which this function * returns false is an external account (EOA) and not a contract. * * Among others, isContract returns false for the following * types of addresses: * * - an external account * - a contract in progress * - an address where a contract will be created * - an address where a contract was alive, but it was destroyed * ==== */ function isContract(address account) internal view return (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is stored only in o end of execution of the // constructor. size uint256; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Solidity `transfer` substitution: sends `amount` wei to * `recipient`, forwards all available gas and returns on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, potentially causing contracts to exceed the 2300 * gas limit imposed by "Transfer", causing -these to are unable to receive money via *`bank transfer`. {sendValue} removes this restriction. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[More information]. * * IMPORTANT: Since control is transferred to the "recipient", care must be taken not to * create re-entry vulnerabilities. Consider using *{ReentranciaGuard} or *https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern] . */ function sendValue(address of payee, value uint256) internal { require(address(this).balance >= value, "Address: Insufficient balance"); // solhint-disable-next-line avoid low-level calls, avoid call-value (bool success, ) = receiver.call{ value: amount }(""); require(success, "Address: value could not be sent, recipient may have returned"); } /** * @dev Executes a Solidity function call with a low-level `call`. A *plain`call` is an unsafe substitute for a function call: use this * function instead. * * If `target` rolls back with a rollback reason, this function will bubbling it up * (like normal Solidity function calls). * * Returns the raw data returned. 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 be undone. * * _Available since v3.1._ */ function functionCall(destination address, data bytes of memory) internal return (bytes of memory) { return functionCall(destination, data, "Address: low-level call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`] but with * `errorMessage` as fallback reason when `target` is reset. * * _Available since v3.1._ */ function functionCall(destination address, memory data bytes, memory string errorMessage) internal return (memory bytes) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also passes `value` wei to `target`. ** Prerequisites: ** - The calling contract must have at least one ETH balance of `value`. * - The Solidity function called must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(destination address, bytes memory data, uint256 value) internal return (memory bytes) { return functionCallWithValue(destination, data, value, "Address: call failed low-level call with Value "); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as the fallback rollback reason when `target` rolls back. * * _Available since v3.1._ */ function functionCallWithValue(destination address, memory data bytes, uint256 value, memory string errorMessage) internal return (memory bytes) { require(address(this).balance >= value, "Address: Insufficient credit for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line Avoid low-level calls (bool success, bytes of memory return data) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but makes a static call. * * _Available since v3.3._ */ function functionStaticCall(target address, bytes memory data) internal view return (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but makes a static call. * * _Available since v3.3._ */ function functionStaticCall(target address, bytes memory data, string memory errorMessage) internal view return (bytes memory) { require(isContract(target), "Address: static call to non-contract " ); // solhint-disable-next-line avoid low-level calls (bool success, bytes memory return data) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performs a delegate invocation. * * _Available since v3.4._ */ function functionDelegateCall(destination address, byte memory data) inner returns (byte memory) { return functionDelegateCall(destination, data, "Address: Lower delegate call failed level"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performs a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(target address, bytes memory data, string memory errorMessage) internal return (bytes memory) { require(isContract(target), "Address: delegate call to non-contract" ) ; // solhint-disable-next-line Avoid low-level calls (bool success, bytes of memory return data) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure return(bytes memory) { if (success) { return returndata; } else { // Look up the reason for the reversal and if there is one if (returndata.length > 0) { // The easiest way to blow the reason for the reversal is to use the memory via assembly // solhint-disable -next-line in- line montage { let returndata_size := mload (returndata) revert (add (32, returndata), returndata_size) } } else { revert (errorMessage); } } }}
File 39 of 50: ChainId.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.7.0;/// @title Function to get current chain id library ChainId { /// @dev Get current chain id / / / @ return chainId The current chain id function get() inner pure return (uint256 chainId) { assembly { chainId := chainid() } }}
File 40 of 50: IERC1271.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.5.0; /// @title Interface for verifying contract-based account signatures /// @notice Interface that verifies the signature provided for the data /// @dev Interface defined by EIP-1271interface IERC1271 { /// @notice Returns whether the provided signature is valid for the given data /// @dev MUST return the magic value bytes4 0x1626ba7e if the function succeeds. /// MUST NOT change state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5). /// MUST allow external calls. /// @param hash Hash of data to be signed /// @param signature Signature byte array associated with _data /// @return magicValue The magic value bytes4 0x1626ba7e isValidSignature(bytes32 hash, byte memory signature) function a external view returns ( bytes4 magicValue); }
File 41 of 50: BlockTimestamp.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6; /// @title Function to get the block timestamp /// @dev base contract that will be replaced by testsabstract Contract BlockTimestamp { /// @dev method that only exists to be overridden for testing /// @return The timestamp function of the current block _blockTimestamp() internal view virtual returns(uint256) { return block.timestamp; }}
File 42 of 50: Context.sol
// SPDX License Identifier: MITpragma solidity >=0.6.0 <0.8.0;/* * @dev Provides information about the current execution context, including * the sender of the transaction and its data. While they are generally available through msg.sender and msg.data *, they should not be accessed directly * because when dealing with GSN metatransactions, the account sending and * paying for the execution may not be the actual sender (in relation to an application *). * * This contract is only required for library-like intermediate contracts. */abstract contract context { function _msgSender() virtual internal view returns (payable address) { return msg.sender; } _msgData() function returns virtual internal view (memory bytes) { this; // Silence state change alert without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; }}
File 43 of 50: ERC165.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;import "./IERC165.sol";/** * @dev interface implementation {IERC165}. * * Contracts can inherit from this and call {_registerInterface} to * declare their support for an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Interface ID mapping for support or not. */ assignment (bytes4 => bool) private _supportedInterfaces; constructor () { // Derived contracts only need to register support for their own interfaces, // we register support for ERC165 ourselves here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * O(1) time complexity, guarantees that less than 30,000 gases are always used. */ function supportInterface(bytes4 interfaceId) display public virtual replacement return (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. True ERC165 interface support is automatic and * you don't need to register your interface ID. ** See {IERC165-supportsInterface}. ** Prerequisites: ** - `interfaceId` must not be the invalid interface ERC165 (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual {require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; }}
File 44 of 50: SafeMath.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;/** * @dev wrapper over solidity arithmetic operations with additional overflow checks *. * * Arithmetic operations in Solidity overflow. This can easily lead to * errors, since programmers often assume that an overflow will generate an * error, which is standard behavior in high-level programming languages. * `SafeMath` restores this intuition by rolling back the transaction if an * operation overflows. * * Using this library instead of the unchecked operations eliminates a whole * class of bugs, so it's always recommended to use it. */library SafeMath { /** * @dev Returns the addition of two unsigned integers with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) pure internal returns (bool, uint256) { uint256 c = a + b; if (c < a) returns (false, 0); return(true, c); } /** * @dev Returns the subtraction of two unsigned integers with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure return (bool, uint256) { if (b > a) return (false, 0); return(true, a - b); } /** * @dev Returns the multiplication of two unsigned integers with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure return (bool, uint256) { // Gas optimization: It's cheaper than requiring 'a' to be nonzero, but / / the benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return(true, c); } /** * @dev Returns the division of two unsigned integers, with a divide-by-zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure return (bool, uint256) { if (b == 0) return (false, 0); return(true, a/b); } /** * @dev Returns the remainder of the division of two unsigned integers, with a divide-by-zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure return (bool, uint256) { if (b == 0) return (false, 0); return(true, a % b); } /** * @dev Returns the addition of two unsigned integers and returns to * overflow. * * The equivalent of Solidity's `+` operator. * * Requirements: * * - Addition must not overflow. */ function add(uint256 a, uint256 b) pure internal returns(uint256) { uint256 c = a + b; require(c >= a, "SafeMath: Addition Overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers and returns to * overflow (if the result is negative). * * The equivalent of Solidity's `-` operator. ** Requirements: ** - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) returns inner(uint256) { require(b <= a, "SafeMath: Subtraction Overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers and returns to * overflow. * * The equivalent of Solidity's `*` operator. ** Requirements: ** - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) inner pure return (uint256) { if (a == 0) returns 0; uint256 c = a * b; require(c / a == b, "SafeMath: Multiply overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers and reverses the * division by zero. The result is rounded to zero. * * The equivalent of Solidity's `/` operator. Note: This function uses a "revert"* opcode (leaving the remaining gas intact), while Solidity* uses an invalid opcode to reverse (consuming all the remaining gas). ** Requirements: ** - The divisor must not be zero. */ function div(uint256 a, uint256 b) pure inner returns(uint256) { require(b > 0, "SafeMath: divide by zero"); return a / b; } /** * @dev Returns the remainder of two unsigned integers. (unsigned integer module), * inversion when dividing by zero. * * The equivalent of Solidity's `%` operator. This function uses a "revert" * opcode (leaving the remaining gas untouched), while Solidity uses an invalid * opcode to reverse (consuming all the remaining gas). ** Requirements: ** - The divisor must not be zero. */ function mod(uint256 a, uint256 b) pure inner returns(uint256) { require(b > 0, "SafeMath: modulus by zero"); back to %b; } /** * @dev Returns the subtraction of two unsigned integers and returns with a custom message on * overflow (if the result is negative). * * CAUTION: This feature is deprecated because it requires unnecessary memory allocation for the * error message. For custom rollbacks, use {trySub}. * * The equivalent of Solidity's `-` operator. ** Requirements: ** - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) returns pure inner(uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reversing with custom message at * division by zero. The result is rounded to zero. * * CAUTION: This feature is deprecated because it requires unnecessary memory allocation for the * error message. For custom recovery reasons, use {tryDiv}. * * The equivalent of Solidity's `/` operator. Note: This function uses a "revert"* opcode (leaving the remaining gas intact), while Solidity* uses an invalid opcode to reverse (consuming all the remaining gas). ** Requirements: ** - The divisor must not be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) returns pure inner (uint256) {require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of two unsigned integers. (unsigned integer module), * Reverse with custom message when dividing by zero. * * CAUTION: This feature is deprecated because it requires unnecessary memory allocation for the * error message. For custom rollbacks, use {tryMod}. * * The equivalent of Solidity's `%` operator. This function uses a "revert" * opcode (leaving the remaining gas untouched), while Solidity uses an invalid * opcode to reverse (consuming all the remaining gas). ** Requirements: ** - The divisor must not be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) returns pure inner(uint256) {require(b > 0, errorMessage); back to %b; }}
File 45 of 50: EnumerableSet.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;/** * @dev library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of * primitive types. * * Sets have the following properties: * * - elements are added, removed and checked for existence in constant time * (O(1)). * - The elements are enumerated in O(n). No guarantee is given on the order. * * ``` * contract example { * // add library methods * using EnumerableSet to EnumerableSet.AddressSet; * * // Declares a Set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */library EnumerableSet { // To implement this library for multiple types with minimal // code repetition, let's write it in the form of a generic set type with values ​​// bytes32. // The implementation of Set uses private functions, and user-oriented implementations // (like AddressSet) are just wrappers around // the underlying Set. // This means we can only create new EnumerableSets for types that // fit in bytes32. struct Set { // Storage of set values ​​bytes32[] _values; // Position of the value in the "values" array plus 1 because index 0 // means that a value is not in the set. assignment (bytes32 => uint256) _indexes; } /** * @dev Adds a value to a set. O(1). * * Returns true if the value was added to the set, ie if it didn't * already exist. */ function _add(Set storage pool, value bytes32) private return (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored in length-1, but we add 1 to all indexes // and use 0 as the sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, ie if * was present. */ function _remove(Set storage set, bytes32 value) private return (bool) { // Read and save the index of the value to avoid multiple readings from the same memory slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values ​​array in O(1), we swap the element to be deleted with the last one // into the array, and then remove the last element (sometimes called "swap and pop"). // This changes the order of the array as specified in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // If the value to delete is the last one, the swap operation is unnecessary. However, since this is so rare // we'll still make the switch to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Moves the last value to the index where the value to be deleted is defined._values[toDeleteIndex] = lastvalue; // update index to moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indices are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values ​​in the set. O(1). */ function _length(Set storage set) private view return (uint256) { return set._values.length; } /** * @dev Returns the value stored at the "index" position in the array. O(1). * * Note that there are no guarantees as to the order of values ​​within the array * and may change as more values ​​are added or removed. ** Requirements: ** - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) {require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Adds a value to a set. O(1). * * Returns true if the value was added to the set, ie if it didn't * already exist. */ function add (memory set Bytes32Set, value bytes32) inner return (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, ie if * was present. */ function remove(Bytes32Set storage set, bytes32 value) internal return (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(memory set bytes32set, value bytes32) inner display return (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values ​​in the set. O(1). */ function length(Bytes32Set storage set) internal view return (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at the "index" position in the array. O(1). * * Note that there are no guarantees as to the order of values ​​within the array * and may change as more values ​​are added or removed. ** Requirements: ** - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view return (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Adds a value to a set. O(1). * * Returns true if the value was added to the set, ie if it didn't * already exist. */ function add(AddressSet memory pool, address value) return inner(bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, ie if * was present. */ function remove(AddressSet storage pool, address value) inner return (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet memory pool, address value) inner view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values ​​in the set. O(1). */ function length(memory set of AddressSet) inner view return(uint256) { return _length(set._inner); } /** * @dev Returns the value stored at the "index" position in the array. O(1). * * Note that there are no guarantees as to the order of values ​​within the array * and may change as more values ​​are added or removed. ** Requirements: ** - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view return (adresse) { return address(uint160(uint256(_at(set._inner, index))))); } // UintSet struct UintSet {Set _inner; } /** * @dev Adds a value to a set. O(1). * * Returns true if the value was added to the set, ie if it didn't * already exist. */ function add(storage set UintSet, value uint256) return inner(bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, ie if * was present. */ function remove(storage set UintSet, value uint256) return inner (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains (UintSet storage set, uint256 value) inner display return (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values ​​in the set. O(1). */ function length(storage set UintSet) inner view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at the "index" position in the array. O(1). * * Note that there are no guarantees as to the order of values ​​within the array * and may change as more values ​​are added or removed. ** Requirements: ** - `index` must be strictly less than {length}. */ function at(storage pool UintSet, index uint256) inner view return(uint256) { return uint256(_at(set._inner, index)); }}
File 46 of 50: EnumerableMap.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;/** * @dev library for managing an enumerable solidity variant * https://solidity.readthedocs.io/en/latest/types.html#mapping -types [`mapping`] * type. ** Maps have the following properties: ** - Entries are added, removed and checked for existence in constant time * (O(1)). * - Entries are numbered in O(n). No guarantee is given on the order. * * ``` * contract example { * // add library methods * using EnumerableMap to EnumerableMap.UintToAddressMap; * * // Declare a defined state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0 only maps of type `uint256 -> Address` (`UintToAddressMap`) * are supported. */library EnumerableMap { // To implement this library for multiple types with as little // code repetition as possible, we write it in the form of a generic map type with // bytes32 keys and values. // The map implementation uses private functions and // user-facing implementations (like Uint256ToAddressMap) are just wrappers // of the underlying map. // This means we can only create new EnumerableMaps for types that // fit in bytes32. struct MapEntry {bytes32 _key; bytes32 _value; } struct Map { // Store map keys and values ​​MapEntry[] _entries; // Entry position defined by a key in the `Entries` array, plus 1 // because index 0 means a key is not in the map. assignment (bytes32 => uint256) _indexes; } /** * @dev Adds a key/value pair to a map or updates the value of an * existing key. O(1). ** Returns true if the key has been added to the card, ie. H. if it doesn't * already exist. */ function _set(map memory map, bytes32 key, bytes32 value) private return (bool) { // read and store key index to prevent multiple reads from the same memory slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Corresponds to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored in length-1, but we add 1 to all indexes // and use 0 as the sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; returns false; } } /** * @dev Removes a key/value pair from a map. O(1). * * Returns true if the key was removed from the card, ie if it was present. */ function _remove(Map storage map, bytes32 key) private return (bool) { // Read and save key index to prevent multiple reads from the same memory slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to be deleted with the last one // into the array and then remove the last entry (sometimes called "swap and pop"). // This changes the order of the array as specified in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // If the entry to delete is the last one, the swap operation is unnecessary. However, since this is so rare // we'll still make the switch to avoid the gas cost of adding an 'if' statement. mapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry into the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indices are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(map storage map, key bytes32) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at the "index" location in the map. O(1). * * Note that the order of entries within the array * is not guaranteed and may change as more entries are added or removed. ** Requirements: ** - `index` must be strictly less than {length}. */ function _at(map storage map, index uint256) private view returns (bytes32, bytes32) {require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry memory entry = map._entries[index]; return (input._key, input._value); } /** * @dev Tries to return the value associated with `key`. O(1). * Does not return if "key" is not in the map. */ function _tryGet(map storage map, bytes32 key) private display returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indices are 1-based } /** * @dev Returns the value associated with `key`. O(1). ** Requirements: ** - `Key` must be on the card. */ function _get(map storage map, key bytes32) returns private view(bytes32) {uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: missing key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indices are 1-based } /** * @dev Same as {_get}, with a custom error message if `key` is not in the map. * * CAUTION: This feature is deprecated because it requires unnecessary memory allocation for the * error message. For custom rollbacks, use {_tryGet}. */ function _get(map storage map, bytes32 key, string memory error message) returns private view(bytes32) {uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indices are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key/value pair to a map or updates the value of an * existing key. O(1). ** Returns true if the key has been added to the card, ie. H. if it doesn't * already exist. */ function set(storage map UintToAddressMap, uint256 key, address value) return inner(bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the card, ie if it was present. */ function remove(storage map UintToAddressMap, key uint256) return inner(bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(map UintToAddressMap, key uint256) returns inner view (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length (map UintToAddressMap) inner view returns (uint256) { return _length(map._inner); } /** * @dev Returns the item stored at the "index" position in the set. O(1). * Note that there are no guarantees as to the order of values ​​within the array * and may change as more values ​​are added or removed. ** Requirements: ** - `index` must be strictly less than {length}. */ function at(storage map UintToAddressMap, index uint256) inner view returns (uint256, address) { (key bytes32, value bytes32) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to return the value associated with `key`. O(1). * Does not return if "key" is not in the map. * * _Available since v3.4._ */ function tryGet(storage map UintToAddressMap, key uint256) returns inner view(bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key )); return(success,address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). ** Requirements: ** - `Key` must be on the card. */ function get(storage map UintToAddressMap, key uint256) inner view return(address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message if `key` is not in the map. * * CAUTION: This feature is deprecated because it requires unnecessary memory allocation for the * error message. For custom rollbacks, use {tryGet}. */ function get(storage map UintToAddressMap, key uint256, string memory errorMessage) inner view return(address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); }}
File 47 of 50: Strings.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;/** * @dev Stringoperation. */library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure return (string memory) { // Inspired by OraclizeAPI implementation - MIT license // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0. 4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temperature /= 10; } memory buffer bytes = new bytes (digits); index uint256 = digits - 1; temperature = value; while (temp != 0) {buffer[index--] = bytes1(uint8(48 + temp % 10)); temperature /= 10; } return string (buffer); }}
File 48 of 50: IERC20.sol
// SPDX license identifier: MITpragma solidity ^0.7.0;/** * @dev ERC20 standard interface as defined in the EIP. */interface IERC20 { /** * @dev Returns the number of tokens present. */ function totalSupply() the external display returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(account address) the external display returns (uint256); /** * @dev Moves the `amount` tokens from the caller`s account to the `recipient`. * * Returns a Boolean value indicating whether the operation was successful. * * Dispatches a {Transfer} event. */ function transfer(address addressee, value uint256) external return (bool); /** * @dev Returns the remaining number of tokens that `spender` can spend on behalf of `owner` via {transferFrom} *. This is *null by default. * * This value changes when {approve} or {transferFrom} is called. */ role permission (address owner, address giver) returns external view (uint256); /** * @dev Sets `amount` to the `donor` share on caller tokens. * * Returns a Boolean value indicating whether the operation was successful. * *IMPORTANT: Note that changing an allowance using this method carries the risk of * someone using both the old and new allowance in the unfortunate order of the transaction. A possible solution to mitigate this race condition * is to first reduce the donor allowance to 0 and then set the * desired value: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Issues at {approval} event. */ authorize function(donor address, value uint256) external returns(bool); /** * @dev Moves `amount` token from `sender` to `recipient` using * permission mechanism. "Amount" is then subtracted from the caller's permission*. * * Returns a Boolean value indicating whether the operation was successful. * * Dispatches a {Transfer} event. */ function transferFrom(sender of address, receiver of address, value uint256) external return (bool); /** * @dev Emitted when moving `value` tokens from one * account (`from`) to another (`to`). * * Note that `value` can be null. */ event Transfer(address indexed by, address indexed to, value uint256); /** * @dev Emitted when a `donate` permission is set for an `owner` by * calling {approve}. "Value" is the new payout. */ event Approval(owner indexed address, donor indexed address, uint256 value);}
Datei 49 von 50: IWNativeToken.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity =0.7.6;import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /// @title Interface for WNativeTokeninterface IWNativeToken is IERC20 { / // @notice Deposit ether to get ether function for outer deposit(); /// @notice Remove the encapsulated ether to get the external ether function strip(uint256);}
File 50 of 50: TransferHelper.sol
// SPDX license identifier: GPL-2.0-or-laterpragma solidity >=0.6.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /// @dev Credit to Uniswap Labs under GPL- 2.0-or-later license:/// https://github.com/Uniswap/v3-peripherylibrary TransferHelper { /// @notice Transfers tokens from destination address to specified destination /// @notice Error with "STF" if the transfer fails /// @param Token The contract address of the token to be transferred /// @param from The source address from which the tokens are transferred /// @param to Die Transfer destination address /// @parameter value The amount to be transferred function safeTransferFrom( token address, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(IERC20. transferFrom.selector, from , to , value ) ); require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF'); } /// @notice Transferred tokens from msg.sender to a receiver /// @dev Error ST if transfer fails /// @param token The contract address of the token that will be transferred /// @param to the receiver from transfer /// @param value The value of the transfer function safeTransfer( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector , estimate) ); require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST'); } /// @notice Approve the agreed contract to issue the given permission for the provided token /// @dev Error with 'SA' if transfer fails /// @param token The contract address of the token to approve // // @param to The approval target /// @param value The amount of the given token that the target can spend function safeApprove( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call (abi.encodeWithSelector(IERC20.approve.selector, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA'); } /// Transfer @notice NativeToken to recipient address /// @dev Failed with `STE` /// @param to Transfer destination /// @param value The value to transfer function safeTransferNative(address to, internal uint256) value {( bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'STE'); }}
the settings
{ "optimizer": { "enabled": true, "runs": 1000000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {}}
Contract Security Audit
- No contract security audits sent-Submit exam here
ABI contract
JSON-Format RAW/Text-Format
[{"inputs":[{"internalType":"contract IAlgebraLimitFarming","name":"_limitFarming","type":"address"},{"internalType":"contract IAlgebraEternalFarming","name":"_eternalFarming","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"_nonfungiblePositionManager","type":"address"},{"internalType":"contract IFarmingCenterVault","name":"_farmingCenterVault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"DepositTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WNativeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amountRequestedIncentive","type":"uint256"},{"internalType":"uint256","name":"amountRequestedEternal","type":"uint256"}],"name":"claimReward","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"}],"internalType":"struct INonfungiblePositionManager.CollectParams","name":"params","type":"tuple"}],"name":"collect","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct IIncentiveKey.IncentiveKey","name":"key","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"collectRewards","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"bonusReward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"address","name":"newVirtualPool","type":"address"}],"name":"connectVirtualPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"nextTick","type":"int24"},{"internalType":"bool","name":"zeroToOne","type":"bool"}],"name":"cross","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"deposits","outputs":[{"internalType":"uint256","name":"L2TokenId","type":"uint256"},{"internalType":"uint32","name":"numberOfFarms","type":"uint32"},{"internalType":"bool","name":"inLimitFarming","type":"bool"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct IIncentiveKey.IncentiveKey","name":"key","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"tokensLocked","type":"uint256"},{"internalType":"bool","name":"isLimit","type":"bool"}],"name":"enterFarming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eternalFarming","outputs":[{"internalType":"contract IAlgebraEternalFarming","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct IIncentiveKey.IncentiveKey","name":"key","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"isLimit","type":"bool"}],"name":"exitFarming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farmingCenterVault","outputs":[{"internalType":"contract IFarmingCenterVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"blockTimestamp","type":"uint32"}],"name":"increaseCumulative","outputs":[{"internalType":"enum IAlgebraVirtualPool.Status","name":"status","type":"uint8"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"l2Nfts","outputs":[{"internalType":"uint96","name":"nonce","type":"uint96"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitFarming","outputs":[{"internalType":"contract IAlgebraLimitFarming","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonfungiblePositionManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundNativeToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWNativeToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"virtualPoolAddresses","outputs":[{"internalType":"address","name":"limitVP","type":"address"},{"internalType":"address","name":"eternalVP","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
contract creation code
Decompile ByteCodeSwitch to Opcodes view
6101606040526001600a553480156200001757600080fd5b50604051620062b0380380620062b08339810160408190526200003a9162000347565b816001600160a01b0316638af3ac856040518163ffffffff1660e01b815260040160206040518083038186803b1580156200007457600080fd5b505afa15801562000089573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000af919062000321565b6040518060400160405280601681526020017f416c6765627261204661726d696e67204e46542d56320000000000000000000081525060405180604001604052806009815260200168414c47422d4641524d60b81b815250604051806040016040528060018152602001601960f91b81525082826200013b6301ffc9a760e01b620001f060201b60201c565b81516200015090600690602085019062000275565b5080516200016690600790602084019062000275565b50620001796380ac58cd60e01b620001f0565b6200018b635b5e139f60e01b620001f0565b6200019d63780e9d6360e01b620001f0565b50508251602093840120608052805192019190912060a052506001600160601b0319606091821b811660c05294811b851660e05292831b84166101005290821b831661012052901b1661014052620003c7565b6001600160e01b0319808216141562000250576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620002ad5760008555620002f8565b82601f10620002c857805160ff1916838001178555620002f8565b82800160010185558215620002f8579182015b82811115620002f8578251825591602001919060010190620002db565b50620003069291506200030a565b5090565b5b808211156200030657600081556001016200030b565b60006020828403121562000333578081fd5b81516200034081620003ae565b9392505050565b600080600080608085870312156200035d578283fd5b84516200036a81620003ae565b60208601519094506200037d81620003ae565b60408601519093506200039081620003ae565b6060860151909250620003a381620003ae565b939692955090935050565b6001600160a01b0381168114620003c457600080fd5b50565b60805160a05160c05160601c60e05160601c6101005160601c6101205160601c6101405160601c615e27620004896000398061101e52806110cb528061156e52806125365280613610525080610ce3528061181a5280612914528061320b525080610ee152806113ca52806119bf5280612d73528061301852806132dc525080610eba52806113a3528061274a5280612d3352806132a75250806102f25280611ac45280611bee528061251252508061162a5250806116095250615e276000f3fe6080604052600436106102d55760003560e01c806369bc35b211610179578063ac9650d8116100d6578063d8a900b11161008a578063e985e9c511610064578063e985e9c51461083f578063fc6f78651461085f578063fd188ca41461087f57610380565b8063d8a900b1146107f7578063de2356d114610817578063df2ab5bb1461082c57610380565b8063b44a2722116100bb578063b44a2722146107a2578063b88d4fde146107b7578063c87b56dd146107d757610380565b8063ac9650d814610752578063b02c43d01461077257610380565b80638af3ac851161012d57806395d89b411161011257806395d89b4114610708578063a22cb4651461071d578063a5f6072f1461073d57610380565b80638af3ac85146106de5780639205ac2e146106f357610380565b806370a082311161015e57806370a082311461067e5780637ac2ff7b1461069e5780637f376059146106b157610380565b806369bc35b2146106565780636c0360eb1461066957610380565b80632f745c59116102325780633c423f0b116101e657806342842e0e116101c057806342842e0e146105f65780634f6ccce7146106165780636352211e1461063657610380565b80633c423f0b146105a05780633e785878146105c057806341865270146105ee57610380565b806332dc5a251161021757806332dc5a251461053d57806334267cbc1461056b5780633644e5151461058b57610380565b80632f745c591461050857806330adf81f1461052857610380565b8063095ea7b31161028957806318160ddd1161026e57806318160ddd146104a657806322872ce2146104c857806323b872dd146104e857610380565b8063095ea7b314610459578063150b7a021461047957610380565b806303a05df9116102ba57806303a05df9146103db57806306fdde031461040a578063081812fc1461042c57610380565b806301342b191461038557806301ffc9a7146103a557610380565b36610380573373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461037e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4e6f7420574e6174697665546f6b656e00000000000000000000000000000000604482015290519081900360640190fd5b005b600080fd5b34801561039157600080fd5b5061037e6103a03660046150c0565b61089f565b3480156103b157600080fd5b506103c56103c036600461500a565b6109c9565b6040516103d29190615688565b60405180910390f35b3480156103e757600080fd5b506103fb6103f636600461526a565b610a04565b6040516103d293929190615a6c565b34801561041657600080fd5b5061041f610a54565b6040516103d29190615729565b34801561043857600080fd5b5061044c61044736600461526a565b610b08565b6040516103d29190615543565b34801561046557600080fd5b5061037e610474366004614ecf565b610b8b565b34801561048557600080fd5b50610499610494366004614d97565b610cc9565b6040516103d2919061569c565b3480156104b257600080fd5b506104bb610e2d565b6040516103d29190615693565b3480156104d457600080fd5b5061037e6104e3366004615223565b610e3e565b3480156104f457600080fd5b5061037e610503366004614d57565b6111cd565b34801561051457600080fd5b506104bb610523366004614ecf565b61123e565b34801561053457600080fd5b506104bb611276565b34801561054957600080fd5b5061055d610558366004614ce7565b61129a565b6040516103d29291906155ad565b34801561057757600080fd5b5061037e6105863660046151e7565b6112d0565b34801561059757600080fd5b506104bb6115e4565b3480156105ac57600080fd5b5061037e6105bb3660046152be565b6116af565b3480156105cc57600080fd5b506105e06105db3660046151bd565b61188e565b6040516103d2929190615a14565b61037e611a55565b34801561060257600080fd5b5061037e610611366004614d57565b611a67565b34801561062257600080fd5b506104bb61063136600461526a565b611a82565b34801561064257600080fd5b5061044c61065136600461526a565b611a98565b61037e61066436600461529a565b611ac0565b34801561067557600080fd5b5061041f611c81565b34801561068a57600080fd5b506104bb610699366004614ce7565b611d00565b61037e6106ac366004614f3b565b611d9c565b3480156106bd57600080fd5b506106d16106cc366004615481565b612343565b6040516103d29190615700565b3480156106ea57600080fd5b5061044c612510565b3480156106ff57600080fd5b5061044c612534565b34801561071457600080fd5b5061041f612558565b34801561072957600080fd5b5061037e610738366004614e9b565b6125d7565b34801561074957600080fd5b5061044c612748565b610765610760366004614f9b565b61276c565b6040516103d2919061560a565b34801561077e57600080fd5b5061079261078d36600461526a565b6128c6565b6040516103d29493929190615a22565b3480156107ae57600080fd5b5061044c612912565b3480156107c357600080fd5b5061037e6107d2366004614e31565b612936565b3480156107e357600080fd5b5061041f6107f236600461526a565b6129ae565b34801561080357600080fd5b5061037e61081236600461504a565b612d1b565b34801561082357600080fd5b5061044c613016565b61037e61083a366004614efa565b61303a565b34801561084b57600080fd5b506103c561085a366004614d1f565b613151565b34801561086b57600080fd5b506105e061087a36600461514c565b61318c565b34801561088b57600080fd5b506104bb61089a36600461505c565b61329a565b336000908152600b602052604090819020805491517f01342b19000000000000000000000000000000000000000000000000000000008152909173ffffffffffffffffffffffffffffffffffffffff16906301342b19906109069086908690600401615714565b600060405180830381600087803b15801561092057600080fd5b505af1158015610934573d6000803e3d6000fd5b50505060018201546040517f01342b1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691506301342b19906109929086908690600401615714565b600060405180830381600087803b1580156109ac57600080fd5b505af11580156109c0573d6000803e3d6000fd5b50505050505050565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526020819052604090205460ff165b919050565b600d60205260009081526040902080546001909101546bffffffffffffffffffffffff8216916c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff169083565b60068054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610afe5780601f10610ad357610100808354040283529160200191610afe565b820191906000526020600020905b815481529060010190602001808311610ae157829003601f168201915b5050505050905090565b6000610b138261330d565b610b52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b499061583e565b60405180910390fd5b506000908152600d60205260409020546c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1690565b6000610b9682611a98565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615da06021913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610c3c61331a565b73ffffffffffffffffffffffffffffffffffffffff161480610c655750610c658161085a61331a565b610cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180615c9b6038913960400191505060405180910390fd5b610cc4838361331e565b505050565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610d3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4990615909565b600a546000858152600c60209081526040808320600180820180547fffffffffffffff0000000000000000000000000000000000000000ffffffffff166501000000000073ffffffffffffffffffffffffffffffffffffffff8e1602179055858255858552600d909352922001869055610db487836133bc565b60018201600a5560405173ffffffffffffffffffffffffffffffffffffffff88169060009088907fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f908390a4507f150b7a0200000000000000000000000000000000000000000000000000000000979650505050505050565b6000610e396002613545565b905090565b6000838152600c602052604090208054610e5790613550565b60018181015463ffffffff811690910190640100000000900460ff1660008415610ede578115610eb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b499061573c565b50600190507f0000000000000000000000000000000000000000000000000000000000000000610f01565b507f00000000000000000000000000000000000000000000000000000000000000005b6001840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff1664010000000084151502177fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff85161790556000610f6b89613593565b905060008273ffffffffffffffffffffffffffffffffffffffff166360777795836040518263ffffffff1660e01b8152600401610fa89190615693565b6101806040518083038186803b158015610fc157600080fd5b505afa158015610fd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff99190615338565b50955050505050506000881115611139576000611015826135c3565b905061104382337f00000000000000000000000000000000000000000000000000000000000000008c613688565b600061104e836135c3565b9050818111611089576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b499061589b565b6040517f2113e8170000000000000000000000000000000000000000000000000000000081528282039a5073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690632113e81790611104908e9088908f906004016159fe565b600060405180830381600087803b15801561111e57600080fd5b505af1158015611132573d6000803e3d6000fd5b5050505050505b6040517ff43930a300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063f43930a39061118f908d908d908d906004016159df565b600060405180830381600087803b1580156111a957600080fd5b505af11580156111bd573d6000803e3d6000fd5b5050505050505050505050505050565b6111de6111d861331a565b8261386d565b611233576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180615dc16031913960400191505060405180910390fd5b610cc4838383613957565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040812061126d9083613b32565b90505b92915050565b7f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad81565b73ffffffffffffffffffffffffffffffffffffffff9081166000908152600b602052604090206001810154905490821692911690565b6000828152600c6020526040902080546112e990613550565b6001810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000811663ffffffff9182167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909116177fffffffffffffff0000000000000000000000000000000000000000ffffffffff16336501000000000002179055600082156113c757506001810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff1690557f00000000000000000000000000000000000000000000000000000000000000006113ea565b507f00000000000000000000000000000000000000000000000000000000000000005b6040517f0705506b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821690630705506b90611440908890889033906004016159a7565b600060405180830381600087803b15801561145a57600080fd5b505af115801561146e573d6000803e3d6000fd5b50505050600061147d86613593565b905060008273ffffffffffffffffffffffffffffffffffffffff166360777795836040518263ffffffff1660e01b81526004016114ba9190615693565b6101806040518083038186803b1580156114d357600080fd5b505afa1580156114e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150b9190615338565b509550505073ffffffffffffffffffffffffffffffffffffffff84161592506109c0915050576040517f92ae44e100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906392ae44e1906115a990849033908b9088906004016155d4565b600060405180830381600087803b1580156115c357600080fd5b505af11580156115d7573d6000803e3d6000fd5b5050505050505050505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611651613b3e565b30604051602001808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405160208183030381529060405280519060200120905090565b73ffffffffffffffffffffffffffffffffffffffff82163014156116ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b49906157d0565b6000838152600c60205260409020805461171881613550565b600182015463ffffffff161561175a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4990615773565b6000818152600d602052604081208181556001015561177881613b42565b6000858152600c602052604080822082815560010180547fffffffffffffff0000000000000000000000000000000000000000000000000016905551339087907fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f908490a46040517fb88d4fde00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b88d4fde9061185590309088908a908990600401615564565b600060405180830381600087803b15801561186f57600080fd5b505af1158015611883573d6000803e3d6000fd5b505050505050505050565b6000818152600c602052604081205481906118a890613550565b60408085015173ffffffffffffffffffffffffffffffffffffffff9081166000908152600b6020529190912054168015611982576040517f7f37605900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821690637f3760599061192e904290600401615a5b565b602060405180830381600087803b15801561194857600080fd5b505af115801561195c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198091906150a1565b505b6040517ffe4282fb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063fe4282fb906119f8908890889033906004016159a7565b6040805180830381600087803b158015611a1157600080fd5b505af1158015611a25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a499190615315565b90969095509350505050565b4715611a6557611a653347613c47565b565b610cc483838360405180602001604052806000815250612936565b600080611a90600284613d95565b509392505050565b600061127082604051806060016040528060298152602001615cfd6029913960029190613db3565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b4957600080fd5b505afa158015611b5d573d6000803e3d6000fd5b505050506040513d6020811015611b7357600080fd5b5051905082811015611be657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f496e73756666696369656e7420574e6174697665546f6b656e00000000000000604482015290519081900360640190fd5b8015610cc4577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611c5f57600080fd5b505af1158015611c73573d6000803e3d6000fd5b50505050610cc48282613c47565b60098054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610afe5780601f10610ad357610100808354040283529160200191610afe565b600073ffffffffffffffffffffffffffffffffffffffff8216611d6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180615cd3602a913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902061127090613545565b83611da5613dca565b1115611e1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5065726d69742065787069726564000000000000000000000000000000000000604482015290519081900360640190fd5b6000611e1c6115e4565b7f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad8888611e4881613dce565b6040805160208082019690965273ffffffffffffffffffffffffffffffffffffffff909416848201526060840192909252608083015260a08083018a90528151808403909101815260c0830182528051908401207f190100000000000000000000000000000000000000000000000000000000000060e084015260e283019490945261010280830194909452805180830390940184526101229091019052815191012090506000611ef887611a98565b90508073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161415611f7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180615c246027913960400191505060405180910390fd5b611f8881613e20565b1561218a576040805160208082018790528183018690527fff0000000000000000000000000000000000000000000000000000000000000060f889901b16606083015282516041818403018152606183018085527f1626ba7e0000000000000000000000000000000000000000000000000000000090526065830186815260858401948552815160a5850152815173ffffffffffffffffffffffffffffffffffffffff871695631626ba7e958995919260c59091019185019080838360005b8381101561205f578181015183820152602001612047565b50505050905090810190601f16801561208c5780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b1580156120aa57600080fd5b505afa1580156120be573d6000803e3d6000fd5b505050506040513d60208110156120d457600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f1626ba7e000000000000000000000000000000000000000000000000000000001461218557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b61232f565b600060018387878760405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156121e6573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811661229357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964207369676e6174757265000000000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461232d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b505b612339888861331e565b5050505050505050565b336000908152600b6020526040808220805491517f7f3760590000000000000000000000000000000000000000000000000000000081529091839173ffffffffffffffffffffffffffffffffffffffff90911690637f376059906123ab908790600401615a5b565b602060405180830381600087803b1580156123c557600080fd5b505af11580156123d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fd91906150a1565b60018301546040517f7f37605900000000000000000000000000000000000000000000000000000000815291925060009173ffffffffffffffffffffffffffffffffffffffff90911690637f3760599061245b908890600401615a5b565b602060405180830381600087803b15801561247557600080fd5b505af1158015612489573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ad91906150a1565b905060018260028111156124bd57fe5b14806124d4575060018160028111156124d257fe5b145b156124e557600193505050506109ff565b60028160028111156124f357fe5b141561250557600293505050506109ff565b506000949350505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60078054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610afe5780601f10610ad357610100808354040283529160200191610afe565b6125df61331a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561267957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b806005600061268661331a565b73ffffffffffffffffffffffffffffffffffffffff90811682526020808301939093526040918201600090812091871680825291909352912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016921515929092179091556126f561331a565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60608167ffffffffffffffff8111801561278557600080fd5b506040519080825280602002602001820160405280156127b957816020015b60608152602001906001900390816127a45790505b50905060005b828110156128bf57600080308686858181106127d757fe5b90506020028101906127e99190615aa8565b6040516127f7929190615533565b600060405180830381855af49150503d8060008114612832576040519150601f19603f3d011682016040523d82523d6000602084013e612837565b606091505b50915091508161289d5760448151101561285057600080fd5b6004810190508080602001905181019061286a91906150e2565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b499190615729565b808484815181106128aa57fe5b602090810291909101015250506001016127bf565b5092915050565b600c602052600090815260409020805460019091015463ffffffff811690640100000000810460ff169065010000000000900473ffffffffffffffffffffffffffffffffffffffff1684565b7f000000000000000000000000000000000000000000000000000000000000000081565b61294761294161331a565b8361386d565b61299c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180615dc16031913960400191505060405180910390fd5b6129a884848484613e26565b50505050565b60606129b98261330d565b612a0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180615d71602f913960400191505060405180910390fd5b60008281526008602090815260408083208054825160026001831615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190921691909104601f810185900485028201850190935282815292909190830182828015612abf5780601f10612a9457610100808354040283529160200191612abf565b820191906000526020600020905b815481529060010190602001808311612aa257829003601f168201915b505050505090506000612ad0611c81565b9050805160001415612ae4575090506109ff565b815115612bff5780826040516020018083805190602001908083835b60208310612b3d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612b00565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905285519190930192850191508083835b60208310612bc157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612b84565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052925050506109ff565b80612c0985613e92565b6040516020018083805190602001908083835b60208310612c5957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612c1c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905285519190930192850191508083835b60208310612cdd57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612ca0565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148080612d9557503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016145b612dcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b49906158d2565b73ffffffffffffffffffffffffffffffffffffffff83166000818152600b6020908152604080832081517ffacb0eb1000000000000000000000000000000000000000000000000000000008152915190948493909263facb0eb19260048083019392829003018186803b158015612e4157600080fd5b505afa158015612e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e799190614d03565b73ffffffffffffffffffffffffffffffffffffffff161415612e9c575082612eff565b73ffffffffffffffffffffffffffffffffffffffff8416612efc5782612edc57600182015473ffffffffffffffffffffffffffffffffffffffff16612ef5565b815473ffffffffffffffffffffffffffffffffffffffff165b9050612eff565b50305b6040517f7c1fe0c800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861690637c1fe0c890612f51908490600401615543565b600060405180830381600087803b158015612f6b57600080fd5b505af1158015612f7f573d6000803e3d6000fd5b505050508215612fd0576001820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861617905561300f565b81547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85161782555b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156130a357600080fd5b505afa1580156130b7573d6000803e3d6000fd5b505050506040513d60208110156130cd57600080fd5b505190508281101561314057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b80156129a8576129a8848383613fbf565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205460ff1690565b80516000908152600c602052604081205481906131a890613550565b602083015173ffffffffffffffffffffffffffffffffffffffff166131ce573060208401525b6040517ffc6f786500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063fc6f786590613240908690600401615940565b6040805180830381600087803b15801561325957600080fd5b505af115801561326d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132919190615315565b91509150915091565b600082156132d1576132ce7f0000000000000000000000000000000000000000000000000000000000000000868686614194565b90505b8115613305576133037f0000000000000000000000000000000000000000000000000000000000000000868685614194565b015b949350505050565b600061127060028361424a565b3390565b6000818152600d6020526040902080546bffffffffffffffffffffffff166c0100000000000000000000000073ffffffffffffffffffffffffffffffffffffffff851690810291909117909155819061337682611a98565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b73ffffffffffffffffffffffffffffffffffffffff821661343e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6134478161330d565b156134b357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6134bf60008383610cc4565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090206134ee9082614256565b506134fb60028284614262565b50604051819073ffffffffffffffffffffffffffffffffffffffff8416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600061127082614285565b61355a338261386d565b613590576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4990615807565b50565b6000816040516020016135a69190615999565b604051602081830303815290604052805190602001209050919050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190613638907f000000000000000000000000000000000000000000000000000000000000000090600401615543565b60206040518083038186803b15801561365057600080fd5b505afa158015613664573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112709190615282565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b6020831061376557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613728565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146137c7576040519150601f19603f3d011682016040523d82523d6000602084013e6137cc565b606091505b50915091508180156137fa5750805115806137fa57508080602001905160208110156137f757600080fd5b50515b61386557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b505050505050565b60006138788261330d565b6138cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180615c6f602c913960400191505060405180910390fd5b60006138d883611a98565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061394757508373ffffffffffffffffffffffffffffffffffffffff1661392f84610b08565b73ffffffffffffffffffffffffffffffffffffffff16145b8061330557506133058185613151565b8273ffffffffffffffffffffffffffffffffffffffff1661397782611a98565b73ffffffffffffffffffffffffffffffffffffffff16146139e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180615d486029913960400191505060405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216613a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180615c4b6024913960400191505060405180910390fd5b613a5a838383610cc4565b613a6560008261331e565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260409020613a949082614289565b5073ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020613ac49082614256565b50613ad160028284614262565b50808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600061126d8383614295565b4690565b6000613b4d82611a98565b9050613b5b81600084610cc4565b613b6660008361331e565b60008281526008602052604090205460027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600184161502019091160415613bc2576000828152600860205260408120613bc291614b7f565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020613bf19083614289565b50613bfd600283614313565b50604051829060009073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b60208310613cbe57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613c81565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613d20576040519150601f19603f3d011682016040523d82523d6000602084013e613d25565b606091505b5050905080610cc457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000808080613da4868661431f565b909450925050505b9250929050565b6000613dc08484846143b4565b90505b9392505050565b4290565b6000908152600d6020526040902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000811660016bffffffffffffffffffffffff9283169081019092161790915590565b3b151590565b613e31848484613957565b613e3d84848484614498565b6129a8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180615bf26032913960400191505060405180910390fd5b606081613ed3575060408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201526109ff565b8160005b8115613eeb57600101600a82049150613ed7565b60008167ffffffffffffffff81118015613f0457600080fd5b506040519080825280601f01601f191660200182016040528015613f2f576020820181803683370190505b5085935090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b8315613fb657600a840660300160f81b82828060019003935081518110613f7c57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84049350613f59565b50949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b6020831061409457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101614057565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146140f6576040519150601f19603f3d011682016040523d82523d6000602084013e6140fb565b606091505b5091509150818015614129575080511580614129575080806020019051602081101561412657600080fd5b50515b61300f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6040517f0a53075400000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff861690630a530754906141ef9087903390889088906004016156c9565b602060405180830381600087803b15801561420957600080fd5b505af115801561421d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142419190615282565b95945050505050565b600061126d83836146a8565b600061126d83836146c0565b6000613dc0848473ffffffffffffffffffffffffffffffffffffffff851661470a565b5490565b600061126d83836147a1565b815460009082106142f1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615bd06022913960400191505060405180910390fd5b82600001828154811061430057fe5b9060005260206000200154905092915050565b600061126d8383614885565b81546000908190831061437d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615d266022913960400191505060405180910390fd5b600084600001848154811061438e57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281614469576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561442e578181015183820152602001614416565b50505050905090810190601f16801561445b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061447c57fe5b9060005260206000209060020201600101549150509392505050565b60006144b98473ffffffffffffffffffffffffffffffffffffffff16613e20565b6144c557506001613305565b600061463d7f150b7a02000000000000000000000000000000000000000000000000000000006144f361331a565b888787604051602401808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561457457818101518382015260200161455c565b50505050905090810190601f1680156145a15780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001615bf26032913973ffffffffffffffffffffffffffffffffffffffff88169190614995565b9050600081806020019051602081101561465657600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001492505050949350505050565b60009081526001919091016020526040902054151590565b60006146cc83836146a8565b61470257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611270565b506000611270565b60008281526001840160205260408120548061476f575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055613dc3565b8285600001600183038154811061478257fe5b9060005260206000209060020201600101819055506000915050613dc3565b6000818152600183016020526040812054801561487b5783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80830191908101906000908790839081106147f257fe5b906000526020600020015490508087600001848154811061480f57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061483f57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611270565b6000915050611270565b6000818152600183016020526040812054801561487b5783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80830191908101906000908790839081106148d657fe5b90600052602060002090600202019050808760000184815481106148f657fe5b60009182526020808320845460029093020191825560019384015491840191909155835482528983019052604090209084019055865487908061493557fe5b6000828152602080822060027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90940193840201828155600190810183905592909355888152898201909252604082209190915594506112709350505050565b6060613dc08484600085856149a985613e20565b614a1457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310614a7d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101614a40565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614adf576040519150601f19603f3d011682016040523d82523d6000602084013e614ae4565b606091505b5091509150614af4828286614aff565b979650505050505050565b60608315614b0e575081613dc3565b825115614b1e5782518084602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815284516024840152845185939192839260440191908501908083836000831561442e578181015183820152602001614416565b50805460018160011615610100020316600290046000825580601f10614ba55750613590565b601f01602090049060005260206000209081019061359091905b80821115614bd35760008155600101614bbf565b5090565b803580151581146109ff57600080fd5b600082601f830112614bf7578081fd5b8135614c0a614c0582615b2f565b615b0b565b818152846020838601011115614c1e578283fd5b816020850160208301379081016020019190915292915050565b600060a08284031215614c49578081fd5b60405160a0810181811067ffffffffffffffff82111715614c6657fe5b6040529050808235614c7781615b9b565b81526020830135614c8781615b9b565b60208201526040830135614c9a81615b9b565b8060408301525060608301356060820152608083013560808201525092915050565b80356fffffffffffffffffffffffffffffffff811681146109ff57600080fd5b80516109ff81615bbd565b600060208284031215614cf8578081fd5b8135613dc381615b9b565b600060208284031215614d14578081fd5b8151613dc381615b9b565b60008060408385031215614d31578081fd5b8235614d3c81615b9b565b91506020830135614d4c81615b9b565b809150509250929050565b600080600060608486031215614d6b578081fd5b8335614d7681615b9b565b92506020840135614d8681615b9b565b929592945050506040919091013590565b600080600080600060808688031215614dae578283fd5b8535614db981615b9b565b94506020860135614dc981615b9b565b935060408601359250606086013567ffffffffffffffff80821115614dec578283fd5b818801915088601f830112614dff578283fd5b813581811115614e0d578384fd5b896020828501011115614e1e578384fd5b9699959850939650602001949392505050565b60008060008060808587031215614e46578182fd5b8435614e5181615b9b565b93506020850135614e6181615b9b565b925060408501359150606085013567ffffffffffffffff811115614e83578182fd5b614e8f87828801614be7565b91505092959194509250565b60008060408385031215614ead578182fd5b8235614eb881615b9b565b9150614ec660208401614bd7565b90509250929050565b60008060408385031215614ee1578182fd5b8235614eec81615b9b565b946020939093013593505050565b600080600060608486031215614f0e578081fd5b8335614f1981615b9b565b9250602084013591506040840135614f3081615b9b565b809150509250925092565b60008060008060008060c08789031215614f53578384fd5b8635614f5e81615b9b565b95506020870135945060408701359350606087013560ff81168114614f81578182fd5b9598949750929560808101359460a0909101359350915050565b60008060208385031215614fad578182fd5b823567ffffffffffffffff80821115614fc4578384fd5b818501915085601f830112614fd7578384fd5b813581811115614fe5578485fd5b8660208083028501011115614ff8578485fd5b60209290920196919550909350505050565b60006020828403121561501b578081fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114613dc3578182fd5b60008060408385031215614d31578182fd5b60008060008060808587031215615071578182fd5b843561507c81615b9b565b9350602085013561508c81615b9b565b93969395505050506040820135916060013590565b6000602082840312156150b2578081fd5b815160038110613dc3578182fd5b600080604083850312156150d2578182fd5b82358060020b8114614eb8578283fd5b6000602082840312156150f3578081fd5b815167ffffffffffffffff811115615109578182fd5b8201601f81018413615119578182fd5b8051615127614c0582615b2f565b81815285602083850101111561513b578384fd5b614241826020830160208601615b6f565b60006080828403121561515d578081fd5b6040516080810181811067ffffffffffffffff8211171561517a57fe5b60405282358152602083013561518f81615b9b565b60208201526151a060408401614cbc565b60408201526151b160608401614cbc565b60608201529392505050565b60008060c083850312156151cf578182fd5b6151d98484614c38565b9460a0939093013593505050565b600080600060e084860312156151fb578081fd5b6152058585614c38565b925060a0840135915061521a60c08501614bd7565b90509250925092565b6000806000806101008587031215615239578182fd5b6152438686614c38565b935060a0850135925060c0850135915061525f60e08601614bd7565b905092959194509250565b60006020828403121561527b578081fd5b5035919050565b600060208284031215615293578081fd5b5051919050565b600080604083850312156152ac578182fd5b823591506020830135614d4c81615b9b565b6000806000606084860312156152d2578081fd5b8335925060208401356152e481615b9b565b9150604084013567ffffffffffffffff8111156152ff578182fd5b61530b86828701614be7565b9150509250925092565b60008060408385031215615327578182fd5b505080516020909101519092909150565b6000806000806000806000878903610180811215615354578586fd5b8851975060208901519650604089015161536d81615b9b565b60608a015190965062ffffff81168114615385578283fd5b60808a01519095507bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146153b6578283fd5b60a08a01519094506153c781615b9b565b925060c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff40820112156153f8578182fd5b5060405160c0810181811067ffffffffffffffff8211171561541657fe5b806040525060c0890151815260e08901516020820152610100890151604082015261012089015161544681615bbd565b606082015261014089015161545a81615bbd565b608082015261546c6101608a01614cdc565b60a08201528091505092959891949750929550565b600060208284031215615492578081fd5b8135613dc381615bbd565b600081518084526154b5816020860160208601615b6f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8082511683528060208301511660208401528060408301511660408401525060608101516060830152608081015160808301525050565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250836040830152608060608301526155a3608083018461549d565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff94851681529290931660208301526040820152606081019190915260800190565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561567b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261566985835161549d565b9450928501929085019060010161562f565b5092979650505050505050565b901515815260200190565b90815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9485168152928416602084015292166040820152606081019190915260800190565b602081016003831061570e57fe5b91905290565b60029290920b82521515602082015260400190565b60006020825261126d602083018461549d565b60208082526014908201527f746f6b656e20616c7265616479206661726d6564000000000000000000000000604082015260600190565b60208082526021908201527f63616e6e6f7420776974686472617720746f6b656e207768696c65206661726d60408201527f6400000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601a908201527f63616e6e6f7420776974686472617720746f206661726d696e67000000000000604082015260600190565b6020808252600c908201527f4e6f7420617070726f7665640000000000000000000000000000000000000000604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201527f697374656e7420746f6b656e0000000000000000000000000000000000000000606082015260800190565b6020808252601a908201527f496e73756666696369656e7420746f6b656e73206c6f636b6564000000000000604082015260600190565b6020808252601a908201527f6f6e6c79206661726d696e672063616e2063616c6c2074686973000000000000604082015260600190565b60208082526012908201527f6e6f7420616e20416c6765627261206e66740000000000000000000000000000604082015260600190565b8151815260208083015173ffffffffffffffffffffffffffffffffffffffff16908201526040808301516fffffffffffffffffffffffffffffffff90811691830191909152606092830151169181019190915260800190565b60a0810161127082846154e7565b60e081016159b582866154e7565b8360a083015273ffffffffffffffffffffffffffffffffffffffff831660c0830152949350505050565b60e081016159ed82866154e7565b60a082019390935260c00152919050565b9283526020830191909152604082015260600190565b918252602082015260400190565b93845263ffffffff9290921660208401521515604083015273ffffffffffffffffffffffffffffffffffffffff16606082015260800190565b63ffffffff91909116815260200190565b6bffffffffffffffffffffffff93909316835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112615adc578283fd5b83018035915067ffffffffffffffff821115615af6578283fd5b602001915036819003821315613dac57600080fd5b60405181810167ffffffffffffffff81118282101715615b2757fe5b604052919050565b600067ffffffffffffffff821115615b4357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015615b8a578181015183820152602001615b72565b838111156129a85750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461359057600080fd5b63ffffffff8116811461359057600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732315065726d69743a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212206f56cf8331ee4262eef743dc90c51d3b1cfa1cd0ab2c46d49e8eb85d670b2dbd64736f6c634300070600330000000000000000000000009923f42a02a82da63ee0dbbc5f8e311e3dd8a1f80000000000000000000000008a26436e41d0b5fc4c6ed36c1976fafbe173444e0000000000000000000000008ef88e4c7cfbbac1c163f7eddd4b578792201de6000000000000000000000000347e0544b7ac8656c8727f4ee8e2b7e644b85c17
Constructor arguments(ABI Encoding and are the last bytes of the Contract Creation Code above)
0000000000000000000000009923f42a02a82da63ee0dbbc5f8e311e3dd8a1f80000000000000000000000008a26436e41d0b5fc4c6ed36c1976fafbe173444e0000000000000000000000008ef88e4c7cfbbac1c163f7eddd4b578792201de6000000000000000000000000347e0544b7ac8656c8727f4ee8e2b7e644b85c17-----Decoded Preview------
Arg[0] : _limitFarming(Adresse):0x9923f42a02a82da63ee0dbbc5f8e311e3dd8a1f8
Arg[1] : _eternalFarming(Address):0x8a26436e41d0b5fc4c6ed36c1976fafbe173444e
Arg[2] : _nonfungiblePositionManager(address):0x8ef88e4c7cfbbac1c163f7eddd4b578792201de6
Arg[3] : _farmingCenterVault(Address):0x347e0544b7ac8656c8727f4ee8e2b7e644b85c17-----Encoded View---------------
4 found constructor arguments:
Arg[0]: 0000000000000000000000009923f42a02a82da63ee0dbbc5f8e311e3dd8a1f8
Arg [1]: 000000000000000000000008a26436e41d0b5fc4c6ed36c1976fafbe173444e
Arg [2]: 0000000000000000000000008ef88e4c7cfbbac1c163f7eddd4b578792201de6
Arg [3]: 00000000000000000000000347e0544b7ac8656c8727f4ee8e2b7e644b85c17