Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21223552 | 85 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
GainLendingPool
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import { IERC20, LendingPool } from "../LendingPool.sol"; import { IGainAdapter } from "./interfaces/IGainAdapter.sol"; import "./Errors.sol"; /** * @title Represents a lending pool that is fully compliant with the ERC-4626 standard. * @dev The lending pool is an address-preserving transparent proxy. */ contract GainLendingPool is LendingPool { uint256 constant private _SECONDS_PER_YEAR = 60 * 60 * 24 * 365; /// @notice The address of the vault adapter. IGainAdapter public gainAdapter; /// @notice The management fee. This is a percentage with 2 decimal places. uint256 public managementFeePercent; /// @notice The last time we charged management fees. uint256 public managementFeeLastKnownTimestamp; /** * @notice This event is triggered when the adapter reserves a deposit. * @param account The account that made the deposit. * @param shares The amount of shares sent to the receiving address. * @param assets The amount of assets reserved for the receiving address. */ event ReserveDeposit(address account, uint256 shares, uint256 assets); /** * @notice Set the gain adapter. * @param _gainAdapter The address of the gain adapter. * @dev This function can only be called once. */ function setGainAdapter(address _gainAdapter) external nonReentrant ifNotConfigured onlyOwner { if (address(_gainAdapter) == address(0)) { revert Errors.ZeroAddress(); } gainAdapter = IGainAdapter(_gainAdapter); /// Initialize Last Known Management Fee Timestamp at time Gain Adapter is set managementFeeLastKnownTimestamp = block.timestamp; } /** * @notice Reserve a deposit via the Kelp Adapter. * @param account The account to reserve the deposit fors. * @param amountInETH The amount to reserve in ETH. */ function reserveDeposit(address account, uint256 amountInETH) external nonReentrant ifConfigured ifDepositsNotPaused { if (msg.sender != address(gainAdapter)) { revert Errors.Unauthorized(); } if (amountInETH == 0) { revert Errors.ZeroAmount(); } uint256 assets = gainAdapter.getRsETHValueFromETHAmount(amountInETH); uint256 shares = previewDeposit(assets); // Issue (mint) LP tokens to the receiver _mintErc20(account, shares); emit ReserveDeposit(account, shares, assets); } function processWithdrawal(address account, uint256 shares) external nonReentrant ifConfigured ifWithdrawalsNotPaused { if (msg.sender != address(gainAdapter) || msg.sender == account) { revert Errors.Unauthorized(); } if (isBlacklisted[msg.sender] || isBlacklisted[account]) { revert Errors.Blacklisted(); } (, uint256 year, uint256 month, uint256 day, uint256 assets) = _registerRedeemRequest(shares, account, account, msg.sender); // Emit the event emit WithdrawalRequested(msg.sender, account, shares, assets, 0, year, month, day); } /** * @notice Charges the management fee. */ function chargeManagementFee() external nonReentrant ifConfigured onlyOwner { uint256 applicableManagementFee = calculateManagementFee(managementFeeLastKnownTimestamp, block.timestamp); if (applicableManagementFee == 0) revert Errors.ManagementFeeIsZero(); managementFeeLastKnownTimestamp = block.timestamp; totalCollectableFees += applicableManagementFee; } /** * @notice Updates the management fee. * @param newManagementFeePercent The management fee. This is a percentage with 2 decimal places. */ function updateManagementFee(uint256 newManagementFeePercent) external nonReentrant ifConfigured onlyOwner { managementFeePercent = newManagementFeePercent; } /** * @notice Calculates the management fee. * @param fromTimestamp The start date * @param toTimestamp The end date * @return uint256 The applicable management fee. */ function calculateManagementFee(uint256 fromTimestamp, uint256 toTimestamp) public view returns (uint256) { return (_getTotalAssets() * managementFeePercent * (toTimestamp - fromTimestamp)) / _SECONDS_PER_YEAR / 10000; } /** * @notice Gets the total assets amount managed by the pool. * @return uint256 The assets amount. */ function totalAssets() external view override returns (uint256) { return _getTotalAssets(); } // In GainLendingPool.sol function _getTotalAssets() internal view override returns (uint256) { uint256 baseAssets = super._getTotalAssets(); // This calls HookableLender's implementation uint256 ethReservedAmount = gainAdapter.getEthReservedAmount(address(this)); uint256 rsETHReservedAmount = gainAdapter.getRsETHValueFromETHAmount(ethReservedAmount); return baseAssets + rsETHReservedAmount; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../core/interfaces/ITimelockedCall.sol"; import "./base/BaseLendingPool.sol"; /** * @title Represents a lending pool that is fully compliant with the ERC-4626 standard. * @dev The lending pool is an address-preserving transparent proxy. */ contract LendingPool is BaseLendingPool { /// @notice The address of the scheduler contract. This contract handles time-locked calls. address public scheduledCallerAddress; constructor() { _disableInitializers(); } /** * @notice Proxy initialization function. * @param newOwner The owner of the lending pool. * @param erc20Decimals The number of decimals of the LP token issued by this pool, per ERC20. * @param erc20Symbol The token symbol of this pool, per ERC20. * @param erc20Name The token name of this pool, per ERC20. */ function initialize( address newOwner, uint8 erc20Decimals, string memory erc20Symbol, string memory erc20Name ) external initializer { if (newOwner == address(0)) revert PoolOwnerRequired(); // ERC-20 settings decimals = erc20Decimals; symbol = erc20Symbol; name = erc20Name; // Pause deposits and withdrawals until the pool gets configured by the authorized party. depositsPaused = true; withdrawalsPaused = true; _owner = newOwner; } /** * @notice Configures the lending pool. * @dev Throws if the caller is not the owner. Deposits and withdrawals are paused until the pool is configured. * @param newLagDuration The duration of the timelock. Pass zero if the pool is not time-locked. * @param newMaxDepositAmount The maximum deposit amount of assets (say USDC) investors are allowed to deposit in the pool. * @param newMaxWithdrawalAmount The maximum withdrawal amount of the pool, expressed in underlying assets (for example: USDC) * @param newMaxTokenSupply The maximum supply of LP tokens (liquidity pool tokens) * @param newUnderlyingAsset The underlying asset of the liquidity pool (for example: USDC). * @param newLoansOperator The address responsible for managing the loans of the pool. * @param newLoansDeployerAddress The address of the smart contract you will use for deploying loans on behalf of this pool. * @param newFeesCollectorAddr The address of the fees collector. * @param newScheduledCallerAddress The address of the contract that handles time-locked function calls. * @param newProcessingHour The hour (UTC) at which all withdrawal requests will be processed. The value ranges from [0..23] */ function configurePool( uint256 newLagDuration, uint256 newMaxDepositAmount, uint256 newMaxWithdrawalAmount, uint256 newMaxTokenSupply, address newUnderlyingAsset, address newLoansOperator, address newLoansDeployerAddress, address newFeesCollectorAddr, address newScheduledCallerAddress, uint8 newProcessingHour ) external nonReentrant ifNotConfigured onlyOwner { if (newLoansOperator == address(0)) revert OperatorRequired(); if (newLoansDeployerAddress == address(0)) revert DeployerRequired(); if (newFeesCollectorAddr == address(0)) revert CollectorRequired(); if (newProcessingHour >= 24) revert InvalidProcessingHour(); // Min: 0, Max: 23 (eg: 13 = 1PM) _underlyingAsset = IERC20(newUnderlyingAsset); _updateIssuanceLimits(newMaxDepositAmount, newMaxWithdrawalAmount, newMaxTokenSupply); // Loan management actors loansOperator = newLoansOperator; loansDeployerAddress = newLoansDeployerAddress; feesCollector = newFeesCollectorAddr; // Timelock settings lagDuration = newLagDuration; liquidationHour = newProcessingHour; // Resume deposits and withdrawals depositsPaused = false; withdrawalsPaused = false; scheduledCallerAddress = newScheduledCallerAddress; // Set the initial scheduler and duration for time-locked function calls ITimelockedCall(newScheduledCallerAddress).initScheduler(_owner, 24 hours); } /** * @notice Transfers ownership of the contract to a new account. * @dev Throws if the tx was not scheduled by the original owner. Also fails if the time-lock is still in place. * @param newOwner The new owner of this contract. */ function transferOwnership(address newOwner) external nonReentrant onlyOwner { // Checks if (newOwner == address(0) || newOwner == address(this)) revert InvalidOwner(); if (newOwner == loansOperator) revert OwnerCannotBeOperator(); if (newOwner == loansDeployerAddress) revert OwnerCannotBeDeployer(); if (isBlacklisted[newOwner]) revert AddressBlacklisted(); // State changes address prevOwnerAddr = _owner; _transferOwnership(newOwner); // Attempt to consume the time-locked hash. The call reverts if the hash can't be consumed. bytes32 h = keccak256(abi.encode( abi.encodeWithSignature( "transferOwnership(address)", newOwner ) )); // This is a special case for consuming a hash. It rotates the scheduler in a single call. ITimelockedCall(scheduledCallerAddress).consumeOwnership(h, prevOwnerAddr, newOwner); } /** * @notice Updates the issuance and redemption settings of the pool. * @dev Throws if the caller is not the owner of the pool. Throws if the pool was not configured. * @param newMaxDepositAmount The maximum deposit amount of assets (say USDC) investors are allowed to deposit in the pool. * @param newMaxWithdrawalAmount The maximum withdrawal amount of the pool, expressed in underlying assets (for example: USDC) * @param newMaxTokenSupply The maximum supply of LP tokens (liquidity pool tokens) */ function updateIssuanceLimits( uint256 newMaxDepositAmount, uint256 newMaxWithdrawalAmount, uint256 newMaxTokenSupply ) external nonReentrant ifConfigured onlyOwner { _updateIssuanceLimits(newMaxDepositAmount, newMaxWithdrawalAmount, newMaxTokenSupply); } /** * @notice Pauses/Resumes deposits and/or withdrawals. * @dev Throws if the caller is not the owner of the pool. * @param bPauseDeposits Pass "true" to pause deposits. Pass "false" to resume deposits. * @param bPauseWithdrawals Pass "true" to pause withdrawals. Pass "false" to resume withdrawals. */ function pauseDepositsAndWithdrawals(bool bPauseDeposits, bool bPauseWithdrawals) external nonReentrant ifConfigured onlyOwner { _setPause(bPauseDeposits, bPauseWithdrawals); } /** * @notice Updates the duration of the timelock. * @dev Setting the timelock to zero will allow to withdraw funds immediately from the pool. * @param newDuration The duration of the timelock, expressed in seconds. It can be zero. */ function updateTimelockDuration(uint256 newDuration) external nonReentrant ifConfigured onlyOwner { if (newDuration <= lagDuration) { if (globalLiabilityShares != 0) revert ProcessClaimsFirst(); } lagDuration = newDuration; // Build the hash of this call and attempt to consume it. The call reverts if the hash can't be consumed. bytes32 h = keccak256(abi.encode( abi.encodeWithSignature( "updateTimelockDuration(uint256)", newDuration ) )); ITimelockedCall(scheduledCallerAddress).consume(h); } /** * @notice Updates the fee for withdrawals. * @param newWithdrawalFee The new fee, expressed with 2 decimal places. */ function updateWithdrawalFee(uint256 newWithdrawalFee) external nonReentrant ifConfigured onlyOwner { if (newWithdrawalFee >= 9900) revert FeeTooHigh(); withdrawalFee = newWithdrawalFee; } /** * @notice Blacklists the address specified. * @param addr The address to blacklist */ function addToBlacklist(address addr) external nonReentrant ifConfigured onlyOwner { if (addr == _owner) revert CannotBlacklistOwner(); isBlacklisted[addr] = true; } /** * @notice Removes the address specified from the blacklist. * @param addr The address to remove from the blacklist */ function removeFromBlacklist(address addr) external nonReentrant ifConfigured onlyOwner { isBlacklisted[addr] = false; } /** * @notice Sets the address of the settlement account. * @param addr The address of the settlement account. */ function updateSettlementAccount(address addr) external nonReentrant ifConfigured onlyOwner { if (addr == address(0)) revert InvalidAddress(); settlementAccount = addr; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; interface IGainAdapter { // errors error AssetAlreadyWhitelisted(); error AssetOracleNotSupported(); error EthReservedIsZero(); error EthReservedLimitReached(); error InsufficientAssetBalance(); error InsufficientETHBalance(); error InsufficientRsETHBalance(); error InvalidAmount(); error InvalidAssetValueInETH(); error InvalidMsgValue(); error InvalidMinRSETHAmountExpected(); error InvalidPriceOracle(); error NotEnoughETHReserved(); error OnlyWhitelistedAsset(); error OnlyWhitelistedVault(); error UnsupportedAssetForOracle(); error UnsupportedAssetForSwap(); error VaultAlreadyWhitelisted(); // events event AdapterETHDeposit(address indexed depositor, uint256 amount, address indexed vault, string referralId); event AdapterAssetDeposit( address indexed asset, address indexed depositor, uint256 amount, uint256 assetValueInETH, address indexed vault, string referralId ); event AdapterWithdrawal(address indexed withdrawer, address indexed vault, uint256 amount, string referralId); event RsETHSentToVault(address indexed vault, uint256 amount); event OperatorAssetSwapped(address indexed asset, uint256 amount, uint256 assetValueInETH); event WhitelistedAssetAdded(address indexed asset); event WhitelistedAssetRemoved(address indexed asset); event WhitelistedVaultAdded(address indexed vault); event WhitelistedVaultRemoved(address indexed vault); event SupportedOracleUpdated(address indexed asset, address indexed oracle); event SupportedOracleRemoved(address indexed asset); event EthReservedLimitUpdated(address indexed vault, uint256 newLimit); // functions function depositETH(address vault, string calldata referralId) external payable; function depositAsset(address asset, uint256 amount, address vault, string calldata referralId) external; function withdraw(address vault, uint256 amount, string calldata referralId) external; function sendRsETHToVault(address vault, uint256 amount) external; function mintRsETH(address asset, uint256 depositAmount) external payable; function swapAssetForETH(address asset, uint256 amount) external payable; function addWhitelistedAsset(address asset) external; function removeWhitelistedAsset(address asset) external; function addWhitelistedVault(address vault) external; function removeWhitelistedVault(address vault) external; function updateSupportedPriceOracle(address asset, address priceOracle) external; function removeSupportedPriceOracle(address asset) external; function updateEthReservedLimit(address vault, uint256 newLimit) external; function getAssetPrice(address asset) external view returns (uint256); function getRsETHPrice() external view returns (uint256); function getAssetValueInETH(address asset, uint256 amount) external view returns (uint256); function getETHValueFromRsETHAmount(uint256 amount) external view returns (uint256); function getRsETHValueFromETHAmount(uint256 amount) external view returns (uint256); function getIsWhitelistedAsset(address asset) external view returns (bool); function getIsWhitelistedVault(address vault) external view returns (bool); function getAssetPriceOracle(address asset) external view returns (address); function getEthReservedAmount(address vault) external view returns (uint256); function getEthReservedLimit(address vault) external view returns (uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; library Errors { error Blacklisted(); error ZeroAddress(); error ZeroAmount(); error Unauthorized(); error ManagementFeeIsZero(); error ValueNotSet(); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; interface ITimelockedCall { function initScheduler(address addr, uint256 newTimeLockDuration) external; function enableScheduler(address addr) external; function disableScheduler(address addr) external; function schedule(bytes32 h, address consumerAddr) external; function consume(bytes32 h) external; function consumeOwnership(bytes32 h, address prevOwnerAddr, address newOwnerAddr) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../loans/interfaces/IPermissionlessLoansDeployer.sol"; import "./HookableLender.sol"; /** * @title Represents a base lending pool. * @dev The pool is capable of deploying and funding loans on their own. It is also capable of receiving hooks on-chain. */ abstract contract BaseLendingPool is HookableLender { /// @notice The address of the contract that deploys loans. address public loansDeployerAddress; /// @notice The list of all loans deployed by the lending pool address[] public loansDeployed; /// @notice Triggers when the lending pool deploys a new loan. event NewLoanDeployedByPool(address loanAddr, uint256 aprWithTwoDecimals); /** * @notice Deploys a new loan on behalf of the Credit Pool. This contract acts as a lender. * @param loanParams The parameters of the loan to deploy. * @return address The address of the newly deployed loan. */ function deployLoan( LoanDeploymentParams memory loanParams ) external nonReentrant ifConfigured onlyLoansOperator returns (address) { loanParams.lenderAddr = address(this); address loanAddr = IPermissionlessLoansDeployer(loansDeployerAddress).deployLoan(loanParams); // This should never happen because the loan was deployed via CREATE rather than CREATE2 if (_deployedLoans[loanAddr].isWhitelisted) revert InvalidDeploymentAddress(); uint256 effectiveLoanAmount = IPeerToPeerOpenTermLoan(loanAddr).effectiveLoanAmount(); _deployedLoans[loanAddr] = LoanDeploymentRecord({ effectiveLoanAmount: effectiveLoanAmount, activeDelta: 0, isWhitelisted: true }); loansDeployed.push(loanAddr); emit NewLoanDeployedByPool(loanAddr, loanParams.newAprWithTwoDecimals); return loanAddr; } /** * @notice Funds the loan deployed at the address specified. * @dev Throws if the loan was not deployed by this pool. * @param loanAddr The address of the loan. */ function fundLoan(address loanAddr) external override nonReentrant ifConfigured onlyLoansOperator { // Trusted queries _ensureValidLoan(loanAddr); uint256 effectiveLoanAmount = _deployedLoans[loanAddr].effectiveLoanAmount; // Trusted changes _deployedLoans[loanAddr].activeDelta = effectiveLoanAmount; // The principal repaid at this point in time is zero globalLoansAmount += effectiveLoanAmount; // which is "_deployedLoans[loanAddr].activeDelta" if (IPeerToPeerOpenTermLoan(loanAddr).loanState() != LOAN_FUNDING_REQUIRED) revert InvalidLoanState(); // Untrusted changes SafeERC20.safeApprove(_underlyingAsset, loanAddr, effectiveLoanAmount); IPeerToPeerOpenTermLoan(loanAddr).fundLoan(); SafeERC20.safeApprove(_underlyingAsset, loanAddr, uint256(0)); // Late checks if (IPeerToPeerOpenTermLoan(loanAddr).loanState() != LOAN_ACTIVE) revert FundingCheckFailed(); if (_underlyingAsset.allowance(address(this), loanAddr) > uint256(0)) revert AllowanceCheckFailed(); } /** * @notice Collects the fees available in the pool. Fees are sent to the fee collector address. */ function collectFees() external nonReentrant ifConfigured onlyOwner { uint256 feesAmount = totalCollectableFees; totalCollectableFees = 0; SafeERC20.safeTransfer(_underlyingAsset, feesCollector, feesAmount); } /** * @notice Gets the total number of loans deployed by the pool. * @return uint256 The total number of loans deployed by the pool. */ function getTotalLoansDeployed() external view returns (uint256) { return loansDeployed.length; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../structs/Types.sol"; interface IPermissionlessLoansDeployer { /** * @notice Triggers when a new loan is deployed. * @param loanAddr The address of the newly deployed loan. * @param lenderAddr The lender. * @param borrowerAddr The borrower. */ event PermissionlessLoanDeployed(address indexed loanAddr, address indexed lenderAddr, address indexed borrowerAddr); function deployLoan(LoanDeploymentParams calldata loanParams) external returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../loans/interfaces/IHookableLender.sol"; import "./AbstractLender.sol"; /** * @title Represents an ERC-4626 lending pool capable of processing hooks on-chain. * @dev This contract overrides ERC4626.totalAssets() in order to reflect the risk exposure to loans. */ abstract contract HookableLender is IHookableLender, AbstractLender { struct LoanDeploymentRecord { uint256 effectiveLoanAmount; uint256 activeDelta; bool isWhitelisted; } // --------------------------------------------------------------- // Storage layout // --------------------------------------------------------------- /// @notice The current risk exposure to loans uint256 public globalLoansAmount; /// @dev The current delta of a loan mapping (address => LoanDeploymentRecord) internal _deployedLoans; // --------------------------------------------------------------- // Modifiers // --------------------------------------------------------------- modifier onlyKnownLoanContract() { if (!_deployedLoans[msg.sender].isWhitelisted) revert UnknownLoan(); _; } // --------------------------------------------------------------- // Hooks implementation // --------------------------------------------------------------- function notifyLoanMatured() external override nonReentrant ifConfigured onlyKnownLoanContract { if (_deployedLoans[msg.sender].activeDelta > 0) globalLoansAmount -= _deployedLoans[msg.sender].activeDelta; _deployedLoans[msg.sender].activeDelta = 0; } function notifyLoanClosed() external override nonReentrant ifConfigured onlyKnownLoanContract { if (_deployedLoans[msg.sender].activeDelta > 0) globalLoansAmount -= _deployedLoans[msg.sender].activeDelta; _deployedLoans[msg.sender].activeDelta = 0; } function notifyPrincipalRepayment( uint256 effectiveLoanAmount, uint256 principalRepaid ) external override nonReentrant ifConfigured onlyKnownLoanContract { uint256 newDelta = (principalRepaid < effectiveLoanAmount) ? effectiveLoanAmount - principalRepaid : 0; if (_deployedLoans[msg.sender].activeDelta > 0) globalLoansAmount -= _deployedLoans[msg.sender].activeDelta; _deployedLoans[msg.sender].activeDelta = newDelta; if (newDelta > 0) globalLoansAmount += newDelta; } function _ensureValidLoan(address loanAddr) internal view override { if (!_deployedLoans[loanAddr].isWhitelisted) revert UnknownLoan(); } // --------------------------------------------------------------- // ERC-4626 overrides // --------------------------------------------------------------- function _getTotalAssets() internal view virtual override returns (uint256) { // [Liquidity] + [the delta of all ACTIVE loans managed by this pool] return globalLoansAmount + _underlyingAsset.balanceOf(address(this)); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; struct LoanDeploymentParams { uint256 fundingPeriodInSeconds; uint256 newPaymentIntervalInSeconds; uint256 newLoanAmountInPrincipalTokens; uint256 originationFeePercent2Decimals; uint256 newAprWithTwoDecimals; uint256 initialCollateralRatioWith2Decimals; uint256 maintenanceCollateralRatioWith2Decimals; uint256 lateInterestFee; uint256 latePrincipalFee; uint256 expiryInfo; string loanTypeInfo; address lenderAddr; address borrowerAddr; address newCollateralToken; address newPrincipalToken; address feesManagerAddr; address priceOracleAddress; address feesCollectorAddress; address categoryFeesAdress; bool allowSeizeCollateral; } struct LoanRecord { address lenderAddr; address borrowerAddr; address principalTokenAddr; address collateralTokenAddr; uint256 loanAmount; uint256 initialApr; uint256 paymentInterval; } struct FeeData { address feeTokenAddr; // The token address. This is used when the offset is not available (offset = 0). uint256 feeTokenOffset; // The offset of the token, if any. uint256 amountOffset; // The offset of the amount. uint256 feeWithTwoDecimals; // The applicable fee, expressed with 2 decimal places. } struct CallCheck { uint8 checkType; address contractAddr; uint256 numericVal; address contractAddr2; uint256 numericVal2; } struct ModuleFee { address tokenAddress; uint256 dstAmount; uint256 dstPercent; } struct ModuleResponse { uint256[] targetCallValues; address[] targetAddresses; bytes[] targetPayloads; CallCheck[] checks; ModuleFee[] feesBefore; ModuleFee[] feesAfter; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; interface IHookableLender { function notifyLoanClosed() external; function notifyLoanMatured() external; function notifyPrincipalRepayment(uint256 effectiveLoanAmount, uint256 principalRepaid) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../loans/interfaces/IPeerToPeerOpenTermLoan.sol"; import "./OwnableLiquidityPool.sol"; /** * @title Represents an ERC-4626 compliant liquidity pool capable of lending funds on their own. * @dev This liquidity pool is ownable by definition. */ abstract contract AbstractLender is OwnableLiquidityPool { /// @notice The address of the Loans Operator address public loansOperator; // --------------------------------------------------------------- // Modifiers // --------------------------------------------------------------- modifier onlyLoansOperator() { if (msg.sender != loansOperator) revert OnlyLoansOperator(); _; } // --------------------------------------------------------------- // Implementation functions // --------------------------------------------------------------- /** * @notice As a lender, this pool proposes a new APR to the borrower of the loan address specified. * @param loanAddr The address of the loan. * @param newAprWithTwoDecimals The APR proposed by this pool, expressed with 2 decimal places. */ function proposeNewApr( address loanAddr, uint256 newAprWithTwoDecimals ) external nonReentrant ifConfigured onlyLoansOperator { _ensureValidLoan(loanAddr); IPeerToPeerOpenTermLoan(loanAddr).proposeNewApr(newAprWithTwoDecimals); } /** * @notice Updates the late fees of the loan specified. * @param loanAddr The address of the loan. * @param lateInterestFeeWithTwoDecimals The late interest fee (percentage) with 2 decimal places. * @param latePrincipalFeeWithTwoDecimals The late principal fee (percentage) with 2 decimal places. */ function changeLateFees( address loanAddr, uint256 lateInterestFeeWithTwoDecimals, uint256 latePrincipalFeeWithTwoDecimals ) external nonReentrant ifConfigured onlyLoansOperator { _ensureValidLoan(loanAddr); IPeerToPeerOpenTermLoan(loanAddr).changeLateFees(lateInterestFeeWithTwoDecimals, latePrincipalFeeWithTwoDecimals); } /** * @notice Updates the maintenance collateral ratio * @param loanAddr The address of the loan. * @param maintenanceCollateralRatioWith2Decimals The maintenance collateral ratio, if applicable. */ function changeMaintenanceCollateralRatio( address loanAddr, uint256 maintenanceCollateralRatioWith2Decimals ) external nonReentrant ifConfigured onlyLoansOperator { _ensureValidLoan(loanAddr); IPeerToPeerOpenTermLoan(loanAddr).changeMaintenanceCollateralRatio(maintenanceCollateralRatioWith2Decimals); } /** * @notice Calls the loan specified. * @param loanAddr The address of the loan. * @param callbackPeriodInHours The callback period, measured in hours. * @param gracePeriodInHours The grace period, measured in hours. */ function callLoan( address loanAddr, uint256 callbackPeriodInHours, uint256 gracePeriodInHours ) external nonReentrant ifConfigured onlyLoansOperator { _ensureValidLoan(loanAddr); IPeerToPeerOpenTermLoan(loanAddr).callLoan(callbackPeriodInHours, gracePeriodInHours); } /** * @notice Liquidates the loan specified. * @param loanAddr The address of the loan. */ function liquidate(address loanAddr) external nonReentrant ifConfigured onlyLoansOperator { _ensureValidLoan(loanAddr); IPeerToPeerOpenTermLoan(loanAddr).liquidate(); } // --------------------------------------------------------------- // Virtuals // --------------------------------------------------------------- function fundLoan(address loanAddr) external virtual; function _ensureValidLoan(address loanAddr) internal view virtual; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; // --------------------------------------------------------------- // States of a loan // --------------------------------------------------------------- uint8 constant LOAN_PREAPPROVED = 1; // The loan was pre-approved by the lender uint8 constant LOAN_FUNDING_REQUIRED = 2; // The loan was accepted by the borrower. Waiting for the lender to fund the loan. uint8 constant LOAN_FUNDED = 3; // The loan was funded. uint8 constant LOAN_ACTIVE = 4; // The loan is active. uint8 constant LOAN_CANCELLED = 5; // The lender failed to fund the loan and the borrower claimed their collateral. uint8 constant LOAN_MATURED = 6; // The loan matured. It was liquidated by the lender. uint8 constant LOAN_CLOSED = 7; // The loan was closed normally. interface IPeerToPeerOpenTermLoan { // Functions available to the lender only function fundLoan() external; function callLoan(uint256 callbackPeriodInSeconds, uint256 gracePeriodInSeconds) external; function liquidate() external; function proposeNewApr(uint256 newAprWithTwoDecimals) external; function changeOracle(address newOracle) external; function changeLateFees(uint256 lateInterestFeeWithTwoDecimals, uint256 latePrincipalFeeWithTwoDecimals) external; function changeMaintenanceCollateralRatio(uint256 maintenanceCollateralRatioWith2Decimals) external; function seizeCollateral(uint256 amount) external; function returnCollateral(uint256 depositAmount) external; // Functions available to the borrower only function acceptApr() external; function borrowerCommitment() external; function claimCollateral() external; function repay(uint256 paymentAmount) external; function repayInterests() external; function repayPrincipal(uint256 paymentAmount) external; // The minimum views of a loan function lender() external view returns (address); function borrower() external view returns (address); function principalToken() external view returns (address); function collateralToken() external view returns (address); function loanState() external view returns (uint8); function currentApr() external view returns (uint256); function effectiveLoanAmount() external view returns (uint256); function getCollateralRequirements() external view returns (uint256 initialCollateralAmount, uint256 maintenanceCollateralAmount); function getDebt() external view returns ( uint256 currentBillingCycle, uint256 cyclesSinceLastAprUpdate, uint256 interestOwed, uint256 applicableLateFee, uint256 minPaymentAmount, uint256 maxPaymentAmount ); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../core/BaseOwnable.sol"; import "./TimelockedERC4626.sol"; /** * @title Represents an ownable liquidity pool. The pool is compliant with the ERC-4626 standard. */ abstract contract OwnableLiquidityPool is TimelockedERC4626, BaseOwnable { /** * @notice This event is triggered when the owner runs an emergency withdrawal. * @param withdrawalAmount The withdrawal amount. * @param tokenAddr The token address. * @param destinationAddr The destination address. */ event OnEmergencyWithdraw (uint256 withdrawalAmount, address tokenAddr, address destinationAddr); /** * @notice Allows the owner of the pool to withdraw the full balance of the token specified. * @dev Throws if the caller is not the current owner of the pool. If the asset to withdraw is the underlying asset of the pool then this function pauses deposits and withdrawals automatically. * @param token The token to transfer. * @param destinationAddr The destination address of the ERC20 transfer. */ function emergencyWithdraw( IERC20 token, address destinationAddr ) external virtual nonReentrant ifConfigured onlyOwner { if (isBlacklisted[destinationAddr]) revert AddressBlacklisted(); uint256 currentBalance = token.balanceOf(address(this)); if (address(token) == address(_underlyingAsset)) { // Automatically pause deposits and withdrawals in order to prevent fluctuations on the price of the LP token _setPause(true, true); } SafeERC20.safeTransfer(token, destinationAddr, currentBalance); emit OnEmergencyWithdraw(currentBalance, address(token), destinationAddr); } /** * @notice Gets the owner of the pool. * @return address The address who owns the pool. */ function owner() external view returns (address) { return _owner; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; abstract contract BaseOwnable { address internal _owner; /** * @notice Triggers when contract ownership changes. * @param previousOwner The previous owner of the contract. * @param newOwner The new owner of the contract. */ event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == _owner, "Caller is not the owner"); _; } function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../libraries/DateUtils.sol"; import "./BaseUpgradeableERC4626.sol"; /** * @title Represents a liquidity pool in which withdrawals can be time-locked or instantaneous. * @dev The liquidity pool accepts deposits in a single token only, per ERC-4626. */ abstract contract TimelockedERC4626 is BaseUpgradeableERC4626 { /// @dev A reasonable time-window for manipulating the block timestamp as a miner. uint256 constant internal _TIMESTAMP_MANIPULATION_WINDOW = 5 minutes; struct RedeemSummary { uint256 shares; // The number of shares to burn. uint256 assets; // The asset amount that was claimable at redemption time per current token price. } /// @notice The hour at which withdrawals are processed. It ranges from 0 to 23. uint8 public liquidationHour; /// @notice The duration of the time-lock for withdrawals. uint256 public lagDuration; /// @notice The total number of shares that need to be burned. uint256 public globalLiabilityShares; /// @notice The total amount of collectable fees, at any point in time. uint256 public totalCollectableFees; address public settlementAccount; /// @dev The liability (forecast) that needs to be fulfilled at a given point in time mapping (bytes32 => RedeemSummary) internal _dailyRequirement; /// @dev The list of addresses that can claim funds at a given point in time mapping (bytes32 => address[]) internal _uniqueReceiversPerCluster; /// @dev The index of each unique receiver per cluster mapping (bytes32 => mapping(address => uint256)) internal _receiverIndexes; /// @dev The amount of underlying tokens that can be claimed by a given address at a specific point in time mapping (bytes32 => mapping(address => uint256)) internal _receiverAmounts; /// @dev The number of shares that can be burned by a given address at a specific point in time mapping (bytes32 => mapping(address => uint256)) internal _burnableAmounts; /// @dev Tracks the applicable fee per receiver per period mapping (bytes32 => mapping(address => uint256)) internal _feeAmountsByReceiver; /// @dev Tracks the latest unix epoch of the redeem request for a given receiver mapping (bytes32 => mapping(address => uint256)) internal _traceableRequests; /** * @notice This event is triggered when a holder requests a withdrawal. * @param ownerAddr The address of the holder. * @param receiverAddr The address of the receiver. * @param shares The amount of shares (LP tokens) to burn. * @param assets The amount of underlying assets to transfer. * @param fee The fee applied to the withdrawal. * @param year The year component of the scheduled date. * @param month The month component of the scheduled date. * @param day The day component of the scheduled date. */ event WithdrawalRequested (address ownerAddr, address receiverAddr, uint256 shares, uint256 assets, uint256 fee, uint256 year, uint256 month, uint256 day); /** * @notice This event is triggered when funds are effectively transferred to the receiving address specified by the holder. * @param assetsAmount The amount of underlying assets sent to the receiving address. * @param processedOn The unix epoch in which the claim was processed. * @param receiverAddr The address of the receiver. * @param requestedOn The unix epoch of the withdrawal request. * @param wasBlacklisted Indicates if the receiver was blacklisted. In this case the funds are sent to the settlement account. */ event WithdrawalProcessed(uint256 assetsAmount, uint256 processedOn, address receiverAddr, uint256 requestedOn, bool wasBlacklisted); // ---------------------------------------- // ERC-4626 endpoint overrides // ---------------------------------------- function withdraw( uint256, address, address ) external override pure returns (uint256) { // Revert the call to ERC4626.withdraw(args) in order to stay compatible with the ERC-4626 standard. // Per ERC-4626 spec (https://eips.ethereum.org/EIPS/eip-4626): // - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). // - Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. // Those methods should be performed separately. revert WithdrawalRequestRequired(); // We could enqueue a withdrawal request from this endpoint, but it wouldn't compatible with the ERC-4626 standard. // Likewise, we could process the funds for the receiver sppecified but -again- it wouldn't compatible with the ERC-4626 standard. // Hence the tx revert. Provided we revert in all cases, the function becomes pure. } function redeem( uint256, address, address ) external override pure returns (uint256) { // Revert the call to ERC4626.redeem(args) in order to stay compatible with the ERC-4626 standard. // Per ERC-4626 spec (https://eips.ethereum.org/EIPS/eip-4626): // - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). // - Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. // Those methods should be performed separately. revert WithdrawalRequestRequired(); // We could enqueue a withdrawal request from this endpoint, but it wouldn't compatible with the ERC-4626 standard. // Likewise, we could process the funds for the receiver sppecified but -again- it wouldn't compatible with the ERC-4626 standard. // Hence the tx revert. Provided we revert in all cases, the function becomes pure. } // ---------------------------------------- // Timelocked ERC-4626 features // ---------------------------------------- /** * @notice Requests to redeem a given number of shares from the holder specified. * @dev The respective amount of assets will be made available in X hours from now, where "X" is the lag defined by the owner of the pool. * @param shares The number of shares to burn. * @param receiverAddr The address of the receiver. * @param holderAddr The address of the tokens holder. * @return assets The amount of assets that can be claimed for this specific withdrawal request. * @return claimableEpoch The date at which the assets become claimable. This is expressed as a Unix epoch. */ function requestRedeem( uint256 shares, address receiverAddr, address holderAddr ) external nonReentrant ifConfigured ifWithdrawalsNotPaused returns ( uint256 assets, uint256 claimableEpoch ) { if (isBlacklisted[msg.sender] || isBlacklisted[receiverAddr] || isBlacklisted[holderAddr]) revert AddressBlacklisted(); uint256 year; uint256 month; uint256 day; (claimableEpoch, year, month, day, assets) = _registerRedeemRequest(shares, holderAddr, receiverAddr, msg.sender); // If the pool is not time-locked then transfer the funds immediately. if (lagDuration == 0) { claimableEpoch = block.timestamp; _claim(year, month, day, receiverAddr); } } /** * @notice Allows any public address to process the scheduled withdrawal requests of the receiver specified. * @dev Throws if the receiving address is not the legitimate address you registered via "requestRedeem()" * @param year The year component of the claim. It can be a past date. * @param month The month component of the claim. It can be a past date. * @param day The day component of the claim. It can be a past date. * @param receiverAddr The address of the legitimate receiver of the funds. * @return uint256 The effective number of shares (LP tokens) that were burnt from the liquidity pool. * @return uint256 The effective amount of underlying assets that were transfered to the receiver. */ function claim( uint256 year, uint256 month, uint256 day, address receiverAddr ) external nonReentrant ifConfigured ifWithdrawalsNotPaused returns (uint256, uint256) { if (isBlacklisted[msg.sender] || isBlacklisted[receiverAddr]) revert AddressBlacklisted(); // This function is provided as a fallback. // If -for any reason- a third party does not process the scheduled withdrawals then the // legitimate receiver can claim the respective funds on their own. // Thus as a legitimate receiver you can always claim your funds, even if the processing party fails to honor their promise. return _claim(year, month, day, receiverAddr); } /** * @notice Processes all of the withdrawal requests scheduled for the date specified. * @dev Throws if the date is earlier than the liquidation/processing hour. * @param year The year component of the claim. It can be a past date. * @param month The month component of the claim. It can be a past date. * @param day The day component of the claim. It can be a past date. * @param maxLimit The number of transactions to process. The maximum is defined by the function "getScheduledTransactionsByDate()" */ function processAllClaimsByDate( uint256 year, uint256 month, uint256 day, uint256 maxLimit ) external nonReentrant ifConfigured ifWithdrawalsNotPaused { if (maxLimit == 0) revert LimitRequired(); if (isBlacklisted[msg.sender]) revert AddressBlacklisted(); if (settlementAccount == address(0)) revert SettlementAccountNotSet(); bytes32 dailyCluster = _getDailyClusterHash(year, month, day); // Make sure we have pending requests to process. if (_dailyRequirement[dailyCluster].assets == 0) revert NothingToProcess(); // Make sure withdrawals are processed at the expected epoch only. if (block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW < DateUtils.timestampFromDateTime(year, month, day, liquidationHour, 0, 0)) revert TooEarly(); // This is the number of unique ERC20 transfers we will need to make in this transaction uint256 workSize = (_uniqueReceiversPerCluster[dailyCluster].length > maxLimit) ? maxLimit : _uniqueReceiversPerCluster[dailyCluster].length; uint256 startingPos = _uniqueReceiversPerCluster[dailyCluster].length; address[] memory receivers = new address[](workSize); uint256[] memory amounts = new uint256[](workSize); uint256 totalFees; uint256 sharesToBurn; uint256 assetsToSend; uint256 x = workSize; address receiverAddr; for (uint256 i = startingPos; i > (startingPos - workSize); i--) { receiverAddr = _uniqueReceiversPerCluster[dailyCluster][i - 1]; x--; receivers[x] = receiverAddr; amounts[x] = _receiverAmounts[dailyCluster][receiverAddr]; assetsToSend += amounts[x]; sharesToBurn += _burnableAmounts[dailyCluster][receiverAddr]; totalFees += _feeAmountsByReceiver[dailyCluster][receiverAddr]; _receiverAmounts[dailyCluster][receiverAddr] = 0; _burnableAmounts[dailyCluster][receiverAddr] = 0; _feeAmountsByReceiver[dailyCluster][receiverAddr] = 0; _uniqueReceiversPerCluster[dailyCluster].pop(); _receiverIndexes[dailyCluster][receiverAddr] = 0; } globalLiabilityShares -= sharesToBurn; totalCollectableFees += totalFees; _dailyRequirement[dailyCluster].assets -= assetsToSend; _dailyRequirement[dailyCluster].shares -= sharesToBurn; // Make sure the pool has enough balance to cover withdrawals. uint256 balanceBefore = IERC20(_underlyingAsset).balanceOf(address(this)); require(balanceBefore >= assetsToSend, "Insufficient balance"); _burnErc20(address(this), sharesToBurn); // Untrusted external calls _sendFunds(dailyCluster, receivers, amounts); // Balance check, provided the external asset is untrusted require(IERC20(_underlyingAsset).balanceOf(address(this)) == balanceBefore - assetsToSend, "Balance check failed"); } // ---------------------------------------- // Views // ---------------------------------------- /** * @notice Gets the date at which your withdrawal request can be claimed. * @return year The year. * @return month The month. * @return day The day. * @return claimableEpoch The Unix epoch at which your withdrawal request can be claimed. */ function getWithdrawalEpoch() external view returns ( uint256 year, uint256 month, uint256 day, uint256 claimableEpoch ) { (year, month, day) = DateUtils.timestampToDate(block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW + lagDuration); claimableEpoch = DateUtils.timestampFromDateTime(year, month, day, liquidationHour, 0, 0); } /** * @notice Gets the funding requirement of the date specified. * @dev This is a forecast on the amount of assets that need to be available at the pool on the date specified. * @param year The year. * @param month The month. * @param day The day. * @return shares The number of shares (LP tokens) that will be burned on the date specified. * @return assets The amount of assets that will be transferred on the date specified. */ function getRequirementByDate( uint256 year, uint256 month, uint256 day ) external view returns (uint256 shares, uint256 assets) { bytes32 dailyCluster = _getDailyClusterHash(year, month, day); shares = _dailyRequirement[dailyCluster].shares; assets = _dailyRequirement[dailyCluster].assets; } /** * @notice Gets the asset amount that can be claimed by a receiver at the date specified. * @dev This is a forecast on the amount of assets that can be claimed by a given party on the date specified. * @param year The year. * @param month The month. * @param day The day. * @param receiverAddr The address of the receiver. * @return uint256 The total amount of assets that can be claimed at a the date specified. */ function getClaimableAmountByReceiver( uint256 year, uint256 month, uint256 day, address receiverAddr ) external view returns (uint256) { bytes32 dailyCluster = _getDailyClusterHash(year, month, day); return _receiverAmounts[dailyCluster][receiverAddr]; } /** * @notice Gets the total number of shares to burn at the date specified for a given receiver. * @dev This is a forecast on the amount of assets that can be claimed by a given party on the date specified. * @param year The year. * @param month The month. * @param day The day. * @param receiverAddr The address of the receiver. * @return uint256 The total number of shares to burn at the date specified for a given receiver. */ function getBurnableAmountByReceiver( uint256 year, uint256 month, uint256 day, address receiverAddr ) external view returns (uint256) { bytes32 dailyCluster = _getDailyClusterHash(year, month, day); return _burnableAmounts[dailyCluster][receiverAddr]; } /** * @notice Gets the total number of transactions to run at a given date. * @param year The year. * @param month The month. * @param day The day. * @return totalTransactions The number of transactions to execute. * @return executionEpoch The Unix epoch at which these transactions should be submitted to the blockchain. */ function getScheduledTransactionsByDate( uint256 year, uint256 month, uint256 day ) external view returns (uint256 totalTransactions, uint256 executionEpoch) { bytes32 dailyCluster = _getDailyClusterHash(year, month, day); totalTransactions = _uniqueReceiversPerCluster[dailyCluster].length; executionEpoch = DateUtils.timestampFromDateTime(year, month, day, liquidationHour, 0, 0); } // ---------------------------------------- // Inner functions // ---------------------------------------- function _registerRedeemRequest( uint256 shares, address holderAddr, address receiverAddr, address callerAddr ) internal returns ( uint256 claimableEpoch, uint256 year, uint256 month, uint256 day, uint256 effectiveAssetsAmount ) { if (holderAddr == address(this)) revert InvalidHolder(); if (shares == 0) revert SharesAmountRequired(); if (_balances[holderAddr] < shares) revert InsufficientShares(); // The number of assets the receiver will get at the current price/ratio, per ERC-4626. (uint256 assetsAmount, uint256 assetsAfterFee) = _previewRedeemWithFees(shares); if (assetsAmount > maxWithdraw(holderAddr)) revert WithdrawalLimitReached(); if (assetsAfterFee == 0) revert AmountTooLow(); // The withdrawal fee to apply uint256 applicableFee = assetsAmount - assetsAfterFee; effectiveAssetsAmount = assetsAfterFee; // The time slot (cluster) of the lagged withdrawal (year, month, day) = DateUtils.timestampToDate(block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW + lagDuration); // The hash of the cluster bytes32 dailyCluster = _getDailyClusterHash(year, month, day); // The withdrawal will be processed at the following epoch claimableEpoch = DateUtils.timestampFromDateTime(year, month, day, liquidationHour, 0, 0); // ERC20 allowance scenario if (callerAddr != holderAddr) _spendAllowance(holderAddr, callerAddr, shares); // Transfer the shares from the token holder to this contract. // We transfer the shares to the liquidity pool in order to avoid fluctuations on the token price. // Otherwise, burning shares at this point in time would affect the number of assets (liability) // of future withdrawal requests because the token price would increase. _executeErc20Transfer(holderAddr, address(this), shares); // Global metrics _dailyRequirement[dailyCluster].assets += assetsAmount; _dailyRequirement[dailyCluster].shares += shares; globalLiabilityShares += shares; // Unique receivers by date. We will transfer underlying tokens to this receiver shortly. if (_receiverAmounts[dailyCluster][receiverAddr] == 0) { _uniqueReceiversPerCluster[dailyCluster].push(receiverAddr); _receiverIndexes[dailyCluster][receiverAddr] = _uniqueReceiversPerCluster[dailyCluster].length; } // Track the amount of underlying assets we are required to transfer to the receiver address specified. _receiverAmounts[dailyCluster][receiverAddr] += assetsAfterFee; _burnableAmounts[dailyCluster][receiverAddr] += shares; _feeAmountsByReceiver[dailyCluster][receiverAddr] += applicableFee; // The unix epoch of the latest redeem request. It overrides any previous requests. // For example, if the holder submits 1000 requests then the mapping below gets updated based on the latest request. _traceableRequests[dailyCluster][receiverAddr] = block.timestamp; // Emit the event emit WithdrawalRequested(holderAddr, receiverAddr, shares, assetsAmount, applicableFee, year, month, day); } function _claim( uint256 year, uint256 month, uint256 day, address receiverAddr ) internal returns (uint256, uint256) { bytes32 dailyCluster = keccak256(abi.encode(year, month, day)); uint256 shares = _burnableAmounts[dailyCluster][receiverAddr]; if (shares == 0) revert NoSharesForReceiver(); uint256 claimableAssets = _receiverAmounts[dailyCluster][receiverAddr]; uint256 assetFee = _feeAmountsByReceiver[dailyCluster][receiverAddr]; if (lagDuration > 0) { // Make sure withdrawals are processed at the expected epoch only. if (block.timestamp + _TIMESTAMP_MANIPULATION_WINDOW < DateUtils.timestampFromDateTime(year, month, day, liquidationHour, 0, 0)) revert TooEarly(); } // Internal state changes (trusted) _receiverAmounts[dailyCluster][receiverAddr] = 0; _burnableAmounts[dailyCluster][receiverAddr] = 0; _feeAmountsByReceiver[dailyCluster][receiverAddr] = 0; _dailyRequirement[dailyCluster].shares -= shares; _dailyRequirement[dailyCluster].assets -= (claimableAssets + assetFee); globalLiabilityShares -= shares; totalCollectableFees += assetFee; _deleteReceiver(dailyCluster, receiverAddr); _burnErc20(address(this), shares); emit WithdrawalProcessed(claimableAssets, block.timestamp, receiverAddr, _traceableRequests[dailyCluster][receiverAddr], false); // Make sure the pool has enough balance to cover withdrawals. uint256 balanceBefore = IERC20(_underlyingAsset).balanceOf(address(this)); SafeERC20.safeTransfer(_underlyingAsset, receiverAddr, claimableAssets); // Balance check, provided the external asset is untrusted if (balanceBefore - claimableAssets < IERC20(_underlyingAsset).balanceOf(address(this))) revert BalanceCheckFailed(); return (shares, claimableAssets); } function _deleteReceiver(bytes32 dailyCluster, address addr) private { uint256 idx = _receiverIndexes[dailyCluster][addr] - 1; uint256 totalReceiversByDate = _uniqueReceiversPerCluster[dailyCluster].length; address lastItem = _uniqueReceiversPerCluster[dailyCluster][totalReceiversByDate - 1]; if (addr != lastItem) { _uniqueReceiversPerCluster[dailyCluster][totalReceiversByDate - 1] = _uniqueReceiversPerCluster[dailyCluster][idx]; _uniqueReceiversPerCluster[dailyCluster][idx] = lastItem; _receiverIndexes[dailyCluster][lastItem] = idx + 1; } _uniqueReceiversPerCluster[dailyCluster].pop(); _receiverIndexes[dailyCluster][addr] = 0; } function _sendFunds(bytes32 dailyCluster, address[] memory receivers, uint256[] memory amounts) private { address recipientAddr; for (uint256 i; i < receivers.length; i++) { recipientAddr = (isBlacklisted[receivers[i]]) ? settlementAccount : receivers[i]; emit WithdrawalProcessed(amounts[i], block.timestamp, receivers[i], _traceableRequests[dailyCluster][receivers[i]], isBlacklisted[receivers[i]]); SafeERC20.safeTransfer(_underlyingAsset, recipientAddr, amounts[i]); } } function _getDailyClusterHash(uint256 year, uint256 month, uint256 day) internal pure returns (bytes32) { return keccak256(abi.encode(year, month, day)); } }
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.26; library DateUtils { // The number of seconds per day uint256 internal constant SECONDS_PER_DAY = 24 * 60 * 60; // The number of seconds per hour uint256 internal constant SECONDS_PER_HOUR = 60 * 60; // The number of seconds per minute uint256 internal constant SECONDS_PER_MINUTE = 60; // The offset from 01/01/1970 int256 internal constant OFFSET19700101 = 2440588; function timestampToDate(uint256 ts) internal pure returns (uint256 year, uint256 month, uint256 day) { (year, month, day) = _daysToDate(ts / SECONDS_PER_DAY); } function timestampToDateTime(uint256 timestamp) internal pure returns (uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) { (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY); uint256 secs = timestamp % SECONDS_PER_DAY; hour = secs / SECONDS_PER_HOUR; secs = secs % SECONDS_PER_HOUR; minute = secs / SECONDS_PER_MINUTE; second = secs % SECONDS_PER_MINUTE; } function timestampFromDateTime(uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) internal pure returns (uint256 timestamp) { timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + hour * SECONDS_PER_HOUR + minute * SECONDS_PER_MINUTE + second; } /** * @notice Calculate year/month/day from the number of days since 1970/01/01 using the date conversion algorithm from http://aa.usno.navy.mil/faq/docs/JD_Formula.php and adding the offset 2440588 so that 1970/01/01 is day 0 * @dev Taken from https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary/blob/master/contracts/BokkyPooBahsDateTimeLibrary.sol * @param _days The year * @return year The year * @return month The month * @return day The day */ function _daysToDate (uint256 _days) internal pure returns (uint256 year, uint256 month, uint256 day) { int256 __days = int256(_days); int256 x = __days + 68569 + OFFSET19700101; int256 n = 4 * x / 146097; x = x - (146097 * n + 3) / 4; int256 _year = 4000 * (x + 1) / 1461001; x = x - 1461 * _year / 4 + 31; int256 _month = 80 * x / 2447; int256 _day = x - 2447 * _month / 80; x = _month / 11; _month = _month + 2 - 12 * x; _year = 100 * (n - 49) + _year + x; year = uint256(_year); month = uint256(_month); day = uint256(_day); } /** * @notice Calculates the number of days from 1970/01/01 to year/month/day using the date conversion algorithm from http://aa.usno.navy.mil/faq/docs/JD_Formula.php and subtracting the offset 2440588 so that 1970/01/01 is day 0 * @dev Taken from https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary/blob/master/contracts/BokkyPooBahsDateTimeLibrary.sol * @param year The year * @param month The month * @param day The day * @return _days Returns the number of days */ function _daysFromDate (uint256 year, uint256 month, uint256 day) internal pure returns (uint256 _days) { require(year >= 1970, "Error"); int256 _year = int256(year); int256 _month = int256(month); int256 _day = int256(day); int256 __days = _day - 32075 + 1461 * (_year + 4800 + (_month - 14) / 12) / 4 + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12 - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4 - OFFSET19700101; _days = uint256(__days); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "./PoolErrors.sol"; import "../../../lib/open-zeppelin/utils/math/MathUpgradeable.sol"; import "../../../lib/open-zeppelin/token/ERC20/utils/SafeERC20.sol"; import "../../core/interfaces/IERC4626.sol"; import "./BaseUpgradeableERC20.sol"; /** * @title Represents a liquidity pool. The pool works per ERC-4626 standard. The pool can be paused. */ abstract contract BaseUpgradeableERC4626 is IERC4626, BaseUpgradeableERC20 { using MathUpgradeable for uint256; /// @notice Indicates whether deposits are paused or not. bool public depositsPaused; /// @notice Indicates whether withdrawals are paused or not. bool public withdrawalsPaused; /// @dev The underlying asset of the pool IERC20 internal _underlyingAsset; /// @dev The address of the fees collector, if any. address public feesCollector; /// @notice The maximum deposit amount. uint256 public maxDepositAmount; /// @notice The maximum withdrawal amount. uint256 public maxWithdrawalAmount; /// @notice The fee to apply when an account withdraws funds from the pool. uint256 public withdrawalFee; /** * @notice Triggers when deposits/withdrawals are paused or resumed. * @param bDepositsPaused The new state for deposits * @param bWithdrawalsPaused The new state for withdrawals */ event DepositWithdrawalStatusChanged(bool bDepositsPaused, bool bWithdrawalsPaused); // --------------------------------------------------------------- // Modifiers // --------------------------------------------------------------- modifier ifConfigured() { if (address(_underlyingAsset) == address(0)) revert NotConfigured(); _; } modifier ifNotConfigured() { if (address(_underlyingAsset) != address(0)) revert AlreadyConfigured(); _; } modifier ifDepositsNotPaused() { if (depositsPaused) revert DepositsPaused(); _; } modifier ifWithdrawalsNotPaused() { if (withdrawalsPaused) revert WithdrawalsPaused(); _; } // -------------------------------------------------------------------------- // ERC-4626 interface implementation // -------------------------------------------------------------------------- /** * @notice Deposits funds in the pool. Issues LP tokens in exchange for the deposit. * @dev Throws if the deposit limit is reached. * @param assets The deposit amount, expressed in underlying tokens. For example: USDC, DAI, etc. * @param receiver The address that will receive the LP tokens. It is usually the same as a the sender. * @return shares The number of LP tokens issued to the receiving address specified. */ function deposit( uint256 assets, address receiver ) external override nonReentrant ifConfigured ifDepositsNotPaused returns (uint256 shares) { if (receiver == address(0) || receiver == address(this)) revert InvalidReceiver(); if (isBlacklisted[msg.sender] || isBlacklisted[receiver]) revert AddressBlacklisted(); if (assets == 0) revert AssetsAmountRequired(); if (assets > maxDeposit(receiver)) revert DepositLimitReached(); shares = previewDeposit(assets); if (shares == 0) revert SharesAmountRequired(); _deposit(msg.sender, receiver, assets, shares); } /** * @notice Issues a specific amount of LP tokens to the receiver specified. * @dev Throws if the deposit limit is reached regardless of how many LP tokens you want to mint. * @param shares The amount of LP tokens to mint. * @param receiver The address of the receiver. It is usually the same as a the sender. * @return assets The amount of underlying assets per current ratio */ function mint( uint256 shares, address receiver ) external override nonReentrant ifConfigured ifDepositsNotPaused returns (uint256 assets) { if (receiver == address(0) || receiver == address(this)) revert InvalidReceiver(); if (isBlacklisted[msg.sender] || isBlacklisted[receiver]) revert AddressBlacklisted(); if (shares == 0) revert SharesAmountRequired(); if (shares > maxMint(receiver)) revert MaxMintReached(); assets = previewMint(shares); if (assets > maxDeposit(receiver)) revert DepositLimitReached(); _deposit(msg.sender, receiver, assets, shares); } /** * @notice Gets the underlying asset of the pool. * @return address The address of the asset. */ function asset() external view override returns (address) { return address(_underlyingAsset); } /** * @notice Gets the total assets amount managed by the pool. * @return uint256 The assets amount. */ function totalAssets() external view virtual override returns (uint256) { return _getTotalAssets(); } function previewDeposit(uint256 assets) public view virtual override returns (uint256) { return _convertToShares(assets, MathUpgradeable.Rounding.Down); } function previewMint(uint256 shares) public view virtual override returns (uint256) { return _convertToAssets(shares, MathUpgradeable.Rounding.Up); } function previewWithdraw(uint256 assets) public view virtual override returns (uint256) { return _convertToShares(assets, MathUpgradeable.Rounding.Up); } function previewRedeem(uint256 shares) public view virtual override returns (uint256 assets) { (, assets) = _previewRedeemWithFees(shares); } function convertToShares(uint256 assets) public view virtual override returns (uint256) { return _convertToShares(assets, MathUpgradeable.Rounding.Down); } function convertToAssets(uint256 shares) public view virtual override returns (uint256) { return _convertToAssets(shares, MathUpgradeable.Rounding.Down); } function maxDeposit(address) public view virtual override returns (uint256) { return (_totalSupply == 0 || _getTotalAssets() > 0) ? maxDepositAmount : 0; } function maxMint(address) public view virtual override returns (uint256) { return _maxSupply; } function maxWithdraw(address holderAddr) public view virtual override returns (uint256) { return _convertToAssets(_balances[holderAddr], MathUpgradeable.Rounding.Down); } function maxRedeem(address holderAddr) public view virtual override returns (uint256) { return _balances[holderAddr]; } // -------------------------------------------------------------------------- // Implementation functions // -------------------------------------------------------------------------- function _deposit( address callerAddr, address receiverAddr, uint256 assets, uint256 shares ) internal virtual { // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the // assets are transferred and before the shares are minted, which is a valid state. // slither-disable-next-line reentrancy-no-eth uint256 expectedBalanceAfterTransfer = assets + _underlyingAsset.balanceOf(address(this)); SafeERC20.safeTransferFrom(_underlyingAsset, callerAddr, address(this), assets); if (_underlyingAsset.balanceOf(address(this)) != expectedBalanceAfterTransfer) revert BalanceCheckFailed(); // Issue (mint) LP tokens to the receiver _mintErc20(receiverAddr, shares); // Log the ERC-4626 event emit Deposit(callerAddr, receiverAddr, assets, shares); } function _updateIssuanceLimits( uint256 newMaxDepositAmount, uint256 newMaxWithdrawalAmount, uint256 newMaxTokenSupply ) internal virtual { if (newMaxDepositAmount == 0) revert InvalidDepositLimit(); if (newMaxWithdrawalAmount == 0) revert InvalidWithdrawalLimit(); _setMaxSupply(newMaxTokenSupply); maxDepositAmount = newMaxDepositAmount; maxWithdrawalAmount = newMaxWithdrawalAmount; } function _setPause(bool bPauseDeposits, bool bPauseWithdrawals) internal virtual { depositsPaused = bPauseDeposits; withdrawalsPaused = bPauseWithdrawals; emit DepositWithdrawalStatusChanged(depositsPaused, withdrawalsPaused); } // -------------------------------------------------------------------------- // Inner views // -------------------------------------------------------------------------- function _getTotalAssets() internal view virtual returns (uint256); // Internal conversion function (from assets to shares) to apply when the vault is empty. function _initialConvertToShares(uint256 assets, MathUpgradeable.Rounding) internal view virtual returns (uint256 shares) { return assets; } // Internal conversion function (from shares to assets) to apply when the vault is empty. function _initialConvertToAssets(uint256 shares, MathUpgradeable.Rounding) internal view virtual returns (uint256) { return shares; } // Internal conversion function (from assets to shares) with support for rounding direction. // Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. // That corresponds to a case where any asset would represent an infinite amount of shares. function _convertToShares(uint256 assets, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256) { return (assets == 0 || _totalSupply == 0) ? _initialConvertToShares(assets, rounding) : assets.mulDiv(_totalSupply, _getTotalAssets(), rounding); } // Internal conversion function (from shares to assets) with support for rounding direction. function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding) internal view virtual returns (uint256) { return (_totalSupply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(_getTotalAssets(), _totalSupply, rounding); } function _previewRedeemWithFees(uint256 shares) internal view returns (uint256 assetsAmount, uint256 assetsAfterFee) { assetsAmount = _convertToAssets(shares, MathUpgradeable.Rounding.Down); assetsAfterFee = assetsAmount; uint256 applicableFee = 0; if (withdrawalFee > 0) { applicableFee = withdrawalFee * assetsAmount / 1e4; assetsAfterFee = assetsAmount - applicableFee; } return (assetsAmount, assetsAfterFee); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.19; error WithdrawalRequestRequired(); error AddressBlacklisted(); error SettlementAccountNotSet(); error LimitRequired(); error NothingToProcess(); error TooEarly(); error InsufficientBalance(); error BalanceCheckFailed(); error InvalidHolder(); error SharesAmountRequired(); error InsufficientShares(); error WithdrawalLimitReached(); error AmountTooLow(); error NoSharesForReceiver(); error PoolNotConfigured(); error PoolAlreadyConfigured(); error DepositsPaused(); error WithdrawalsPaused(); error InvalidReceiver(); error AssetsAmountRequired(); error DepositLimitReached(); error MaxMintReached(); error InvalidDepositLimit(); error InvalidWithdrawalLimit(); error LoansOperatorOnly(); error UnknownLoan(); error InvalidDeploymentAddress(); error InvalidLoanState(); error FundingCheckFailed(); error AllowanceCheckFailed(); error PoolOwnerRequired(); error OperatorRequired(); error DeployerRequired(); error CollectorRequired(); error InvalidProcessingHour(); error InvalidOwner(); error OwnerCannotBeOperator(); error OwnerCannotBeDeployer(); error FeeTooHigh(); error CannotBlacklistOwner(); error InvalidAddress(); error ValueNotSet(); error ManagementFeeIsZero(); error InvalidUpgrade(); error ProcessClaimsFirst(); error OnlyLoansOperator(); error NotConfigured(); error AlreadyConfigured();
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.3; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.26; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. * * _Available since v4.7._ */ interface IERC4626 { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw( uint256 assets, address receiver, address owner ) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem( uint256 shares, address receiver, address owner ) external returns (uint256 assets); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; import "../../../lib/open-zeppelin/token/ERC20/IERC20.sol"; import "../../../lib/open-zeppelin/proxy/utils/Initializable.sol"; import "../../core/BaseReentrancyGuard.sol"; /** * @title Tokenizes a liability per EIP-20. * @dev The liability is upgradeable per EIP-1967. Reentrancy checks in place. */ abstract contract BaseUpgradeableERC20 is IERC20, Initializable, BaseReentrancyGuard { /// @notice The decimal places of the token. uint8 public decimals; /// @notice The token symbol. string public symbol; /// @notice The descriptive name of the token. string public name; /// @dev The total circulating supply of the token uint256 internal _totalSupply; /// @dev The maximum circulating supply of the token, if any. Set to zero if there is no max limit. uint256 internal _maxSupply; /// @dev The balance of each holder mapping(address => uint256) internal _balances; /// @dev The allowance of each spender, which is set by each owner mapping(address => mapping(address => uint256)) internal _allowances; mapping(address => bool) public isBlacklisted; /** * @notice This event is triggered when the maximum limit for minting tokens is updated. * @param prevValue The previous limit * @param newValue The new limit */ event OnMaxSupplyChanged(uint256 prevValue, uint256 newValue); // -------------------------------------------------------------------------- // Modifiers // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // ERC-20 interface implementation // -------------------------------------------------------------------------- /** * @notice Transfers a given amount tokens to the address specified. * @param to The address to transfer to. * @param value The amount to be transferred. * @return Returns true in case of success. */ function transfer(address to, uint256 value) external override nonReentrant returns (bool) { return _executeErc20Transfer(msg.sender, to, value); } /** * @notice Transfer tokens from one address to another. * @dev Note that while this function emits an Approval event, this is not required as per the specification, * and other compliant implementations may not emit the event. * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred * @return Returns true in case of success. */ function transferFrom(address from, address to, uint256 value) external override nonReentrant returns (bool) { uint256 currentAllowance = _allowances[from][msg.sender]; require(currentAllowance >= value, "Amount exceeds allowance"); require (_executeErc20Transfer(from, to, value), "Failed to execute transferFrom"); _approveSpender(from, msg.sender, currentAllowance - value); return true; } /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @dev Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. * One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 * and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return Returns true in case of success. */ function approve(address spender, uint256 value) external override nonReentrant returns (bool) { _approveSpender(msg.sender, spender, value); return true; } /** * @notice Gets the current version of the token. * @return uint8 The current version of the contract. */ function getInitializedVersion() external view returns (uint8) { return _getInitializedVersion(); } /** * @notice Gets the total circulating supply of tokens * @return uint256 The total circulating supply of tokens */ function totalSupply() external view override returns (uint256) { return _totalSupply; } /** * @notice Gets the balance of the address specified. * @param addr The address to query the balance of. * @return uint256 An uint256 representing the amount owned by the passed address. */ function balanceOf(address addr) external view override returns (uint256) { return _balances[addr]; } /** * @notice Function to check the amount of tokens that an owner allowed to a spender. * @param ownerAddr address The address which owns the funds. * @param spenderAddr address The address which will spend the funds. * @return uint256 A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address ownerAddr, address spenderAddr) external view override returns (uint256) { return _allowances[ownerAddr][spenderAddr]; } /** * @notice Gets the maximum token supply. * @return uint256 The maximum token supply. */ function maxSupply() external view returns (uint256) { return _maxSupply; } // -------------------------------------------------------------------------- // Implementation functions // -------------------------------------------------------------------------- function _executeErc20Transfer(address from, address to, uint256 value) internal virtual returns (bool) { // Checks require(to != address(0), "non-zero address required"); require(from != address(0), "non-zero sender required"); require(value > 0, "Amount cannot be zero"); require(_balances[from] >= value, "Amount exceeds sender balance"); // State changes _balances[from] = _balances[from] - value; _balances[to] = _balances[to] + value; // Emit the event per ERC-20 emit Transfer(from, to, value); return true; } function _approveSpender(address ownerAddr, address spender, uint256 value) internal virtual { require(spender != address(0), "non-zero spender required"); require(ownerAddr != address(0), "non-zero owner required"); // State changes _allowances[ownerAddr][spender] = value; // Emit the event emit Approval(ownerAddr, spender, value); } function _spendAllowance (address ownerAddr, address spenderAddr, uint256 amount) internal virtual { uint256 currentAllowance = _allowances[ownerAddr][spenderAddr]; if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); _approveSpender(ownerAddr, spenderAddr, currentAllowance - amount); } } function _mintErc20(address addr, uint256 amount) internal virtual { require(amount > 0, "Invalid amount"); require(_canMint(amount), "Max supply limit reached"); _totalSupply += amount; _balances[addr] += amount; emit Transfer(address(0), addr, amount); } function _burnErc20(address addr, uint256 amount) internal virtual { require(amount > 0, "Invalid amount"); require(_balances[addr] >= amount, "Burn amount exceeds balance"); _balances[addr] -= amount; _totalSupply -= amount; emit Transfer(addr, address(0), amount); } function _setMaxSupply(uint256 newValue) internal virtual { require(newValue > 0 && newValue > _totalSupply, "Invalid max supply"); uint256 prevValue = _maxSupply; _maxSupply = newValue; emit OnMaxSupplyChanged(prevValue, newValue); } // Indicates if we can issue/mint the number of tokens specified. function _canMint(uint256 amount) internal view virtual returns (bool) { return _maxSupply - _totalSupply >= amount; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >= 0.8.26; /** * @title Base reentrancy guard. This is constructor-less implementation for both proxies and standalone contracts. */ abstract contract BaseReentrancyGuard { uint256 internal constant _REENTRANCY_NOT_ENTERED = 1; uint256 internal constant _REENTRANCY_ENTERED = 2; uint256 internal _reentrancyStatus; /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_reentrancyStatus != _REENTRANCY_ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _reentrancyStatus = _REENTRANCY_ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _reentrancyStatus = _REENTRANCY_NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _reentrancyStatus == _REENTRANCY_ENTERED; } }
{ "remappings": [ "open-zeppelin/=lib/open-zeppelin/contracts/", "forge-std/=lib/forge-std/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"AddressBlacklisted","type":"error"},{"inputs":[],"name":"AllowanceCheckFailed","type":"error"},{"inputs":[],"name":"AlreadyConfigured","type":"error"},{"inputs":[],"name":"AmountTooLow","type":"error"},{"inputs":[],"name":"AssetsAmountRequired","type":"error"},{"inputs":[],"name":"BalanceCheckFailed","type":"error"},{"inputs":[],"name":"Blacklisted","type":"error"},{"inputs":[],"name":"CannotBlacklistOwner","type":"error"},{"inputs":[],"name":"CollectorRequired","type":"error"},{"inputs":[],"name":"DeployerRequired","type":"error"},{"inputs":[],"name":"DepositLimitReached","type":"error"},{"inputs":[],"name":"DepositsPaused","type":"error"},{"inputs":[],"name":"FeeTooHigh","type":"error"},{"inputs":[],"name":"FundingCheckFailed","type":"error"},{"inputs":[],"name":"InsufficientShares","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidDeploymentAddress","type":"error"},{"inputs":[],"name":"InvalidDepositLimit","type":"error"},{"inputs":[],"name":"InvalidHolder","type":"error"},{"inputs":[],"name":"InvalidLoanState","type":"error"},{"inputs":[],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"InvalidProcessingHour","type":"error"},{"inputs":[],"name":"InvalidReceiver","type":"error"},{"inputs":[],"name":"InvalidWithdrawalLimit","type":"error"},{"inputs":[],"name":"LimitRequired","type":"error"},{"inputs":[],"name":"ManagementFeeIsZero","type":"error"},{"inputs":[],"name":"MaxMintReached","type":"error"},{"inputs":[],"name":"NoSharesForReceiver","type":"error"},{"inputs":[],"name":"NotConfigured","type":"error"},{"inputs":[],"name":"NothingToProcess","type":"error"},{"inputs":[],"name":"OnlyLoansOperator","type":"error"},{"inputs":[],"name":"OperatorRequired","type":"error"},{"inputs":[],"name":"OwnerCannotBeDeployer","type":"error"},{"inputs":[],"name":"OwnerCannotBeOperator","type":"error"},{"inputs":[],"name":"PoolOwnerRequired","type":"error"},{"inputs":[],"name":"ProcessClaimsFirst","type":"error"},{"inputs":[],"name":"SettlementAccountNotSet","type":"error"},{"inputs":[],"name":"SharesAmountRequired","type":"error"},{"inputs":[],"name":"TooEarly","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnknownLoan","type":"error"},{"inputs":[],"name":"WithdrawalLimitReached","type":"error"},{"inputs":[],"name":"WithdrawalRequestRequired","type":"error"},{"inputs":[],"name":"WithdrawalsPaused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"bDepositsPaused","type":"bool"},{"indexed":false,"internalType":"bool","name":"bWithdrawalsPaused","type":"bool"}],"name":"DepositWithdrawalStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"loanAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"aprWithTwoDecimals","type":"uint256"}],"name":"NewLoanDeployedByPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawalAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"address","name":"destinationAddr","type":"address"}],"name":"OnEmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"prevValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"OnMaxSupplyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"}],"name":"ReserveDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"assetsAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"processedOn","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiverAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestedOn","type":"uint256"},{"indexed":false,"internalType":"bool","name":"wasBlacklisted","type":"bool"}],"name":"WithdrawalProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ownerAddr","type":"address"},{"indexed":false,"internalType":"address","name":"receiverAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"year","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"month","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"day","type":"uint256"}],"name":"WithdrawalRequested","type":"event"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"addToBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"ownerAddr","type":"address"},{"internalType":"address","name":"spenderAddr","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTimestamp","type":"uint256"},{"internalType":"uint256","name":"toTimestamp","type":"uint256"}],"name":"calculateManagementFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"loanAddr","type":"address"},{"internalType":"uint256","name":"callbackPeriodInHours","type":"uint256"},{"internalType":"uint256","name":"gracePeriodInHours","type":"uint256"}],"name":"callLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"loanAddr","type":"address"},{"internalType":"uint256","name":"lateInterestFeeWithTwoDecimals","type":"uint256"},{"internalType":"uint256","name":"latePrincipalFeeWithTwoDecimals","type":"uint256"}],"name":"changeLateFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"loanAddr","type":"address"},{"internalType":"uint256","name":"maintenanceCollateralRatioWith2Decimals","type":"uint256"}],"name":"changeMaintenanceCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chargeManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"},{"internalType":"address","name":"receiverAddr","type":"address"}],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLagDuration","type":"uint256"},{"internalType":"uint256","name":"newMaxDepositAmount","type":"uint256"},{"internalType":"uint256","name":"newMaxWithdrawalAmount","type":"uint256"},{"internalType":"uint256","name":"newMaxTokenSupply","type":"uint256"},{"internalType":"address","name":"newUnderlyingAsset","type":"address"},{"internalType":"address","name":"newLoansOperator","type":"address"},{"internalType":"address","name":"newLoansDeployerAddress","type":"address"},{"internalType":"address","name":"newFeesCollectorAddr","type":"address"},{"internalType":"address","name":"newScheduledCallerAddress","type":"address"},{"internalType":"uint8","name":"newProcessingHour","type":"uint8"}],"name":"configurePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"fundingPeriodInSeconds","type":"uint256"},{"internalType":"uint256","name":"newPaymentIntervalInSeconds","type":"uint256"},{"internalType":"uint256","name":"newLoanAmountInPrincipalTokens","type":"uint256"},{"internalType":"uint256","name":"originationFeePercent2Decimals","type":"uint256"},{"internalType":"uint256","name":"newAprWithTwoDecimals","type":"uint256"},{"internalType":"uint256","name":"initialCollateralRatioWith2Decimals","type":"uint256"},{"internalType":"uint256","name":"maintenanceCollateralRatioWith2Decimals","type":"uint256"},{"internalType":"uint256","name":"lateInterestFee","type":"uint256"},{"internalType":"uint256","name":"latePrincipalFee","type":"uint256"},{"internalType":"uint256","name":"expiryInfo","type":"uint256"},{"internalType":"string","name":"loanTypeInfo","type":"string"},{"internalType":"address","name":"lenderAddr","type":"address"},{"internalType":"address","name":"borrowerAddr","type":"address"},{"internalType":"address","name":"newCollateralToken","type":"address"},{"internalType":"address","name":"newPrincipalToken","type":"address"},{"internalType":"address","name":"feesManagerAddr","type":"address"},{"internalType":"address","name":"priceOracleAddress","type":"address"},{"internalType":"address","name":"feesCollectorAddress","type":"address"},{"internalType":"address","name":"categoryFeesAdress","type":"address"},{"internalType":"bool","name":"allowSeizeCollateral","type":"bool"}],"internalType":"struct LoanDeploymentParams","name":"loanParams","type":"tuple"}],"name":"deployLoan","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositsPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"destinationAddr","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feesCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"loanAddr","type":"address"}],"name":"fundLoan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gainAdapter","outputs":[{"internalType":"contract IGainAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"},{"internalType":"address","name":"receiverAddr","type":"address"}],"name":"getBurnableAmountByReceiver","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"},{"internalType":"address","name":"receiverAddr","type":"address"}],"name":"getClaimableAmountByReceiver","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInitializedVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"}],"name":"getRequirementByDate","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"}],"name":"getScheduledTransactionsByDate","outputs":[{"internalType":"uint256","name":"totalTransactions","type":"uint256"},{"internalType":"uint256","name":"executionEpoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalLoansDeployed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWithdrawalEpoch","outputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"},{"internalType":"uint256","name":"claimableEpoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalLiabilityShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalLoansAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"uint8","name":"erc20Decimals","type":"uint8"},{"internalType":"string","name":"erc20Symbol","type":"string"},{"internalType":"string","name":"erc20Name","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBlacklisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lagDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"loanAddr","type":"address"}],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"liquidationHour","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"loansDeployed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loansDeployerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loansOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managementFeeLastKnownTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managementFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDepositAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holderAddr","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holderAddr","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWithdrawalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"notifyLoanClosed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"notifyLoanMatured","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"effectiveLoanAmount","type":"uint256"},{"internalType":"uint256","name":"principalRepaid","type":"uint256"}],"name":"notifyPrincipalRepayment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"bPauseDeposits","type":"bool"},{"internalType":"bool","name":"bPauseWithdrawals","type":"bool"}],"name":"pauseDepositsAndWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"year","type":"uint256"},{"internalType":"uint256","name":"month","type":"uint256"},{"internalType":"uint256","name":"day","type":"uint256"},{"internalType":"uint256","name":"maxLimit","type":"uint256"}],"name":"processAllClaimsByDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"processWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"loanAddr","type":"address"},{"internalType":"uint256","name":"newAprWithTwoDecimals","type":"uint256"}],"name":"proposeNewApr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"removeFromBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiverAddr","type":"address"},{"internalType":"address","name":"holderAddr","type":"address"}],"name":"requestRedeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"claimableEpoch","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amountInETH","type":"uint256"}],"name":"reserveDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"scheduledCallerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gainAdapter","type":"address"}],"name":"setGainAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settlementAccount","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCollectableFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxDepositAmount","type":"uint256"},{"internalType":"uint256","name":"newMaxWithdrawalAmount","type":"uint256"},{"internalType":"uint256","name":"newMaxTokenSupply","type":"uint256"}],"name":"updateIssuanceLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newManagementFeePercent","type":"uint256"}],"name":"updateManagementFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"updateSettlementAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"updateTimelockDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newWithdrawalFee","type":"uint256"}],"name":"updateWithdrawalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"withdrawalFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalsPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080604052348015600e575f80fd5b5060156019565b60d3565b5f54610100900460ff161560835760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff9081161460d1575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615fe2806100e05f395ff3fe608060405234801561000f575f80fd5b50600436106104a5575f3560e01c806394bf804d1161026e578063cc1d047111610156578063e74a4bca116100ca578063ef8b30f71161008f578063ef8b30f7146108dc578063f2fde38b14610a38578063f3cbf47c14610a4b578063fe575a8714610a5e578063fecb69b914610a80578063ff3c63c014610a93575f80fd5b8063e74a4bca146109f5578063e75c7a09146109fd578063e91e918314610a10578063e976d43114610a1d578063e9f2838e14610a26575f80fd5b8063d961b58c1161011b578063d961b58c14610968578063da354efa14610971578063dc68a93a14610984578063dd62ed3e14610997578063e2eb36b9146109cf578063e48f6faf146109e2575f80fd5b8063cc1d047114610932578063ce96cb7714610945578063d3a8d71814610958578063d5abeb0114610960578063d905777e14610716575f80fd5b8063b460af94116101ed578063c4283470116101b2578063c4283470146108be578063c63d75b6146108c7578063c6e6f592146108dc578063c8796572146108ef578063ca55a557146108f7578063cc0e3f2c1461091f575f80fd5b8063b460af9414610885578063ba08765214610885578063ba4bb7a4146105ac578063baaa19fb14610898578063be1f9214146108ab575f80fd5b8063a9059cbb11610233578063a9059cbb1461082f578063b2f596ef14610842578063b3c6501514610855578063b3c9e83d1461085f578063b3d7f6b914610872575f80fd5b806394bf804d146107e557806395d89b41146107f85780639cb43f81146108005780639cf160f614610809578063a2aa660f1461081c575f80fd5b806344337ea111610391578063739010b51161031057806386beee07116102d557806386beee07146107935780638bc7e8c4146107a65780638c0190e3146107af5780638da5cb5b146107c25780638ed83271146107d35780638fa243c6146107dc575f80fd5b8063739010b51461073e57806373f351c8146107515780637d41c86e1461075a5780638260910c1461076d578063835e9eb414610780575f80fd5b806360da3e831161035657806360da3e83146106bb5780636382d9ad146106c85780636c46407b146106db5780636e553f651461070357806370a0823114610716575f80fd5b806344337ea11461065c57806344caa1221461066f5780634cdad50614610682578063537df3b614610695578063569b8e2c146106a8575f80fd5b806324e86d6711610428578063339eeb68116103ed578063339eeb68146105e657806334c16b5c146105f957806338867fd41461060c57806338d52e0f1461061f578063402d267d1461063657806342fe098014610649575f80fd5b806324e86d671461059057806327d9ef5f146105995780632a33cf05146105ac5780632f865568146105b4578063313ce567146105c7575f80fd5b8063095ea7b31161046e578063095ea7b31461052c5780630a28a4771461054f57806318160ddd14610562578063184466c91461056a57806323b872dd1461057d575f80fd5b806251e611146104a957806301e1d114146104d9578063030d624a146104ef57806306fdde031461050457806307a2d13a14610519575b5f80fd5b6104bc6104b7366004615568565b610aa6565b6040516001600160a01b0390911681526020015b60405180910390f35b6104e1610cff565b6040519081526020016104d0565b6105026104fd3660046156e8565b610d0d565b005b61050c610d88565b6040516104d0919061572d565b6104e16105273660046156e8565b610e14565b61053f61053a36600461573f565b610e25565b60405190151581526020016104d0565b6104e161055d3660046156e8565b610e46565b6005546104e1565b6105026105783660046156e8565b610e52565b61053f61058b366004615769565b610fa3565b6104e160105481565b601f546104bc906001600160a01b031681565b610502611099565b6105026105c23660046157a7565b611161565b6002546105d49060ff1681565b60405160ff90911681526020016104d0565b6105026105f43660046157a7565b611223565b6105026106073660046157c2565b6112cd565b61050261061a3660046157c2565b6113a3565b600a546201000090046001600160a01b03166104bc565b6104e16106443660046157a7565b611442565b610502610657366004615802565b61146b565b61050261066a3660046157a7565b6115ec565b601c546104bc906001600160a01b031681565b6104e16106903660046156e8565b6116a7565b6105026106a33660046157a7565b6116b1565b6105026106b63660046156e8565b61173a565b600a5461053f9060ff1681565b6105026106d636600461588b565b6117cb565b6106ee6106e93660046158c2565b611959565b604080519283526020830191909152016104d0565b6104e16107113660046158eb565b61199f565b6104e16107243660046157a7565b6001600160a01b03165f9081526007602052604090205490565b61050261074c36600461590e565b611b09565b6104e160235481565b6106ee6107683660046159b4565b611d04565b61050261077b36600461573f565b611e25565b6104e161078e3660046159f3565b611f81565b6105026107a13660046157a7565b611fc7565b6104e1600e5481565b6105026107bd366004615a13565b612076565b601b546001600160a01b03166104bc565b6104e1600c5481565b6104e1601d5481565b6104e16107f33660046158eb565b6120ea565b61050c612257565b6104e160115481565b600b546104bc906001600160a01b031681565b61050261082a36600461573f565b612264565b61053f61083d36600461573f565b61232e565b61050261085036600461573f565b61234d565b5f5460ff166105d4565b6106ee61086d366004615a3f565b6124ca565b6104e16108803660046156e8565b6125a0565b6104e16108933660046159b4565b6125ac565b6105026108a63660046158c2565b6125c6565b6104e16108b9366004615a3f565b61263b565b6104e160245481565b6104e16108d53660046157a7565b5060065490565b6104e16108ea3660046156e8565b612676565b610502612681565b6108ff612717565b6040805194855260208501939093529183015260608201526080016104d0565b6013546104bc906001600160a01b031681565b61050261094036600461573f565b612765565b6104e16109533660046157a7565b6127fd565b61050261281f565b6006546104e1565b6104e160125481565b6104bc61097f3660046156e8565b6128d3565b6104e1610992366004615a3f565b6128fb565b6104e16109a536600461588b565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b6021546104bc906001600160a01b031681565b6105026109f03660046157a7565b612935565b6020546104e1565b610502610a0b3660046159f3565b612c14565b600f546105d49060ff1681565b6104e1600d5481565b600a5461053f90610100900460ff1681565b610502610a463660046157a7565b612d15565b610502610a59366004615a7d565b612f09565b61053f610a6c3660046157a7565b60096020525f908152604090205460ff1681565b6022546104bc906001600160a01b031681565b6106ee610aa13660046158c2565b61354e565b5f610aaf61357e565b600a546201000090046001600160a01b0316610ade5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b03163314610b0957604051633a8b134f60e11b815260040160405180910390fd5b30610160830152601f546040516251e61160e01b81525f916001600160a01b0316906251e61190610b3e908690600401615aac565b6020604051808303815f875af1158015610b5a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7e9190615c0b565b6001600160a01b0381165f908152601e602052604090206002015490915060ff1615610bbd576040516361ef5ed760e11b815260040160405180910390fd5b5f816001600160a01b0316636acc83026040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bfa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c1e9190615c26565b604080516060810182528281525f602080830182815260018486018181526001600160a01b038a16808652601e855287862096518755925186830155516002909501805460ff19169515159590951790945581549384018255918190527fc97bfaf2f8ee708c303a06d134f5ecd8389ae0432af62dc132a24118292866bb90920180546001600160a01b0319168217905560808801518351918252918101919091529192507f91e8e0724fa073d770149830b6e9c1f6027b484a27617dc901ac8795338e4b49910160405180910390a1509050610cfa60018055565b919050565b5f610d086135d7565b905090565b610d1561357e565b600a546201000090046001600160a01b0316610d445760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b03163314610d775760405162461bcd60e51b8152600401610d6e90615c3d565b60405180910390fd5b6023819055610d8560018055565b50565b60048054610d9590615c74565b80601f0160208091040260200160405190810160405280929190818152602001828054610dc190615c74565b8015610e0c5780601f10610de357610100808354040283529160200191610e0c565b820191905f5260205f20905b815481529060010190602001808311610def57829003601f168201915b505050505081565b5f610e1f825f6136d4565b92915050565b5f610e2e61357e565b610e39338484613700565b5060015b610e1f60018055565b5f610e1f82600161380c565b610e5a61357e565b600a546201000090046001600160a01b0316610e895760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b03163314610eb35760405162461bcd60e51b8152600401610d6e90615c3d565b6010548111610edd5760115415610edd5760405163f551d9d160e01b815260040160405180910390fd5b6010819055604051602481018290525f9060440160408051601f19818403018152918152602080830180516001600160e01b031663184466c960e01b1790529051610f2992910161572d565b60408051808303601f1901815290829052805160209091012060215463af6f8c1b60e01b8352600483018290529092506001600160a01b03169063af6f8c1b906024015f604051808303815f87803b158015610f83575f80fd5b505af1158015610f95573d5f803e3d5ffd5b5050505050610d8560018055565b5f610fac61357e565b6001600160a01b0384165f9081526008602090815260408083203384529091529020548281101561101f5760405162461bcd60e51b815260206004820152601860248201527f416d6f756e74206578636565647320616c6c6f77616e636500000000000000006044820152606401610d6e565b61102a858585613835565b6110765760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f2065786563757465207472616e7366657246726f6d00006044820152606401610d6e565b61108a85336110858685615cc0565b613700565b505060018080555b9392505050565b6110a161357e565b600a546201000090046001600160a01b03166110d05760405163d311bc3960e01b815260040160405180910390fd5b335f908152601e602052604090206002015460ff166111025760405163a2df1a7b60e01b815260040160405180910390fd5b335f908152601e60205260409020600101541561114457335f908152601e6020526040812060010154601d80549192909161113e908490615cc0565b90915550505b335f908152601e602052604081206001015561115f60018055565b565b61116961357e565b600a546201000090046001600160a01b03166111985760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b031633146111c357604051633a8b134f60e11b815260040160405180910390fd5b6111cc81613a47565b806001600160a01b03166328a070256040518163ffffffff1660e01b81526004015f604051808303815f87803b158015611204575f80fd5b505af1158015611216573d5f803e3d5ffd5b50505050610d8560018055565b61122b61357e565b600a546201000090046001600160a01b031661125a5760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146112845760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381166112ab5760405163e6c4247b60e01b815260040160405180910390fd5b601380546001600160a01b0319166001600160a01b0383161790556001805550565b6112d561357e565b600a546201000090046001600160a01b03166113045760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b0316331461132f57604051633a8b134f60e11b815260040160405180910390fd5b61133883613a47565b604051632140fc7760e11b815260048101839052602481018290526001600160a01b03841690634281f8ee906044015b5f604051808303815f87803b15801561137f575f80fd5b505af1158015611391573d5f803e3d5ffd5b5050505061139e60018055565b505050565b6113ab61357e565b600a546201000090046001600160a01b03166113da5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b0316331461140557604051633a8b134f60e11b815260040160405180910390fd5b61140e83613a47565b604051633b8fc6f760e21b815260048101839052602481018290526001600160a01b0384169063ee3f1bdc90604401611368565b5f6005545f148061145957505f6114576135d7565b115b611463575f610e1f565b5050600c5490565b5f54610100900460ff161580801561148957505f54600160ff909116105b806114a25750303b1580156114a257505f5460ff166001145b6115055760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d6e565b5f805460ff191660011790558015611526575f805461ff0019166101001790555b6001600160a01b03851661154d57604051638b50645160e01b815260040160405180910390fd5b6002805460ff191660ff861617905560036115688482615d17565b5060046115758382615d17565b50600a805461ffff1916610101179055601b80546001600160a01b0319166001600160a01b03871617905580156115e5575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6115f461357e565b600a546201000090046001600160a01b03166116235760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b0316331461164d5760405162461bcd60e51b8152600401610d6e90615c3d565b601b546001600160a01b039081169082160361167c576040516339b9e47160e21b815260040160405180910390fd5b6001600160a01b0381165f908152600960205260409020805460ff19166001179055610d8560018055565b5f61109282613a82565b6116b961357e565b600a546201000090046001600160a01b03166116e85760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146117125760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381165f908152600960205260409020805460ff19169055610d8560018055565b61174261357e565b600a546201000090046001600160a01b03166117715760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b0316331461179b5760405162461bcd60e51b8152600401610d6e90615c3d565b6126ac81106117bd5760405163cd4e616760e01b815260040160405180910390fd5b600e819055610d8560018055565b6117d361357e565b600a546201000090046001600160a01b03166118025760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b0316331461182c5760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381165f9081526009602052604090205460ff161561186557604051631f7b776b60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa1580156118a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118cd9190615c26565b600a549091506001600160a01b03620100009091048116908416036118f7576118f7600180613ace565b611902838383613b3b565b604080518281526001600160a01b03858116602083015284168183015290517f853009bb99110572d2d914b6a40e1d763158ebac968d169d09e41bf6c15fc97a9181900360600190a15061195560018055565b5050565b5f805f611967868686613b9e565b5f81815260156020526040812054600f549095509192506119949188918891889160ff9091169080613bd5565b915050935093915050565b5f6119a861357e565b600a546201000090046001600160a01b03166119d75760405163d311bc3960e01b815260040160405180910390fd5b600a5460ff16156119fb5760405163deeb694360e01b815260040160405180910390fd5b6001600160a01b0382161580611a1957506001600160a01b03821630145b15611a3757604051631e4ec46b60e01b815260040160405180910390fd5b335f9081526009602052604090205460ff1680611a6b57506001600160a01b0382165f9081526009602052604090205460ff165b15611a8957604051631f7b776b60e01b815260040160405180910390fd5b825f03611aa957604051637edcaddf60e01b815260040160405180910390fd5b611ab282611442565b831115611ad257604051632484557960e01b815260040160405180910390fd5b611adb83612676565b9050805f03611afd576040516334d1b1a560e11b815260040160405180910390fd5b610e3d33838584613c30565b611b1161357e565b600a546201000090046001600160a01b031615611b41576040516308db0db560e11b815260040160405180910390fd5b601b546001600160a01b03163314611b6b5760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b038516611b9257604051637e4cfdd760e01b815260040160405180910390fd5b6001600160a01b038416611bb957604051632e2bcb6360e01b815260040160405180910390fd5b6001600160a01b038316611be057604051632e947acb60e01b815260040160405180910390fd5b60188160ff1610611c04576040516370d79de560e11b815260040160405180910390fd5b600a805462010000600160b01b031916620100006001600160a01b03891602179055611c31898989613dc0565b601c80546001600160a01b038781166001600160a01b031992831617909255601f8054878416908316179055600b805486841690831617905560108c9055600f805460ff851660ff19909116179055600a805461ffff1916905560218054858416921682179055601b54604051636e998e1760e11b8152921660048301526201518060248301529063dd331c2e906044015f604051808303815f87803b158015611cd9575f80fd5b505af1158015611ceb573d5f803e3d5ffd5b50505050611cf860018055565b50505050505050505050565b5f80611d0e61357e565b600a546201000090046001600160a01b0316611d3d5760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff1615611d6657604051636022a9e760e01b815260040160405180910390fd5b335f9081526009602052604090205460ff1680611d9a57506001600160a01b0384165f9081526009602052604090205460ff165b80611dbc57506001600160a01b0383165f9081526009602052604090205460ff165b15611dda57604051631f7b776b60e01b815260040160405180910390fd5b5f805f611de988878933613e15565b601054909950939750919550935091505f03611e1157429350611e0e8383838a6141cd565b50505b505050611e1d60018055565b935093915050565b611e2d61357e565b600a546201000090046001600160a01b0316611e5c5760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff1615611e8557604051636022a9e760e01b815260040160405180910390fd5b6022546001600160a01b031633141580611ea75750336001600160a01b038316145b15611ec4576040516282b42960e81b815260040160405180910390fd5b335f9081526009602052604090205460ff1680611ef857506001600160a01b0382165f9081526009602052604090205460ff165b15611f16576040516309550c7760e01b815260040160405180910390fd5b5f805f80611f2685878833613e15565b9450945094509450507ff60d67b14614c8984f880fd3b3bc7ddc3c2913656340f454bf0c7431152bbda6338787845f898989604051611f6c989796959493929190615dd2565b60405180910390a15050505061195560018055565b5f6127106301e13380611f948585615cc0565b602354611f9f6135d7565b611fa99190615e16565b611fb39190615e16565b611fbd9190615e41565b6110929190615e41565b611fcf61357e565b600a546201000090046001600160a01b031615611fff576040516308db0db560e11b815260040160405180910390fd5b601b546001600160a01b031633146120295760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381166120505760405163d92e233d60e01b815260040160405180910390fd5b602280546001600160a01b0319166001600160a01b038316179055426024556001805550565b61207e61357e565b600a546201000090046001600160a01b03166120ad5760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146120d75760405162461bcd60e51b8152600401610d6e90615c3d565b6120e18282613ace565b61195560018055565b5f6120f361357e565b600a546201000090046001600160a01b03166121225760405163d311bc3960e01b815260040160405180910390fd5b600a5460ff16156121465760405163deeb694360e01b815260040160405180910390fd5b6001600160a01b038216158061216457506001600160a01b03821630145b1561218257604051631e4ec46b60e01b815260040160405180910390fd5b335f9081526009602052604090205460ff16806121b657506001600160a01b0382165f9081526009602052604090205460ff165b156121d457604051631f7b776b60e01b815260040160405180910390fd5b825f036121f4576040516334d1b1a560e11b815260040160405180910390fd5b6006548311156122175760405163fc3fc71f60e01b815260040160405180910390fd5b612220836125a0565b905061222b82611442565b81111561224b57604051632484557960e01b815260040160405180910390fd5b610e3d33838386613c30565b60038054610d9590615c74565b61226c61357e565b600a546201000090046001600160a01b031661229b5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b031633146122c657604051633a8b134f60e11b815260040160405180910390fd5b6122cf82613a47565b60405163354ead1160e11b8152600481018290526001600160a01b03831690636a9d5a22906024015b5f604051808303815f87803b15801561230f575f80fd5b505af1158015612321573d5f803e3d5ffd5b5050505061195560018055565b5f61233761357e565b612342338484613835565b9050610e1f60018055565b61235561357e565b600a546201000090046001600160a01b03166123845760405163d311bc3960e01b815260040160405180910390fd5b600a5460ff16156123a85760405163deeb694360e01b815260040160405180910390fd5b6022546001600160a01b031633146123d2576040516282b42960e81b815260040160405180910390fd5b805f036123f257604051631f2a200560e01b815260040160405180910390fd5b60225460405163b6f0815d60e01b8152600481018390525f916001600160a01b03169063b6f0815d90602401602060405180830381865afa158015612439573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061245d9190615c26565b90505f61246982612676565b9050612475848261454f565b604080516001600160a01b0386168152602081018390529081018390527fbfd4514577137cff686405fa116c0971d84836c03907ac066d98b10d6d691d569060600160405180910390a1505061195560018055565b5f806124d461357e565b600a546201000090046001600160a01b03166125035760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff161561252c57604051636022a9e760e01b815260040160405180910390fd5b335f9081526009602052604090205460ff168061256057506001600160a01b0383165f9081526009602052604090205460ff165b1561257e57604051631f7b776b60e01b815260040160405180910390fd5b61258a868686866141cd565b9150915061259760018055565b94509492505050565b5f610e1f8260016136d4565b5f604051633af6971f60e11b815260040160405180910390fd5b6125ce61357e565b600a546201000090046001600160a01b03166125fd5760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146126275760405162461bcd60e51b8152600401610d6e90615c3d565b612632838383613dc0565b61139e60018055565b5f80612648868686613b9e565b5f9081526018602090815260408083206001600160a01b03871684529091529020549150505b949350505050565b5f610e1f825f61380c565b61268961357e565b600a546201000090046001600160a01b03166126b85760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146126e25760405162461bcd60e51b8152600401610d6e90615c3d565b601280545f909155600a54600b5461270d916001600160a01b03620100009091048116911683613b3b565b5061115f60018055565b5f805f8061273e60105461012c4261272f9190615e54565b6127399190615e54565b61466b565b600f54929650909450925061275d9085908590859060ff165f80613bd5565b905090919293565b61276d61357e565b600a546201000090046001600160a01b031661279c5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b031633146127c757604051633a8b134f60e11b815260040160405180910390fd5b6127d082613a47565b604051636140e50d60e01b8152600481018290526001600160a01b03831690636140e50d906024016122f8565b6001600160a01b0381165f90815260076020526040812054610e1f90826136d4565b61282761357e565b600a546201000090046001600160a01b03166128565760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146128805760405162461bcd60e51b8152600401610d6e90615c3d565b5f61288d60245442611f81565b9050805f036128af57604051630e2c8a8960e31b815260040160405180910390fd5b426024819055508060125f8282546128c79190615e54565b90915550506001805550565b602081815481106128e2575f80fd5b5f918252602090912001546001600160a01b0316905081565b5f80612908868686613b9e565b5f9081526017602090815260408083206001600160a01b0387168452909152902054915050949350505050565b61293d61357e565b600a546201000090046001600160a01b031661296c5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b0316331461299757604051633a8b134f60e11b815260040160405180910390fd5b6129a081613a47565b6001600160a01b0381165f908152601e6020526040812080546001909101819055601d8054919283926129d4908490615e54565b92505081905550600260ff16826001600160a01b03166325af34cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a1c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a409190615e67565b60ff1614612a615760405163046c4b6360e51b815260040160405180910390fd5b600a54612a7e906201000090046001600160a01b03168383614690565b816001600160a01b0316638db579946040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612ab6575f80fd5b505af1158015612ac8573d5f803e3d5ffd5b5050600a54612aea92506201000090046001600160a01b03169050835f614690565b600460ff16826001600160a01b03166325af34cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b2b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b4f9190615e67565b60ff1614612b7057604051631025cc2560e01b815260040160405180910390fd5b600a54604051636eb1769f60e11b81523060048201526001600160a01b0384811660248301525f92620100009004169063dd62ed3e90604401602060405180830381865afa158015612bc4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612be89190615c26565b1115612c0a576040516001622e27f760e11b0319815260040160405180910390fd5b50610d8560018055565b612c1c61357e565b600a546201000090046001600160a01b0316612c4b5760405163d311bc3960e01b815260040160405180910390fd5b335f908152601e602052604090206002015460ff16612c7d5760405163a2df1a7b60e01b815260040160405180910390fd5b5f828210612c8b575f612c95565b612c958284615cc0565b335f908152601e602052604090206001015490915015612cda57335f908152601e6020526040812060010154601d805491929091612cd4908490615cc0565b90915550505b335f908152601e602052604090206001018190558015612d0b5780601d5f828254612d059190615e54565b90915550505b5061195560018055565b612d1d61357e565b601b546001600160a01b03163314612d475760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381161580612d6557506001600160a01b03811630145b15612d83576040516349e27cff60e01b815260040160405180910390fd5b601c546001600160a01b0390811690821603612db257604051630912536f60e01b815260040160405180910390fd5b601f546001600160a01b0390811690821603612de15760405163038d998760e31b815260040160405180910390fd5b6001600160a01b0381165f9081526009602052604090205460ff1615612e1a57604051631f7b776b60e01b815260040160405180910390fd5b601b546001600160a01b0316612e2f826147a3565b6040516001600160a01b03831660248201525f9060440160408051601f19818403018152918152602080830180516001600160e01b031663f2fde38b60e01b1790529051612e7e92910161572d565b60408051808303601f19018152908290528051602090910120602154631f229a2f60e31b8352600483018290526001600160a01b0385811660248501528681166044850152919350169063f914d178906064015f604051808303815f87803b158015612ee8575f80fd5b505af1158015612efa573d5f803e3d5ffd5b505050505050610d8560018055565b612f1161357e565b600a546201000090046001600160a01b0316612f405760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff1615612f6957604051636022a9e760e01b815260040160405180910390fd5b805f03612f89576040516334e33ddb60e01b815260040160405180910390fd5b335f9081526009602052604090205460ff1615612fb957604051631f7b776b60e01b815260040160405180910390fd5b6013546001600160a01b0316612fe257604051631c202a9560e01b815260040160405180910390fd5b5f612fee858585613b9e565b5f818152601460205260408120600101549192500361302057604051630683f18b60e41b815260040160405180910390fd5b600f546130379086908690869060ff165f80613bd5565b61304361012c42615e54565b10156130625760405163085de62560e01b815260040160405180910390fd5b5f818152601560205260408120548310613089575f8281526015602052604090205461308b565b825b5f838152601560205260408120549192508267ffffffffffffffff8111156130b5576130b5615468565b6040519080825280602002602001820160405280156130de578160200160208202803683370190505b5090505f8367ffffffffffffffff8111156130fb576130fb615468565b604051908082528060200260200182016040528015613124578160200160208202803683370190505b5090505f80808681875b6131388a8a615cc0565b811115613333575f8b8152601560205260409020613157600183615cc0565b8154811061316757613167615e82565b5f918252602090912001546001600160a01b031691508261318781615e96565b9350508188848151811061319d5761319d615e82565b6001600160a01b039283166020918202929092018101919091525f8d8152601782526040808220938616825292909152205487518890859081106131e3576131e3615e82565b60200260200101818152505086838151811061320157613201615e82565b6020026020010151846132149190615e54565b5f8c81526018602090815260408083206001600160a01b03871684529091529020549094506132439086615e54565b5f8c81526019602090815260408083206001600160a01b03871684529091529020549095506132729087615e54565b5f8c81526017602090815260408083206001600160a01b0387168085529083528184208490558f84526018835281842081855283528184208490558f84526019835281842090845282528083208390558e835260159091529020805491975090806132df576132df615eab565b5f828152602080822083015f1990810180546001600160a01b03191690559092019092558c82526016815260408083206001600160a01b03861684529091528120558061332b81615e96565b91505061312e565b508360115f8282546133459190615cc0565b925050819055508460125f82825461335d9190615e54565b90915550505f8a81526014602052604081206001018054859290613382908490615cc0565b90915550505f8a815260146020526040812080548692906133a4908490615cc0565b9091555050600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa1580156133f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134199190615c26565b9050838110156134625760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610d6e565b61346c30866147f4565b6134778b898961491c565b6134818482615cc0565b600a546040516370a0823160e01b8152306004820152620100009091046001600160a01b0316906370a0823190602401602060405180830381865afa1580156134cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134f09190615c26565b146135345760405162461bcd60e51b815260206004820152601460248201527310985b185b98d94818da1958dac819985a5b195960621b6044820152606401610d6e565b505050505050505050505061354860018055565b50505050565b5f805f61355c868686613b9e565b5f90815260146020526040902080546001909101549097909650945050505050565b6002600154036135d05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d6e565b6002600155565b5f806135e1614ae2565b6022546040516308ef5ffd60e01b81523060048201529192505f916001600160a01b03909116906308ef5ffd90602401602060405180830381865afa15801561362c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136509190615c26565b60225460405163b6f0815d60e01b8152600481018390529192505f916001600160a01b039091169063b6f0815d90602401602060405180830381865afa15801561369c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c09190615c26565b90506136cc8184615e54565b935050505090565b5f6005545f146136fa576136f56136e96135d7565b60055485919085614b5f565b611092565b82611092565b6001600160a01b0382166137565760405162461bcd60e51b815260206004820152601960248201527f6e6f6e2d7a65726f207370656e646572207265717569726564000000000000006044820152606401610d6e565b6001600160a01b0383166137ac5760405162461bcd60e51b815260206004820152601760248201527f6e6f6e2d7a65726f206f776e65722072657175697265640000000000000000006044820152606401610d6e565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f82158061381a5750600554155b6136fa576136f560055461382c6135d7565b85919085614b5f565b5f6001600160a01b03831661388c5760405162461bcd60e51b815260206004820152601960248201527f6e6f6e2d7a65726f2061646472657373207265717569726564000000000000006044820152606401610d6e565b6001600160a01b0384166138e25760405162461bcd60e51b815260206004820152601860248201527f6e6f6e2d7a65726f2073656e64657220726571756972656400000000000000006044820152606401610d6e565b5f82116139295760405162461bcd60e51b8152602060048201526015602482015274416d6f756e742063616e6e6f74206265207a65726f60581b6044820152606401610d6e565b6001600160a01b0384165f908152600760205260409020548211156139905760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e7420657863656564732073656e6465722062616c616e63650000006044820152606401610d6e565b6001600160a01b0384165f908152600760205260409020546139b3908390615cc0565b6001600160a01b038086165f9081526007602052604080822093909355908516815220546139e2908390615e54565b6001600160a01b038085165f8181526007602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90613a359086815260200190565b60405180910390a35060019392505050565b6001600160a01b0381165f908152601e602052604090206002015460ff16610d855760405163a2df1a7b60e01b815260040160405180910390fd5b5f80613a8e835f6136d4565b91508190505f80600e541115613ac85761271083600e54613aaf9190615e16565b613ab99190615e41565b9050613ac58184615cc0565b91505b50915091565b600a805461ffff191683151561ff00191617610100831515810291909117918290556040805160ff8085161515825292909304909116151560208301527f559628b27717ff2f5863f3a218839e17c6bc1b900e9de0dc2b3dc365068841d791015b60405180910390a15050565b6040516001600160a01b03831660248201526044810182905261139e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614bba565b6040805160208082019590955280820193909352606080840192909252805180840390920182526080909201909152805191012090565b5f81613be2603c85615e16565b613bee610e1087615e16565b62015180613bfd8b8b8b614c8b565b613c079190615e16565b613c119190615e54565b613c1b9190615e54565b613c259190615e54565b979650505050505050565b600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613c7c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613ca09190615c26565b613caa9084615e54565b600a54909150613ccb906201000090046001600160a01b0316863086614df1565b600a546040516370a0823160e01b815230600482015282916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613d17573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613d3b9190615c26565b14613d5957604051630a85404160e11b815260040160405180910390fd5b613d63848361454f565b836001600160a01b0316856001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78585604051613db1929190918252602082015260400190565b60405180910390a35050505050565b825f03613de057604051637fb1277b60e01b815260040160405180910390fd5b815f03613e005760405163e8498be360e01b815260040160405180910390fd5b613e0981614e29565b50600c91909155600d55565b5f80808080306001600160a01b03891603613e4357604051634971ba2d60e01b815260040160405180910390fd5b885f03613e63576040516334d1b1a560e11b815260040160405180910390fd5b6001600160a01b0388165f90815260076020526040902054891115613e9b57604051633999656760e01b815260040160405180910390fd5b5f80613ea68b613a82565b91509150613eb38a6127fd565b821115613ed357604051631b6132ab60e31b815260040160405180910390fd5b805f03613ef357604051631fbaba3560e01b815260040160405180910390fd5b5f613efe8284615cc0565b9050819350613f1760105461012c4261272f9190615e54565b919850965094505f613f2a888888613b9e565b600f54909150613f449089908990899060ff165f80613bd5565b98508b6001600160a01b03168a6001600160a01b031614613f6a57613f6a8c8b8f614eb8565b613f758c308f613835565b505f8181526014602052604081206001018054869290613f96908490615e54565b90915550505f81815260146020526040812080548f9290613fb8908490615e54565b925050819055508c60115f828254613fd09190615e54565b90915550505f8181526017602090815260408083206001600160a01b038f168452909152812054900361409e5760155f8281526020019081526020015f208b908060018154018082558091505060019003905f5260205f20015f9091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060155f8281526020019081526020015f208054905060165f8381526020019081526020015f205f8d6001600160a01b03166001600160a01b031681526020019081526020015f20819055505b5f8181526017602090815260408083206001600160a01b038f168452909152812080548592906140cf908490615e54565b90915550505f8181526018602090815260408083206001600160a01b038f168452909152812080548f9290614105908490615e54565b90915550505f8181526019602090815260408083206001600160a01b038f1684529091528120805484929061413b908490615e54565b9250508190555042601a5f8381526020019081526020015f205f8d6001600160a01b03166001600160a01b031681526020019081526020015f20819055507ff60d67b14614c8984f880fd3b3bc7ddc3c2913656340f454bf0c7431152bbda68c8c8f87868d8d8d6040516141b6989796959493929190615dd2565b60405180910390a150505050945094509450945094565b604080516020808201879052818301869052606080830186905283518084039091018152608090920183528151918101919091205f818152601883528381206001600160a01b03861682529092529181205490918291808303614243576040516339c556cd60e11b815260040160405180910390fd5b5f8281526017602090815260408083206001600160a01b0389168085529083528184205486855260198452828520918552925290912054601054156142c457600f54614299908b908b908b9060ff165f80613bd5565b6142a561012c42615e54565b10156142c45760405163085de62560e01b815260040160405180910390fd5b5f8481526017602090815260408083206001600160a01b038b1680855290835281842084905587845260188352818420818552835281842084905587845260198352818420908452825280832083905586835260149091528120805485929061432e908490615cc0565b9091555061433e90508183615e54565b5f858152601460205260408120600101805490919061435e908490615cc0565b925050819055508260115f8282546143769190615cc0565b925050819055508060125f82825461438e9190615e54565b9091555061439e90508488614f44565b6143a830846147f4565b5f848152601a602090815260408083206001600160a01b038b16808552908352818420548251878152429481019490945291830152606082015260808101919091527fa6f30f7bcb55dd97fe6efdedd57aa5ee608cf66171304f643b791c6f37f495899060a00160405180910390a1600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015614463573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906144879190615c26565b600a549091506144a7906201000090046001600160a01b03168985613b3b565b600a546040516370a0823160e01b8152306004820152620100009091046001600160a01b0316906370a0823190602401602060405180830381865afa1580156144f2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145169190615c26565b6145208483615cc0565b101561453f57604051630a85404160e11b815260040160405180910390fd5b5091999098509650505050505050565b5f811161458f5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610d6e565b61459881615129565b6145e45760405162461bcd60e51b815260206004820152601860248201527f4d617820737570706c79206c696d6974207265616368656400000000000000006044820152606401610d6e565b8060055f8282546145f59190615e54565b90915550506001600160a01b0382165f9081526007602052604081208054839290614621908490615e54565b90915550506040518181526001600160a01b038316905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b5f808061468361467e6201518086615e41565b615143565b9196909550909350915050565b8015806147085750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156146e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147069190615c26565b155b6147735760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610d6e565b6040516001600160a01b03831660248201526044810182905261139e90849063095ea7b360e01b90606401613b67565b601b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f81116148345760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610d6e565b6001600160a01b0382165f9081526007602052604090205481111561489b5760405162461bcd60e51b815260206004820152601b60248201527f4275726e20616d6f756e7420657863656564732062616c616e636500000000006044820152606401610d6e565b6001600160a01b0382165f90815260076020526040812080548392906148c2908490615cc0565b925050819055508060055f8282546148da9190615cc0565b90915550506040518181525f906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161465f565b5f805b83518110156115e55760095f85838151811061493d5761493d615e82565b6020908102919091018101516001600160a01b031682528101919091526040015f205460ff166149865783818151811061497957614979615e82565b6020026020010151614993565b6013546001600160a01b03165b91507fa6f30f7bcb55dd97fe6efdedd57aa5ee608cf66171304f643b791c6f37f495898382815181106149c8576149c8615e82565b6020026020010151428684815181106149e3576149e3615e82565b6020026020010151601a5f8a81526020019081526020015f205f898781518110614a0f57614a0f615e82565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205460095f8a8881518110614a4c57614a4c615e82565b6020908102919091018101516001600160a01b0390811683528282019390935260409182015f2054825197885290870195909552921684830152606084015260ff90911615156080830152519081900360a00190a1614ada600a60029054906101000a90046001600160a01b031683858481518110614acd57614acd615e82565b6020026020010151613b3b565b60010161491f565b600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015614b2e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614b529190615c26565b601d54610d089190615e54565b5f80614b6c8686866152b2565b90506001836002811115614b8257614b82615ebf565b148015614b9e57505f8480614b9957614b99615e2d565b868809115b15614bb157614bae600182615e54565b90505b95945050505050565b5f614c0e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661535b9092919063ffffffff16565b80519091501561139e5780806020019051810190614c2c9190615ed3565b61139e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610d6e565b5f6107b2841015614cc65760405162461bcd60e51b815260206004820152600560248201526422b93937b960d91b6044820152606401610d6e565b8383835f62253d8c60046064600c614cdf600e88615eee565b614ce99190615f14565b614cf588611324615f40565b614cff9190615f40565b614d099190615f14565b614d14906003615f67565b614d1e9190615f14565b600c80614d2c600e88615eee565b614d369190615f14565b614d4190600c615f67565b614d4c600288615eee565b614d569190615eee565b614d629061016f615f67565b614d6c9190615f14565b6004600c614d7b600e89615eee565b614d859190615f14565b614d91896112c0615f40565b614d9b9190615f40565b614da7906105b5615f67565b614db19190615f14565b614dbd617d4b87615eee565b614dc79190615f40565b614dd19190615f40565b614ddb9190615eee565b614de59190615eee565b98975050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526135489085906323b872dd60e01b90608401613b67565b5f81118015614e39575060055481115b614e7a5760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964206d617820737570706c7960701b6044820152606401610d6e565b600680549082905560408051828152602081018490527fe4fd3e707c42fe7e4405214e86e4f796ecfa58dfe4d17def31221e34e2e4b2b59101613b2f565b6001600160a01b038084165f908152600860209081526040808320938616835292905220545f1981146135485781811015614f355760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610d6e565b61354884846110858585615cc0565b5f8281526016602090815260408083206001600160a01b0385168452909152812054614f7290600190615cc0565b5f8481526015602052604081208054929350614f8f600184615cc0565b81548110614f9f57614f9f615e82565b5f918252602090912001546001600160a01b039081169150841681146150c3575f858152601560205260409020805484908110614fde57614fde615e82565b5f918252602080832090910154878352601590915260409091206001600160a01b039091169061500f600185615cc0565b8154811061501f5761501f615e82565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508060155f8781526020019081526020015f20848154811061506d5761506d615e82565b5f91825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556150a0836001615e54565b5f8681526016602090815260408083206001600160a01b03861684529091529020555b5f8581526015602052604090208054806150df576150df615eab565b5f828152602080822083015f1990810180546001600160a01b03191690559092019092559581526016865260408082206001600160a01b0396909616825294909552505050812055565b5f8160055460065461513b9190615cc0565b101592915050565b5f8080838162253d8c6151598362010bd9615f40565b6151639190615f40565b90505f62023ab1615175836004615f67565b61517f9190615f14565b905060046151908262023ab1615f67565b61519b906003615f40565b6151a59190615f14565b6151af9083615eee565b91505f62164b096151c1846001615f40565b6151cd90610fa0615f67565b6151d79190615f14565b905060046151e7826105b5615f67565b6151f19190615f14565b6151fb9084615eee565b61520690601f615f40565b92505f61098f615217856050615f67565b6152219190615f14565b90505f60506152328361098f615f67565b61523c9190615f14565b6152469086615eee565b9050615253600b83615f14565b945061526085600c615f67565b61526b836002615f40565b6152759190615eee565b91508483615284603187615eee565b61528f906064615f67565b6152999190615f40565b6152a39190615f40565b9a919950975095505050505050565b5f80805f19858709858702925082811083820303915050805f036152e9578382816152df576152df615e2d565b0492505050611092565b8084116152f4575f80fd5b5f8486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091025f889003889004909101858311909403939093029303949094049190911702949350505050565b606061266e84845f85855f80866001600160a01b031685876040516153809190615f96565b5f6040518083038185875af1925050503d805f81146153ba576040519150601f19603f3d011682016040523d82523d5f602084013e6153bf565b606091505b5091509150613c2587838387606083156154395782515f03615432576001600160a01b0385163b6154325760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d6e565b508161266e565b61266e838381511561544e5781518083602001fd5b8060405162461bcd60e51b8152600401610d6e919061572d565b634e487b7160e01b5f52604160045260245ffd5b604051610280810167ffffffffffffffff811182821017156154a0576154a0615468565b60405290565b5f82601f8301126154b5575f80fd5b813567ffffffffffffffff8111156154cf576154cf615468565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156154fe576154fe615468565b604052818152838201602001851015615515575f80fd5b816020850160208301375f918101602001919091529392505050565b6001600160a01b0381168114610d85575f80fd5b8035610cfa81615531565b8015158114610d85575f80fd5b8035610cfa81615550565b5f60208284031215615578575f80fd5b813567ffffffffffffffff81111561558e575f80fd5b820161028081850312156155a0575f80fd5b6155a861547c565b813581526020808301359082015260408083013590820152606080830135908201526080808301359082015260a0808301359082015260c0808301359082015260e080830135908201526101008083013590820152610120808301359082015261014082013567ffffffffffffffff811115615622575f80fd5b61562e868285016154a6565b610140830152506156426101608301615545565b6101608201526156556101808301615545565b6101808201526156686101a08301615545565b6101a082015261567b6101c08301615545565b6101c082015261568e6101e08301615545565b6101e08201526156a16102008301615545565b6102008201526156b46102208301615545565b6102208201526156c76102408301615545565b6102408201526156da610260830161555d565b610260820152949350505050565b5f602082840312156156f8575f80fd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61109260208301846156ff565b5f8060408385031215615750575f80fd5b823561575b81615531565b946020939093013593505050565b5f805f6060848603121561577b575f80fd5b833561578681615531565b9250602084013561579681615531565b929592945050506040919091013590565b5f602082840312156157b7575f80fd5b813561109281615531565b5f805f606084860312156157d4575f80fd5b83356157df81615531565b95602085013595506040909401359392505050565b60ff81168114610d85575f80fd5b5f805f8060808587031215615815575f80fd5b843561582081615531565b93506020850135615830816157f4565b9250604085013567ffffffffffffffff81111561584b575f80fd5b615857878288016154a6565b925050606085013567ffffffffffffffff811115615873575f80fd5b61587f878288016154a6565b91505092959194509250565b5f806040838503121561589c575f80fd5b82356158a781615531565b915060208301356158b781615531565b809150509250929050565b5f805f606084860312156158d4575f80fd5b505081359360208301359350604090920135919050565b5f80604083850312156158fc575f80fd5b8235915060208301356158b781615531565b5f805f805f805f805f806101408b8d031215615928575f80fd5b8a35995060208b0135985060408b0135975060608b0135965060808b013561594f81615531565b955060a08b013561595f81615531565b945060c08b013561596f81615531565b935060e08b013561597f81615531565b92506101008b013561599081615531565b91506101208b01356159a1816157f4565b809150509295989b9194979a5092959850565b5f805f606084860312156159c6575f80fd5b8335925060208401356159d881615531565b915060408401356159e881615531565b809150509250925092565b5f8060408385031215615a04575f80fd5b50508035926020909101359150565b5f8060408385031215615a24575f80fd5b8235615a2f81615550565b915060208301356158b781615550565b5f805f8060808587031215615a52575f80fd5b8435935060208501359250604085013591506060850135615a7281615531565b939692955090935050565b5f805f8060808587031215615a90575f80fd5b5050823594602084013594506040840135936060013592509050565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e082015260e08201516101008201526101008201516101208201526101208201516101408201525f610140830151610280610160840152615b346102a08401826156ff565b9050610160840151615b526101808501826001600160a01b03169052565b506101808401516001600160a01b0381166101a0850152506101a08401516001600160a01b0381166101c0850152506101c08401516001600160a01b0381166101e0850152506101e08401516001600160a01b038116610200850152506102008401516001600160a01b038116610220850152506102208401516001600160a01b038116610240850152506102408401516001600160a01b03811661026085015250610260840151801515610280850152509392505050565b5f60208284031215615c1b575f80fd5b815161109281615531565b5f60208284031215615c36575f80fd5b5051919050565b60208082526017908201527f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b600181811c90821680615c8857607f821691505b602082108103615ca657634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610e1f57610e1f615cac565b601f82111561139e57805f5260205f20601f840160051c81016020851015615cf85750805b601f840160051c820191505b818110156115e5575f8155600101615d04565b815167ffffffffffffffff811115615d3157615d31615468565b615d4581615d3f8454615c74565b84615cd3565b6020601f821160018114615d77575f8315615d605750848201515b5f19600385901b1c1916600184901b1784556115e5565b5f84815260208120601f198516915b82811015615da65787850151825560209485019460019092019101615d86565b5084821015615dc357868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a083015260c082015260e08101919091526101000190565b8082028115828204841417610e1f57610e1f615cac565b634e487b7160e01b5f52601260045260245ffd5b5f82615e4f57615e4f615e2d565b500490565b80820180821115610e1f57610e1f615cac565b5f60208284031215615e77575f80fd5b8151611092816157f4565b634e487b7160e01b5f52603260045260245ffd5b5f81615ea457615ea4615cac565b505f190190565b634e487b7160e01b5f52603160045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f60208284031215615ee3575f80fd5b815161109281615550565b8181035f831280158383131683831282161715615f0d57615f0d615cac565b5092915050565b5f82615f2257615f22615e2d565b600160ff1b82145f1984141615615f3b57615f3b615cac565b500590565b8082018281125f831280158216821582161715615f5f57615f5f615cac565b505092915050565b8082025f8212600160ff1b84141615615f8257615f82615cac565b8181058314821517610e1f57610e1f615cac565b5f82518060208501845e5f92019182525091905056fea26469706673582212209d6d370d93cfe9a2c96b0be1764308f0dc95de6c30a43fff3fce647aa92bc08c64736f6c634300081a0033
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106104a5575f3560e01c806394bf804d1161026e578063cc1d047111610156578063e74a4bca116100ca578063ef8b30f71161008f578063ef8b30f7146108dc578063f2fde38b14610a38578063f3cbf47c14610a4b578063fe575a8714610a5e578063fecb69b914610a80578063ff3c63c014610a93575f80fd5b8063e74a4bca146109f5578063e75c7a09146109fd578063e91e918314610a10578063e976d43114610a1d578063e9f2838e14610a26575f80fd5b8063d961b58c1161011b578063d961b58c14610968578063da354efa14610971578063dc68a93a14610984578063dd62ed3e14610997578063e2eb36b9146109cf578063e48f6faf146109e2575f80fd5b8063cc1d047114610932578063ce96cb7714610945578063d3a8d71814610958578063d5abeb0114610960578063d905777e14610716575f80fd5b8063b460af94116101ed578063c4283470116101b2578063c4283470146108be578063c63d75b6146108c7578063c6e6f592146108dc578063c8796572146108ef578063ca55a557146108f7578063cc0e3f2c1461091f575f80fd5b8063b460af9414610885578063ba08765214610885578063ba4bb7a4146105ac578063baaa19fb14610898578063be1f9214146108ab575f80fd5b8063a9059cbb11610233578063a9059cbb1461082f578063b2f596ef14610842578063b3c6501514610855578063b3c9e83d1461085f578063b3d7f6b914610872575f80fd5b806394bf804d146107e557806395d89b41146107f85780639cb43f81146108005780639cf160f614610809578063a2aa660f1461081c575f80fd5b806344337ea111610391578063739010b51161031057806386beee07116102d557806386beee07146107935780638bc7e8c4146107a65780638c0190e3146107af5780638da5cb5b146107c25780638ed83271146107d35780638fa243c6146107dc575f80fd5b8063739010b51461073e57806373f351c8146107515780637d41c86e1461075a5780638260910c1461076d578063835e9eb414610780575f80fd5b806360da3e831161035657806360da3e83146106bb5780636382d9ad146106c85780636c46407b146106db5780636e553f651461070357806370a0823114610716575f80fd5b806344337ea11461065c57806344caa1221461066f5780634cdad50614610682578063537df3b614610695578063569b8e2c146106a8575f80fd5b806324e86d6711610428578063339eeb68116103ed578063339eeb68146105e657806334c16b5c146105f957806338867fd41461060c57806338d52e0f1461061f578063402d267d1461063657806342fe098014610649575f80fd5b806324e86d671461059057806327d9ef5f146105995780632a33cf05146105ac5780632f865568146105b4578063313ce567146105c7575f80fd5b8063095ea7b31161046e578063095ea7b31461052c5780630a28a4771461054f57806318160ddd14610562578063184466c91461056a57806323b872dd1461057d575f80fd5b806251e611146104a957806301e1d114146104d9578063030d624a146104ef57806306fdde031461050457806307a2d13a14610519575b5f80fd5b6104bc6104b7366004615568565b610aa6565b6040516001600160a01b0390911681526020015b60405180910390f35b6104e1610cff565b6040519081526020016104d0565b6105026104fd3660046156e8565b610d0d565b005b61050c610d88565b6040516104d0919061572d565b6104e16105273660046156e8565b610e14565b61053f61053a36600461573f565b610e25565b60405190151581526020016104d0565b6104e161055d3660046156e8565b610e46565b6005546104e1565b6105026105783660046156e8565b610e52565b61053f61058b366004615769565b610fa3565b6104e160105481565b601f546104bc906001600160a01b031681565b610502611099565b6105026105c23660046157a7565b611161565b6002546105d49060ff1681565b60405160ff90911681526020016104d0565b6105026105f43660046157a7565b611223565b6105026106073660046157c2565b6112cd565b61050261061a3660046157c2565b6113a3565b600a546201000090046001600160a01b03166104bc565b6104e16106443660046157a7565b611442565b610502610657366004615802565b61146b565b61050261066a3660046157a7565b6115ec565b601c546104bc906001600160a01b031681565b6104e16106903660046156e8565b6116a7565b6105026106a33660046157a7565b6116b1565b6105026106b63660046156e8565b61173a565b600a5461053f9060ff1681565b6105026106d636600461588b565b6117cb565b6106ee6106e93660046158c2565b611959565b604080519283526020830191909152016104d0565b6104e16107113660046158eb565b61199f565b6104e16107243660046157a7565b6001600160a01b03165f9081526007602052604090205490565b61050261074c36600461590e565b611b09565b6104e160235481565b6106ee6107683660046159b4565b611d04565b61050261077b36600461573f565b611e25565b6104e161078e3660046159f3565b611f81565b6105026107a13660046157a7565b611fc7565b6104e1600e5481565b6105026107bd366004615a13565b612076565b601b546001600160a01b03166104bc565b6104e1600c5481565b6104e1601d5481565b6104e16107f33660046158eb565b6120ea565b61050c612257565b6104e160115481565b600b546104bc906001600160a01b031681565b61050261082a36600461573f565b612264565b61053f61083d36600461573f565b61232e565b61050261085036600461573f565b61234d565b5f5460ff166105d4565b6106ee61086d366004615a3f565b6124ca565b6104e16108803660046156e8565b6125a0565b6104e16108933660046159b4565b6125ac565b6105026108a63660046158c2565b6125c6565b6104e16108b9366004615a3f565b61263b565b6104e160245481565b6104e16108d53660046157a7565b5060065490565b6104e16108ea3660046156e8565b612676565b610502612681565b6108ff612717565b6040805194855260208501939093529183015260608201526080016104d0565b6013546104bc906001600160a01b031681565b61050261094036600461573f565b612765565b6104e16109533660046157a7565b6127fd565b61050261281f565b6006546104e1565b6104e160125481565b6104bc61097f3660046156e8565b6128d3565b6104e1610992366004615a3f565b6128fb565b6104e16109a536600461588b565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b6021546104bc906001600160a01b031681565b6105026109f03660046157a7565b612935565b6020546104e1565b610502610a0b3660046159f3565b612c14565b600f546105d49060ff1681565b6104e1600d5481565b600a5461053f90610100900460ff1681565b610502610a463660046157a7565b612d15565b610502610a59366004615a7d565b612f09565b61053f610a6c3660046157a7565b60096020525f908152604090205460ff1681565b6022546104bc906001600160a01b031681565b6106ee610aa13660046158c2565b61354e565b5f610aaf61357e565b600a546201000090046001600160a01b0316610ade5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b03163314610b0957604051633a8b134f60e11b815260040160405180910390fd5b30610160830152601f546040516251e61160e01b81525f916001600160a01b0316906251e61190610b3e908690600401615aac565b6020604051808303815f875af1158015610b5a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7e9190615c0b565b6001600160a01b0381165f908152601e602052604090206002015490915060ff1615610bbd576040516361ef5ed760e11b815260040160405180910390fd5b5f816001600160a01b0316636acc83026040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bfa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c1e9190615c26565b604080516060810182528281525f602080830182815260018486018181526001600160a01b038a16808652601e855287862096518755925186830155516002909501805460ff19169515159590951790945581549384018255918190527fc97bfaf2f8ee708c303a06d134f5ecd8389ae0432af62dc132a24118292866bb90920180546001600160a01b0319168217905560808801518351918252918101919091529192507f91e8e0724fa073d770149830b6e9c1f6027b484a27617dc901ac8795338e4b49910160405180910390a1509050610cfa60018055565b919050565b5f610d086135d7565b905090565b610d1561357e565b600a546201000090046001600160a01b0316610d445760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b03163314610d775760405162461bcd60e51b8152600401610d6e90615c3d565b60405180910390fd5b6023819055610d8560018055565b50565b60048054610d9590615c74565b80601f0160208091040260200160405190810160405280929190818152602001828054610dc190615c74565b8015610e0c5780601f10610de357610100808354040283529160200191610e0c565b820191905f5260205f20905b815481529060010190602001808311610def57829003601f168201915b505050505081565b5f610e1f825f6136d4565b92915050565b5f610e2e61357e565b610e39338484613700565b5060015b610e1f60018055565b5f610e1f82600161380c565b610e5a61357e565b600a546201000090046001600160a01b0316610e895760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b03163314610eb35760405162461bcd60e51b8152600401610d6e90615c3d565b6010548111610edd5760115415610edd5760405163f551d9d160e01b815260040160405180910390fd5b6010819055604051602481018290525f9060440160408051601f19818403018152918152602080830180516001600160e01b031663184466c960e01b1790529051610f2992910161572d565b60408051808303601f1901815290829052805160209091012060215463af6f8c1b60e01b8352600483018290529092506001600160a01b03169063af6f8c1b906024015f604051808303815f87803b158015610f83575f80fd5b505af1158015610f95573d5f803e3d5ffd5b5050505050610d8560018055565b5f610fac61357e565b6001600160a01b0384165f9081526008602090815260408083203384529091529020548281101561101f5760405162461bcd60e51b815260206004820152601860248201527f416d6f756e74206578636565647320616c6c6f77616e636500000000000000006044820152606401610d6e565b61102a858585613835565b6110765760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f2065786563757465207472616e7366657246726f6d00006044820152606401610d6e565b61108a85336110858685615cc0565b613700565b505060018080555b9392505050565b6110a161357e565b600a546201000090046001600160a01b03166110d05760405163d311bc3960e01b815260040160405180910390fd5b335f908152601e602052604090206002015460ff166111025760405163a2df1a7b60e01b815260040160405180910390fd5b335f908152601e60205260409020600101541561114457335f908152601e6020526040812060010154601d80549192909161113e908490615cc0565b90915550505b335f908152601e602052604081206001015561115f60018055565b565b61116961357e565b600a546201000090046001600160a01b03166111985760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b031633146111c357604051633a8b134f60e11b815260040160405180910390fd5b6111cc81613a47565b806001600160a01b03166328a070256040518163ffffffff1660e01b81526004015f604051808303815f87803b158015611204575f80fd5b505af1158015611216573d5f803e3d5ffd5b50505050610d8560018055565b61122b61357e565b600a546201000090046001600160a01b031661125a5760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146112845760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381166112ab5760405163e6c4247b60e01b815260040160405180910390fd5b601380546001600160a01b0319166001600160a01b0383161790556001805550565b6112d561357e565b600a546201000090046001600160a01b03166113045760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b0316331461132f57604051633a8b134f60e11b815260040160405180910390fd5b61133883613a47565b604051632140fc7760e11b815260048101839052602481018290526001600160a01b03841690634281f8ee906044015b5f604051808303815f87803b15801561137f575f80fd5b505af1158015611391573d5f803e3d5ffd5b5050505061139e60018055565b505050565b6113ab61357e565b600a546201000090046001600160a01b03166113da5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b0316331461140557604051633a8b134f60e11b815260040160405180910390fd5b61140e83613a47565b604051633b8fc6f760e21b815260048101839052602481018290526001600160a01b0384169063ee3f1bdc90604401611368565b5f6005545f148061145957505f6114576135d7565b115b611463575f610e1f565b5050600c5490565b5f54610100900460ff161580801561148957505f54600160ff909116105b806114a25750303b1580156114a257505f5460ff166001145b6115055760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d6e565b5f805460ff191660011790558015611526575f805461ff0019166101001790555b6001600160a01b03851661154d57604051638b50645160e01b815260040160405180910390fd5b6002805460ff191660ff861617905560036115688482615d17565b5060046115758382615d17565b50600a805461ffff1916610101179055601b80546001600160a01b0319166001600160a01b03871617905580156115e5575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b6115f461357e565b600a546201000090046001600160a01b03166116235760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b0316331461164d5760405162461bcd60e51b8152600401610d6e90615c3d565b601b546001600160a01b039081169082160361167c576040516339b9e47160e21b815260040160405180910390fd5b6001600160a01b0381165f908152600960205260409020805460ff19166001179055610d8560018055565b5f61109282613a82565b6116b961357e565b600a546201000090046001600160a01b03166116e85760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146117125760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381165f908152600960205260409020805460ff19169055610d8560018055565b61174261357e565b600a546201000090046001600160a01b03166117715760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b0316331461179b5760405162461bcd60e51b8152600401610d6e90615c3d565b6126ac81106117bd5760405163cd4e616760e01b815260040160405180910390fd5b600e819055610d8560018055565b6117d361357e565b600a546201000090046001600160a01b03166118025760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b0316331461182c5760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381165f9081526009602052604090205460ff161561186557604051631f7b776b60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f906001600160a01b038416906370a0823190602401602060405180830381865afa1580156118a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118cd9190615c26565b600a549091506001600160a01b03620100009091048116908416036118f7576118f7600180613ace565b611902838383613b3b565b604080518281526001600160a01b03858116602083015284168183015290517f853009bb99110572d2d914b6a40e1d763158ebac968d169d09e41bf6c15fc97a9181900360600190a15061195560018055565b5050565b5f805f611967868686613b9e565b5f81815260156020526040812054600f549095509192506119949188918891889160ff9091169080613bd5565b915050935093915050565b5f6119a861357e565b600a546201000090046001600160a01b03166119d75760405163d311bc3960e01b815260040160405180910390fd5b600a5460ff16156119fb5760405163deeb694360e01b815260040160405180910390fd5b6001600160a01b0382161580611a1957506001600160a01b03821630145b15611a3757604051631e4ec46b60e01b815260040160405180910390fd5b335f9081526009602052604090205460ff1680611a6b57506001600160a01b0382165f9081526009602052604090205460ff165b15611a8957604051631f7b776b60e01b815260040160405180910390fd5b825f03611aa957604051637edcaddf60e01b815260040160405180910390fd5b611ab282611442565b831115611ad257604051632484557960e01b815260040160405180910390fd5b611adb83612676565b9050805f03611afd576040516334d1b1a560e11b815260040160405180910390fd5b610e3d33838584613c30565b611b1161357e565b600a546201000090046001600160a01b031615611b41576040516308db0db560e11b815260040160405180910390fd5b601b546001600160a01b03163314611b6b5760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b038516611b9257604051637e4cfdd760e01b815260040160405180910390fd5b6001600160a01b038416611bb957604051632e2bcb6360e01b815260040160405180910390fd5b6001600160a01b038316611be057604051632e947acb60e01b815260040160405180910390fd5b60188160ff1610611c04576040516370d79de560e11b815260040160405180910390fd5b600a805462010000600160b01b031916620100006001600160a01b03891602179055611c31898989613dc0565b601c80546001600160a01b038781166001600160a01b031992831617909255601f8054878416908316179055600b805486841690831617905560108c9055600f805460ff851660ff19909116179055600a805461ffff1916905560218054858416921682179055601b54604051636e998e1760e11b8152921660048301526201518060248301529063dd331c2e906044015f604051808303815f87803b158015611cd9575f80fd5b505af1158015611ceb573d5f803e3d5ffd5b50505050611cf860018055565b50505050505050505050565b5f80611d0e61357e565b600a546201000090046001600160a01b0316611d3d5760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff1615611d6657604051636022a9e760e01b815260040160405180910390fd5b335f9081526009602052604090205460ff1680611d9a57506001600160a01b0384165f9081526009602052604090205460ff165b80611dbc57506001600160a01b0383165f9081526009602052604090205460ff165b15611dda57604051631f7b776b60e01b815260040160405180910390fd5b5f805f611de988878933613e15565b601054909950939750919550935091505f03611e1157429350611e0e8383838a6141cd565b50505b505050611e1d60018055565b935093915050565b611e2d61357e565b600a546201000090046001600160a01b0316611e5c5760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff1615611e8557604051636022a9e760e01b815260040160405180910390fd5b6022546001600160a01b031633141580611ea75750336001600160a01b038316145b15611ec4576040516282b42960e81b815260040160405180910390fd5b335f9081526009602052604090205460ff1680611ef857506001600160a01b0382165f9081526009602052604090205460ff165b15611f16576040516309550c7760e01b815260040160405180910390fd5b5f805f80611f2685878833613e15565b9450945094509450507ff60d67b14614c8984f880fd3b3bc7ddc3c2913656340f454bf0c7431152bbda6338787845f898989604051611f6c989796959493929190615dd2565b60405180910390a15050505061195560018055565b5f6127106301e13380611f948585615cc0565b602354611f9f6135d7565b611fa99190615e16565b611fb39190615e16565b611fbd9190615e41565b6110929190615e41565b611fcf61357e565b600a546201000090046001600160a01b031615611fff576040516308db0db560e11b815260040160405180910390fd5b601b546001600160a01b031633146120295760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381166120505760405163d92e233d60e01b815260040160405180910390fd5b602280546001600160a01b0319166001600160a01b038316179055426024556001805550565b61207e61357e565b600a546201000090046001600160a01b03166120ad5760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146120d75760405162461bcd60e51b8152600401610d6e90615c3d565b6120e18282613ace565b61195560018055565b5f6120f361357e565b600a546201000090046001600160a01b03166121225760405163d311bc3960e01b815260040160405180910390fd5b600a5460ff16156121465760405163deeb694360e01b815260040160405180910390fd5b6001600160a01b038216158061216457506001600160a01b03821630145b1561218257604051631e4ec46b60e01b815260040160405180910390fd5b335f9081526009602052604090205460ff16806121b657506001600160a01b0382165f9081526009602052604090205460ff165b156121d457604051631f7b776b60e01b815260040160405180910390fd5b825f036121f4576040516334d1b1a560e11b815260040160405180910390fd5b6006548311156122175760405163fc3fc71f60e01b815260040160405180910390fd5b612220836125a0565b905061222b82611442565b81111561224b57604051632484557960e01b815260040160405180910390fd5b610e3d33838386613c30565b60038054610d9590615c74565b61226c61357e565b600a546201000090046001600160a01b031661229b5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b031633146122c657604051633a8b134f60e11b815260040160405180910390fd5b6122cf82613a47565b60405163354ead1160e11b8152600481018290526001600160a01b03831690636a9d5a22906024015b5f604051808303815f87803b15801561230f575f80fd5b505af1158015612321573d5f803e3d5ffd5b5050505061195560018055565b5f61233761357e565b612342338484613835565b9050610e1f60018055565b61235561357e565b600a546201000090046001600160a01b03166123845760405163d311bc3960e01b815260040160405180910390fd5b600a5460ff16156123a85760405163deeb694360e01b815260040160405180910390fd5b6022546001600160a01b031633146123d2576040516282b42960e81b815260040160405180910390fd5b805f036123f257604051631f2a200560e01b815260040160405180910390fd5b60225460405163b6f0815d60e01b8152600481018390525f916001600160a01b03169063b6f0815d90602401602060405180830381865afa158015612439573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061245d9190615c26565b90505f61246982612676565b9050612475848261454f565b604080516001600160a01b0386168152602081018390529081018390527fbfd4514577137cff686405fa116c0971d84836c03907ac066d98b10d6d691d569060600160405180910390a1505061195560018055565b5f806124d461357e565b600a546201000090046001600160a01b03166125035760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff161561252c57604051636022a9e760e01b815260040160405180910390fd5b335f9081526009602052604090205460ff168061256057506001600160a01b0383165f9081526009602052604090205460ff165b1561257e57604051631f7b776b60e01b815260040160405180910390fd5b61258a868686866141cd565b9150915061259760018055565b94509492505050565b5f610e1f8260016136d4565b5f604051633af6971f60e11b815260040160405180910390fd5b6125ce61357e565b600a546201000090046001600160a01b03166125fd5760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146126275760405162461bcd60e51b8152600401610d6e90615c3d565b612632838383613dc0565b61139e60018055565b5f80612648868686613b9e565b5f9081526018602090815260408083206001600160a01b03871684529091529020549150505b949350505050565b5f610e1f825f61380c565b61268961357e565b600a546201000090046001600160a01b03166126b85760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146126e25760405162461bcd60e51b8152600401610d6e90615c3d565b601280545f909155600a54600b5461270d916001600160a01b03620100009091048116911683613b3b565b5061115f60018055565b5f805f8061273e60105461012c4261272f9190615e54565b6127399190615e54565b61466b565b600f54929650909450925061275d9085908590859060ff165f80613bd5565b905090919293565b61276d61357e565b600a546201000090046001600160a01b031661279c5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b031633146127c757604051633a8b134f60e11b815260040160405180910390fd5b6127d082613a47565b604051636140e50d60e01b8152600481018290526001600160a01b03831690636140e50d906024016122f8565b6001600160a01b0381165f90815260076020526040812054610e1f90826136d4565b61282761357e565b600a546201000090046001600160a01b03166128565760405163d311bc3960e01b815260040160405180910390fd5b601b546001600160a01b031633146128805760405162461bcd60e51b8152600401610d6e90615c3d565b5f61288d60245442611f81565b9050805f036128af57604051630e2c8a8960e31b815260040160405180910390fd5b426024819055508060125f8282546128c79190615e54565b90915550506001805550565b602081815481106128e2575f80fd5b5f918252602090912001546001600160a01b0316905081565b5f80612908868686613b9e565b5f9081526017602090815260408083206001600160a01b0387168452909152902054915050949350505050565b61293d61357e565b600a546201000090046001600160a01b031661296c5760405163d311bc3960e01b815260040160405180910390fd5b601c546001600160a01b0316331461299757604051633a8b134f60e11b815260040160405180910390fd5b6129a081613a47565b6001600160a01b0381165f908152601e6020526040812080546001909101819055601d8054919283926129d4908490615e54565b92505081905550600260ff16826001600160a01b03166325af34cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612a1c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a409190615e67565b60ff1614612a615760405163046c4b6360e51b815260040160405180910390fd5b600a54612a7e906201000090046001600160a01b03168383614690565b816001600160a01b0316638db579946040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612ab6575f80fd5b505af1158015612ac8573d5f803e3d5ffd5b5050600a54612aea92506201000090046001600160a01b03169050835f614690565b600460ff16826001600160a01b03166325af34cd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b2b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b4f9190615e67565b60ff1614612b7057604051631025cc2560e01b815260040160405180910390fd5b600a54604051636eb1769f60e11b81523060048201526001600160a01b0384811660248301525f92620100009004169063dd62ed3e90604401602060405180830381865afa158015612bc4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612be89190615c26565b1115612c0a576040516001622e27f760e11b0319815260040160405180910390fd5b50610d8560018055565b612c1c61357e565b600a546201000090046001600160a01b0316612c4b5760405163d311bc3960e01b815260040160405180910390fd5b335f908152601e602052604090206002015460ff16612c7d5760405163a2df1a7b60e01b815260040160405180910390fd5b5f828210612c8b575f612c95565b612c958284615cc0565b335f908152601e602052604090206001015490915015612cda57335f908152601e6020526040812060010154601d805491929091612cd4908490615cc0565b90915550505b335f908152601e602052604090206001018190558015612d0b5780601d5f828254612d059190615e54565b90915550505b5061195560018055565b612d1d61357e565b601b546001600160a01b03163314612d475760405162461bcd60e51b8152600401610d6e90615c3d565b6001600160a01b0381161580612d6557506001600160a01b03811630145b15612d83576040516349e27cff60e01b815260040160405180910390fd5b601c546001600160a01b0390811690821603612db257604051630912536f60e01b815260040160405180910390fd5b601f546001600160a01b0390811690821603612de15760405163038d998760e31b815260040160405180910390fd5b6001600160a01b0381165f9081526009602052604090205460ff1615612e1a57604051631f7b776b60e01b815260040160405180910390fd5b601b546001600160a01b0316612e2f826147a3565b6040516001600160a01b03831660248201525f9060440160408051601f19818403018152918152602080830180516001600160e01b031663f2fde38b60e01b1790529051612e7e92910161572d565b60408051808303601f19018152908290528051602090910120602154631f229a2f60e31b8352600483018290526001600160a01b0385811660248501528681166044850152919350169063f914d178906064015f604051808303815f87803b158015612ee8575f80fd5b505af1158015612efa573d5f803e3d5ffd5b505050505050610d8560018055565b612f1161357e565b600a546201000090046001600160a01b0316612f405760405163d311bc3960e01b815260040160405180910390fd5b600a54610100900460ff1615612f6957604051636022a9e760e01b815260040160405180910390fd5b805f03612f89576040516334e33ddb60e01b815260040160405180910390fd5b335f9081526009602052604090205460ff1615612fb957604051631f7b776b60e01b815260040160405180910390fd5b6013546001600160a01b0316612fe257604051631c202a9560e01b815260040160405180910390fd5b5f612fee858585613b9e565b5f818152601460205260408120600101549192500361302057604051630683f18b60e41b815260040160405180910390fd5b600f546130379086908690869060ff165f80613bd5565b61304361012c42615e54565b10156130625760405163085de62560e01b815260040160405180910390fd5b5f818152601560205260408120548310613089575f8281526015602052604090205461308b565b825b5f838152601560205260408120549192508267ffffffffffffffff8111156130b5576130b5615468565b6040519080825280602002602001820160405280156130de578160200160208202803683370190505b5090505f8367ffffffffffffffff8111156130fb576130fb615468565b604051908082528060200260200182016040528015613124578160200160208202803683370190505b5090505f80808681875b6131388a8a615cc0565b811115613333575f8b8152601560205260409020613157600183615cc0565b8154811061316757613167615e82565b5f918252602090912001546001600160a01b031691508261318781615e96565b9350508188848151811061319d5761319d615e82565b6001600160a01b039283166020918202929092018101919091525f8d8152601782526040808220938616825292909152205487518890859081106131e3576131e3615e82565b60200260200101818152505086838151811061320157613201615e82565b6020026020010151846132149190615e54565b5f8c81526018602090815260408083206001600160a01b03871684529091529020549094506132439086615e54565b5f8c81526019602090815260408083206001600160a01b03871684529091529020549095506132729087615e54565b5f8c81526017602090815260408083206001600160a01b0387168085529083528184208490558f84526018835281842081855283528184208490558f84526019835281842090845282528083208390558e835260159091529020805491975090806132df576132df615eab565b5f828152602080822083015f1990810180546001600160a01b03191690559092019092558c82526016815260408083206001600160a01b03861684529091528120558061332b81615e96565b91505061312e565b508360115f8282546133459190615cc0565b925050819055508460125f82825461335d9190615e54565b90915550505f8a81526014602052604081206001018054859290613382908490615cc0565b90915550505f8a815260146020526040812080548692906133a4908490615cc0565b9091555050600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa1580156133f5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134199190615c26565b9050838110156134625760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610d6e565b61346c30866147f4565b6134778b898961491c565b6134818482615cc0565b600a546040516370a0823160e01b8152306004820152620100009091046001600160a01b0316906370a0823190602401602060405180830381865afa1580156134cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134f09190615c26565b146135345760405162461bcd60e51b815260206004820152601460248201527310985b185b98d94818da1958dac819985a5b195960621b6044820152606401610d6e565b505050505050505050505061354860018055565b50505050565b5f805f61355c868686613b9e565b5f90815260146020526040902080546001909101549097909650945050505050565b6002600154036135d05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d6e565b6002600155565b5f806135e1614ae2565b6022546040516308ef5ffd60e01b81523060048201529192505f916001600160a01b03909116906308ef5ffd90602401602060405180830381865afa15801561362c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136509190615c26565b60225460405163b6f0815d60e01b8152600481018390529192505f916001600160a01b039091169063b6f0815d90602401602060405180830381865afa15801561369c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c09190615c26565b90506136cc8184615e54565b935050505090565b5f6005545f146136fa576136f56136e96135d7565b60055485919085614b5f565b611092565b82611092565b6001600160a01b0382166137565760405162461bcd60e51b815260206004820152601960248201527f6e6f6e2d7a65726f207370656e646572207265717569726564000000000000006044820152606401610d6e565b6001600160a01b0383166137ac5760405162461bcd60e51b815260206004820152601760248201527f6e6f6e2d7a65726f206f776e65722072657175697265640000000000000000006044820152606401610d6e565b6001600160a01b038381165f8181526008602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f82158061381a5750600554155b6136fa576136f560055461382c6135d7565b85919085614b5f565b5f6001600160a01b03831661388c5760405162461bcd60e51b815260206004820152601960248201527f6e6f6e2d7a65726f2061646472657373207265717569726564000000000000006044820152606401610d6e565b6001600160a01b0384166138e25760405162461bcd60e51b815260206004820152601860248201527f6e6f6e2d7a65726f2073656e64657220726571756972656400000000000000006044820152606401610d6e565b5f82116139295760405162461bcd60e51b8152602060048201526015602482015274416d6f756e742063616e6e6f74206265207a65726f60581b6044820152606401610d6e565b6001600160a01b0384165f908152600760205260409020548211156139905760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e7420657863656564732073656e6465722062616c616e63650000006044820152606401610d6e565b6001600160a01b0384165f908152600760205260409020546139b3908390615cc0565b6001600160a01b038086165f9081526007602052604080822093909355908516815220546139e2908390615e54565b6001600160a01b038085165f8181526007602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90613a359086815260200190565b60405180910390a35060019392505050565b6001600160a01b0381165f908152601e602052604090206002015460ff16610d855760405163a2df1a7b60e01b815260040160405180910390fd5b5f80613a8e835f6136d4565b91508190505f80600e541115613ac85761271083600e54613aaf9190615e16565b613ab99190615e41565b9050613ac58184615cc0565b91505b50915091565b600a805461ffff191683151561ff00191617610100831515810291909117918290556040805160ff8085161515825292909304909116151560208301527f559628b27717ff2f5863f3a218839e17c6bc1b900e9de0dc2b3dc365068841d791015b60405180910390a15050565b6040516001600160a01b03831660248201526044810182905261139e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614bba565b6040805160208082019590955280820193909352606080840192909252805180840390920182526080909201909152805191012090565b5f81613be2603c85615e16565b613bee610e1087615e16565b62015180613bfd8b8b8b614c8b565b613c079190615e16565b613c119190615e54565b613c1b9190615e54565b613c259190615e54565b979650505050505050565b600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613c7c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613ca09190615c26565b613caa9084615e54565b600a54909150613ccb906201000090046001600160a01b0316863086614df1565b600a546040516370a0823160e01b815230600482015282916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613d17573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613d3b9190615c26565b14613d5957604051630a85404160e11b815260040160405180910390fd5b613d63848361454f565b836001600160a01b0316856001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d78585604051613db1929190918252602082015260400190565b60405180910390a35050505050565b825f03613de057604051637fb1277b60e01b815260040160405180910390fd5b815f03613e005760405163e8498be360e01b815260040160405180910390fd5b613e0981614e29565b50600c91909155600d55565b5f80808080306001600160a01b03891603613e4357604051634971ba2d60e01b815260040160405180910390fd5b885f03613e63576040516334d1b1a560e11b815260040160405180910390fd5b6001600160a01b0388165f90815260076020526040902054891115613e9b57604051633999656760e01b815260040160405180910390fd5b5f80613ea68b613a82565b91509150613eb38a6127fd565b821115613ed357604051631b6132ab60e31b815260040160405180910390fd5b805f03613ef357604051631fbaba3560e01b815260040160405180910390fd5b5f613efe8284615cc0565b9050819350613f1760105461012c4261272f9190615e54565b919850965094505f613f2a888888613b9e565b600f54909150613f449089908990899060ff165f80613bd5565b98508b6001600160a01b03168a6001600160a01b031614613f6a57613f6a8c8b8f614eb8565b613f758c308f613835565b505f8181526014602052604081206001018054869290613f96908490615e54565b90915550505f81815260146020526040812080548f9290613fb8908490615e54565b925050819055508c60115f828254613fd09190615e54565b90915550505f8181526017602090815260408083206001600160a01b038f168452909152812054900361409e5760155f8281526020019081526020015f208b908060018154018082558091505060019003905f5260205f20015f9091909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555060155f8281526020019081526020015f208054905060165f8381526020019081526020015f205f8d6001600160a01b03166001600160a01b031681526020019081526020015f20819055505b5f8181526017602090815260408083206001600160a01b038f168452909152812080548592906140cf908490615e54565b90915550505f8181526018602090815260408083206001600160a01b038f168452909152812080548f9290614105908490615e54565b90915550505f8181526019602090815260408083206001600160a01b038f1684529091528120805484929061413b908490615e54565b9250508190555042601a5f8381526020019081526020015f205f8d6001600160a01b03166001600160a01b031681526020019081526020015f20819055507ff60d67b14614c8984f880fd3b3bc7ddc3c2913656340f454bf0c7431152bbda68c8c8f87868d8d8d6040516141b6989796959493929190615dd2565b60405180910390a150505050945094509450945094565b604080516020808201879052818301869052606080830186905283518084039091018152608090920183528151918101919091205f818152601883528381206001600160a01b03861682529092529181205490918291808303614243576040516339c556cd60e11b815260040160405180910390fd5b5f8281526017602090815260408083206001600160a01b0389168085529083528184205486855260198452828520918552925290912054601054156142c457600f54614299908b908b908b9060ff165f80613bd5565b6142a561012c42615e54565b10156142c45760405163085de62560e01b815260040160405180910390fd5b5f8481526017602090815260408083206001600160a01b038b1680855290835281842084905587845260188352818420818552835281842084905587845260198352818420908452825280832083905586835260149091528120805485929061432e908490615cc0565b9091555061433e90508183615e54565b5f858152601460205260408120600101805490919061435e908490615cc0565b925050819055508260115f8282546143769190615cc0565b925050819055508060125f82825461438e9190615e54565b9091555061439e90508488614f44565b6143a830846147f4565b5f848152601a602090815260408083206001600160a01b038b16808552908352818420548251878152429481019490945291830152606082015260808101919091527fa6f30f7bcb55dd97fe6efdedd57aa5ee608cf66171304f643b791c6f37f495899060a00160405180910390a1600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015614463573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906144879190615c26565b600a549091506144a7906201000090046001600160a01b03168985613b3b565b600a546040516370a0823160e01b8152306004820152620100009091046001600160a01b0316906370a0823190602401602060405180830381865afa1580156144f2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145169190615c26565b6145208483615cc0565b101561453f57604051630a85404160e11b815260040160405180910390fd5b5091999098509650505050505050565b5f811161458f5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610d6e565b61459881615129565b6145e45760405162461bcd60e51b815260206004820152601860248201527f4d617820737570706c79206c696d6974207265616368656400000000000000006044820152606401610d6e565b8060055f8282546145f59190615e54565b90915550506001600160a01b0382165f9081526007602052604081208054839290614621908490615e54565b90915550506040518181526001600160a01b038316905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b5f808061468361467e6201518086615e41565b615143565b9196909550909350915050565b8015806147085750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156146e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906147069190615c26565b155b6147735760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610d6e565b6040516001600160a01b03831660248201526044810182905261139e90849063095ea7b360e01b90606401613b67565b601b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f81116148345760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610d6e565b6001600160a01b0382165f9081526007602052604090205481111561489b5760405162461bcd60e51b815260206004820152601b60248201527f4275726e20616d6f756e7420657863656564732062616c616e636500000000006044820152606401610d6e565b6001600160a01b0382165f90815260076020526040812080548392906148c2908490615cc0565b925050819055508060055f8282546148da9190615cc0565b90915550506040518181525f906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161465f565b5f805b83518110156115e55760095f85838151811061493d5761493d615e82565b6020908102919091018101516001600160a01b031682528101919091526040015f205460ff166149865783818151811061497957614979615e82565b6020026020010151614993565b6013546001600160a01b03165b91507fa6f30f7bcb55dd97fe6efdedd57aa5ee608cf66171304f643b791c6f37f495898382815181106149c8576149c8615e82565b6020026020010151428684815181106149e3576149e3615e82565b6020026020010151601a5f8a81526020019081526020015f205f898781518110614a0f57614a0f615e82565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020015f205460095f8a8881518110614a4c57614a4c615e82565b6020908102919091018101516001600160a01b0390811683528282019390935260409182015f2054825197885290870195909552921684830152606084015260ff90911615156080830152519081900360a00190a1614ada600a60029054906101000a90046001600160a01b031683858481518110614acd57614acd615e82565b6020026020010151613b3b565b60010161491f565b600a546040516370a0823160e01b81523060048201525f916201000090046001600160a01b0316906370a0823190602401602060405180830381865afa158015614b2e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614b529190615c26565b601d54610d089190615e54565b5f80614b6c8686866152b2565b90506001836002811115614b8257614b82615ebf565b148015614b9e57505f8480614b9957614b99615e2d565b868809115b15614bb157614bae600182615e54565b90505b95945050505050565b5f614c0e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661535b9092919063ffffffff16565b80519091501561139e5780806020019051810190614c2c9190615ed3565b61139e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610d6e565b5f6107b2841015614cc65760405162461bcd60e51b815260206004820152600560248201526422b93937b960d91b6044820152606401610d6e565b8383835f62253d8c60046064600c614cdf600e88615eee565b614ce99190615f14565b614cf588611324615f40565b614cff9190615f40565b614d099190615f14565b614d14906003615f67565b614d1e9190615f14565b600c80614d2c600e88615eee565b614d369190615f14565b614d4190600c615f67565b614d4c600288615eee565b614d569190615eee565b614d629061016f615f67565b614d6c9190615f14565b6004600c614d7b600e89615eee565b614d859190615f14565b614d91896112c0615f40565b614d9b9190615f40565b614da7906105b5615f67565b614db19190615f14565b614dbd617d4b87615eee565b614dc79190615f40565b614dd19190615f40565b614ddb9190615eee565b614de59190615eee565b98975050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526135489085906323b872dd60e01b90608401613b67565b5f81118015614e39575060055481115b614e7a5760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964206d617820737570706c7960701b6044820152606401610d6e565b600680549082905560408051828152602081018490527fe4fd3e707c42fe7e4405214e86e4f796ecfa58dfe4d17def31221e34e2e4b2b59101613b2f565b6001600160a01b038084165f908152600860209081526040808320938616835292905220545f1981146135485781811015614f355760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610d6e565b61354884846110858585615cc0565b5f8281526016602090815260408083206001600160a01b0385168452909152812054614f7290600190615cc0565b5f8481526015602052604081208054929350614f8f600184615cc0565b81548110614f9f57614f9f615e82565b5f918252602090912001546001600160a01b039081169150841681146150c3575f858152601560205260409020805484908110614fde57614fde615e82565b5f918252602080832090910154878352601590915260409091206001600160a01b039091169061500f600185615cc0565b8154811061501f5761501f615e82565b905f5260205f20015f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508060155f8781526020019081526020015f20848154811061506d5761506d615e82565b5f91825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556150a0836001615e54565b5f8681526016602090815260408083206001600160a01b03861684529091529020555b5f8581526015602052604090208054806150df576150df615eab565b5f828152602080822083015f1990810180546001600160a01b03191690559092019092559581526016865260408082206001600160a01b0396909616825294909552505050812055565b5f8160055460065461513b9190615cc0565b101592915050565b5f8080838162253d8c6151598362010bd9615f40565b6151639190615f40565b90505f62023ab1615175836004615f67565b61517f9190615f14565b905060046151908262023ab1615f67565b61519b906003615f40565b6151a59190615f14565b6151af9083615eee565b91505f62164b096151c1846001615f40565b6151cd90610fa0615f67565b6151d79190615f14565b905060046151e7826105b5615f67565b6151f19190615f14565b6151fb9084615eee565b61520690601f615f40565b92505f61098f615217856050615f67565b6152219190615f14565b90505f60506152328361098f615f67565b61523c9190615f14565b6152469086615eee565b9050615253600b83615f14565b945061526085600c615f67565b61526b836002615f40565b6152759190615eee565b91508483615284603187615eee565b61528f906064615f67565b6152999190615f40565b6152a39190615f40565b9a919950975095505050505050565b5f80805f19858709858702925082811083820303915050805f036152e9578382816152df576152df615e2d565b0492505050611092565b8084116152f4575f80fd5b5f8486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091025f889003889004909101858311909403939093029303949094049190911702949350505050565b606061266e84845f85855f80866001600160a01b031685876040516153809190615f96565b5f6040518083038185875af1925050503d805f81146153ba576040519150601f19603f3d011682016040523d82523d5f602084013e6153bf565b606091505b5091509150613c2587838387606083156154395782515f03615432576001600160a01b0385163b6154325760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d6e565b508161266e565b61266e838381511561544e5781518083602001fd5b8060405162461bcd60e51b8152600401610d6e919061572d565b634e487b7160e01b5f52604160045260245ffd5b604051610280810167ffffffffffffffff811182821017156154a0576154a0615468565b60405290565b5f82601f8301126154b5575f80fd5b813567ffffffffffffffff8111156154cf576154cf615468565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156154fe576154fe615468565b604052818152838201602001851015615515575f80fd5b816020850160208301375f918101602001919091529392505050565b6001600160a01b0381168114610d85575f80fd5b8035610cfa81615531565b8015158114610d85575f80fd5b8035610cfa81615550565b5f60208284031215615578575f80fd5b813567ffffffffffffffff81111561558e575f80fd5b820161028081850312156155a0575f80fd5b6155a861547c565b813581526020808301359082015260408083013590820152606080830135908201526080808301359082015260a0808301359082015260c0808301359082015260e080830135908201526101008083013590820152610120808301359082015261014082013567ffffffffffffffff811115615622575f80fd5b61562e868285016154a6565b610140830152506156426101608301615545565b6101608201526156556101808301615545565b6101808201526156686101a08301615545565b6101a082015261567b6101c08301615545565b6101c082015261568e6101e08301615545565b6101e08201526156a16102008301615545565b6102008201526156b46102208301615545565b6102208201526156c76102408301615545565b6102408201526156da610260830161555d565b610260820152949350505050565b5f602082840312156156f8575f80fd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61109260208301846156ff565b5f8060408385031215615750575f80fd5b823561575b81615531565b946020939093013593505050565b5f805f6060848603121561577b575f80fd5b833561578681615531565b9250602084013561579681615531565b929592945050506040919091013590565b5f602082840312156157b7575f80fd5b813561109281615531565b5f805f606084860312156157d4575f80fd5b83356157df81615531565b95602085013595506040909401359392505050565b60ff81168114610d85575f80fd5b5f805f8060808587031215615815575f80fd5b843561582081615531565b93506020850135615830816157f4565b9250604085013567ffffffffffffffff81111561584b575f80fd5b615857878288016154a6565b925050606085013567ffffffffffffffff811115615873575f80fd5b61587f878288016154a6565b91505092959194509250565b5f806040838503121561589c575f80fd5b82356158a781615531565b915060208301356158b781615531565b809150509250929050565b5f805f606084860312156158d4575f80fd5b505081359360208301359350604090920135919050565b5f80604083850312156158fc575f80fd5b8235915060208301356158b781615531565b5f805f805f805f805f806101408b8d031215615928575f80fd5b8a35995060208b0135985060408b0135975060608b0135965060808b013561594f81615531565b955060a08b013561595f81615531565b945060c08b013561596f81615531565b935060e08b013561597f81615531565b92506101008b013561599081615531565b91506101208b01356159a1816157f4565b809150509295989b9194979a5092959850565b5f805f606084860312156159c6575f80fd5b8335925060208401356159d881615531565b915060408401356159e881615531565b809150509250925092565b5f8060408385031215615a04575f80fd5b50508035926020909101359150565b5f8060408385031215615a24575f80fd5b8235615a2f81615550565b915060208301356158b781615550565b5f805f8060808587031215615a52575f80fd5b8435935060208501359250604085013591506060850135615a7281615531565b939692955090935050565b5f805f8060808587031215615a90575f80fd5b5050823594602084013594506040840135936060013592509050565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e082015260e08201516101008201526101008201516101208201526101208201516101408201525f610140830151610280610160840152615b346102a08401826156ff565b9050610160840151615b526101808501826001600160a01b03169052565b506101808401516001600160a01b0381166101a0850152506101a08401516001600160a01b0381166101c0850152506101c08401516001600160a01b0381166101e0850152506101e08401516001600160a01b038116610200850152506102008401516001600160a01b038116610220850152506102208401516001600160a01b038116610240850152506102408401516001600160a01b03811661026085015250610260840151801515610280850152509392505050565b5f60208284031215615c1b575f80fd5b815161109281615531565b5f60208284031215615c36575f80fd5b5051919050565b60208082526017908201527f43616c6c6572206973206e6f7420746865206f776e6572000000000000000000604082015260600190565b600181811c90821680615c8857607f821691505b602082108103615ca657634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610e1f57610e1f615cac565b601f82111561139e57805f5260205f20601f840160051c81016020851015615cf85750805b601f840160051c820191505b818110156115e5575f8155600101615d04565b815167ffffffffffffffff811115615d3157615d31615468565b615d4581615d3f8454615c74565b84615cd3565b6020601f821160018114615d77575f8315615d605750848201515b5f19600385901b1c1916600184901b1784556115e5565b5f84815260208120601f198516915b82811015615da65787850151825560209485019460019092019101615d86565b5084821015615dc357868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160a01b03988916815296909716602087015260408601949094526060850192909252608084015260a083015260c082015260e08101919091526101000190565b8082028115828204841417610e1f57610e1f615cac565b634e487b7160e01b5f52601260045260245ffd5b5f82615e4f57615e4f615e2d565b500490565b80820180821115610e1f57610e1f615cac565b5f60208284031215615e77575f80fd5b8151611092816157f4565b634e487b7160e01b5f52603260045260245ffd5b5f81615ea457615ea4615cac565b505f190190565b634e487b7160e01b5f52603160045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f60208284031215615ee3575f80fd5b815161109281615550565b8181035f831280158383131683831282161715615f0d57615f0d615cac565b5092915050565b5f82615f2257615f22615e2d565b600160ff1b82145f1984141615615f3b57615f3b615cac565b500590565b8082018281125f831280158216821582161715615f5f57615f5f615cac565b505092915050565b8082025f8212600160ff1b84141615615f8257615f82615cac565b8181058314821517610e1f57610e1f615cac565b5f82518060208501845e5f92019182525091905056fea26469706673582212209d6d370d93cfe9a2c96b0be1764308f0dc95de6c30a43fff3fce647aa92bc08c64736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.