More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 4,557 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 54868797 | 118 days ago | IN | 0 AVAX | 0.00003516 | ||||
Withdraw | 49627244 | 242 days ago | IN | 0 AVAX | 0.00898286 | ||||
Approve | 43263563 | 396 days ago | IN | 0 AVAX | 0.00077019 | ||||
Withdraw | 41534524 | 437 days ago | IN | 0 AVAX | 0.00943601 | ||||
Withdraw | 38870038 | 499 days ago | IN | 0 AVAX | 0.00943601 | ||||
Withdraw | 31736413 | 669 days ago | IN | 0 AVAX | 0.00890468 | ||||
Approve | 31315791 | 679 days ago | IN | 0 AVAX | 0.00078472 | ||||
Withdraw | 28172030 | 753 days ago | IN | 0 AVAX | 0.00918127 | ||||
Withdraw | 25339922 | 820 days ago | IN | 0 AVAX | 0.00949929 | ||||
Withdraw | 25088714 | 826 days ago | IN | 0 AVAX | 0.00890468 | ||||
Withdraw | 23150515 | 872 days ago | IN | 0 AVAX | 0.00935783 | ||||
Withdraw | 22916190 | 877 days ago | IN | 0 AVAX | 0.00890468 | ||||
Withdraw | 22496834 | 887 days ago | IN | 0 AVAX | 0.00890468 | ||||
Approve | 21792876 | 904 days ago | IN | 0 AVAX | 0.00123352 | ||||
Withdraw | 21091517 | 921 days ago | IN | 0 AVAX | 0.00935783 | ||||
Approve | 18613803 | 983 days ago | IN | 0 AVAX | 0.001254 | ||||
Withdraw | 17805603 | 1002 days ago | IN | 0 AVAX | 0.00873636 | ||||
Withdraw | 17109818 | 1018 days ago | IN | 0 AVAX | 0.00890468 | ||||
Withdraw | 16972164 | 1022 days ago | IN | 0 AVAX | 0.008905 | ||||
Withdraw | 16661138 | 1029 days ago | IN | 0 AVAX | 0.00890468 | ||||
Withdraw | 16556283 | 1031 days ago | IN | 0 AVAX | 0.00935783 | ||||
Withdraw | 16238326 | 1039 days ago | IN | 0 AVAX | 0.00935815 | ||||
Withdraw | 16126784 | 1041 days ago | IN | 0 AVAX | 0.00890468 | ||||
Withdraw | 16123503 | 1041 days ago | IN | 0 AVAX | 0.00939275 | ||||
Withdraw | 16102344 | 1042 days ago | IN | 0 AVAX | 0.00935783 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
13417272 | 1104 days ago | 1.18824075 AVAX | ||||
13417272 | 1104 days ago | 1.18824075 AVAX | ||||
13310408 | 1107 days ago | 0.89843801 AVAX | ||||
13310408 | 1107 days ago | 0.00285769 AVAX | ||||
13310408 | 1107 days ago | 0.89843801 AVAX | ||||
13303582 | 1107 days ago | 5.42026764 AVAX | ||||
13303582 | 1107 days ago | 0.00125971 AVAX | ||||
13303582 | 1107 days ago | 0.00189292 AVAX | ||||
13303582 | 1107 days ago | 5.42026764 AVAX | ||||
13263933 | 1108 days ago | 6.84174367 AVAX | ||||
13263933 | 1108 days ago | 0.00211782 AVAX | ||||
13263933 | 1108 days ago | 0.00291377 AVAX | ||||
13263933 | 1108 days ago | 6.84174367 AVAX | ||||
13215514 | 1109 days ago | 4.51021872 AVAX | ||||
13215514 | 1109 days ago | 0.00380763 AVAX | ||||
13215514 | 1109 days ago | 0.00481741 AVAX | ||||
13215514 | 1109 days ago | 4.51021872 AVAX | ||||
13184236 | 1110 days ago | 5.45598463 AVAX | ||||
13184236 | 1110 days ago | 0.00161739 AVAX | ||||
13184236 | 1110 days ago | 0.0020575 AVAX | ||||
13184236 | 1110 days ago | 5.45598463 AVAX | ||||
13149110 | 1111 days ago | 6.17458185 AVAX | ||||
13149110 | 1111 days ago | 0.00186548 AVAX | ||||
13149110 | 1111 days ago | 0.00255009 AVAX | ||||
13149110 | 1111 days ago | 6.17458185 AVAX |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x07B0E11D...9c119095A The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
BenqiStrategyV2
Compiler Version
v0.7.3+commit.9bfce1f6
Optimization Enabled:
Yes with 999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../YakStrategyV2.sol"; import "../interfaces/IBenqiUnitroller.sol"; import "../interfaces/IBenqiERC20Delegator.sol"; import "../interfaces/IWAVAX.sol"; import "../interfaces/IERC20.sol"; import "../lib/DexLibrary.sol"; contract BenqiStrategyV2 is YakStrategyV2 { using SafeMath for uint256; IBenqiUnitroller private rewardController; IBenqiERC20Delegator private tokenDelegator; IERC20 private rewardToken0; IERC20 private rewardToken1; IPair private swapPairToken0; IPair private swapPairToken1; IWAVAX private constant WAVAX = IWAVAX(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7); uint256 private leverageLevel; uint256 private leverageBips; uint256 private minMinting; uint256 private redeemLimitSafetyMargin; constructor( string memory _name, address _depositToken, address _rewardController, address _tokenDelegator, address _rewardToken0, address _rewardToken1, address _swapPairToken0, address _swapPairToken1, address _timelock, uint256 _minMinting, uint256 _leverageLevel, uint256 _leverageBips, uint256 _minTokensToReinvest, uint256 _adminFeeBips, uint256 _devFeeBips, uint256 _reinvestRewardBips ) { name = _name; depositToken = IERC20(_depositToken); rewardController = IBenqiUnitroller(_rewardController); tokenDelegator = IBenqiERC20Delegator(_tokenDelegator); rewardToken0 = IERC20(_rewardToken0); rewardToken1 = IERC20(_rewardToken1); rewardToken = rewardToken1; minMinting = _minMinting; _updateLeverage( _leverageLevel, _leverageBips, _leverageBips.mul(990).div(1000) //works as long as leverageBips > 1000 ); devAddr = 0x2D580F9CF2fB2D09BC411532988F2aFdA4E7BefF; _enterMarket(); assignSwapPairSafely(_swapPairToken0, _swapPairToken1); setAllowances(); updateMinTokensToReinvest(_minTokensToReinvest); updateAdminFee(_adminFeeBips); updateDevFee(_devFeeBips); updateReinvestReward(_reinvestRewardBips); updateDepositsEnabled(true); transferOwnership(_timelock); emit Reinvest(0, 0); } function totalDeposits() public view override returns (uint256) { ( , uint256 internalBalance, uint256 borrow, uint256 exchangeRate ) = tokenDelegator.getAccountSnapshot(address(this)); return internalBalance.mul(exchangeRate).div(1e18).sub(borrow); } function _totalDepositsFresh() internal returns (uint256) { uint256 borrow = tokenDelegator.borrowBalanceCurrent(address(this)); uint256 balance = tokenDelegator.balanceOfUnderlying(address(this)); return balance.sub(borrow); } function _enterMarket() internal { address[] memory tokens = new address[](1); tokens[0] = address(tokenDelegator); rewardController.enterMarkets(tokens); } function _updateLeverage( uint256 _leverageLevel, uint256 _leverageBips, uint256 _redeemLimitSafetyMargin ) internal { leverageLevel = _leverageLevel; leverageBips = _leverageBips; redeemLimitSafetyMargin = _redeemLimitSafetyMargin; } function updateLeverage( uint256 _leverageLevel, uint256 _leverageBips, uint256 _redeemLimitSafetyMargin ) external onlyDev { _updateLeverage(_leverageLevel, _leverageBips, _redeemLimitSafetyMargin); uint256 borrowed = tokenDelegator.borrowBalanceCurrent(address(this)); uint256 balance = tokenDelegator.balanceOfUnderlying(address(this)); _unrollDebt(balance.sub(borrowed)); if (balance.sub(borrowed) > 0) { _rollupDebt(balance.sub(borrowed), 0); } } /** * @notice Initialization helper for Pair deposit tokens * @dev Checks that selected Pairs are valid for trading deposit tokens * @dev Assigns values to swapPairToken0 and swapPairToken1 */ function assignSwapPairSafely(address _swapPairToken0, address _swapPairToken1) private { require( _swapPairToken0 > address(0), "Swap pair 0 is necessary but not supplied" ); require( _swapPairToken1 > address(0), "Swap pair 1 is necessary but not supplied" ); require( address(rewardToken0) == IPair(address(_swapPairToken0)).token0() || address(rewardToken0) == IPair(address(_swapPairToken0)).token1(), "Swap pair 0 does not match rewardToken0" ); require( address(rewardToken1) == IPair(address(_swapPairToken0)).token0() || address(rewardToken1) == IPair(address(_swapPairToken0)).token1(), "Swap pair 0 does not match rewardToken1" ); require( address(depositToken) == IPair(address(_swapPairToken1)).token0() || address(depositToken) == IPair(address(_swapPairToken1)).token1(), "Swap pair 1 does not match depositToken" ); require( address(rewardToken1) == IPair(address(_swapPairToken1)).token0() || address(rewardToken1) == IPair(address(_swapPairToken1)).token1(), "Swap pair 1 does not match rewardToken1" ); swapPairToken0 = IPair(_swapPairToken0); swapPairToken1 = IPair(_swapPairToken1); } function setAllowances() public override onlyOwner { depositToken.approve(address(tokenDelegator), type(uint256).max); tokenDelegator.approve(address(tokenDelegator), type(uint256).max); } function deposit(uint256 amount) external override { _deposit(msg.sender, amount); } function depositWithPermit( uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { depositToken.permit(msg.sender, address(this), amount, deadline, v, r, s); _deposit(msg.sender, amount); } function depositFor(address account, uint256 amount) external override { _deposit(account, amount); } function _deposit(address account, uint256 amount) private onlyAllowedDeposits { require(DEPOSITS_ENABLED == true, "BenqiStrategyV2::_deposit"); if (MAX_TOKENS_TO_DEPOSIT_WITHOUT_REINVEST > 0) { ( uint256 qiRewards, uint256 avaxRewards, uint256 totalAvaxRewards ) = _checkRewards(); if (totalAvaxRewards > MAX_TOKENS_TO_DEPOSIT_WITHOUT_REINVEST) { _reinvest(qiRewards, avaxRewards, totalAvaxRewards); } } require( depositToken.transferFrom(msg.sender, address(this), amount), "BenqiStrategyV2::transfer failed" ); uint256 depositTokenAmount = amount; uint256 balance = _totalDepositsFresh(); if (totalSupply.mul(balance) > 0) { depositTokenAmount = amount.mul(totalSupply).div(balance); } _mint(account, depositTokenAmount); _stakeDepositTokens(amount); emit Deposit(account, amount); } function withdraw(uint256 amount) external override { uint256 depositTokenAmount = _totalDepositsFresh().mul(amount).div(totalSupply); require(depositTokenAmount > 0, "BenqiStrategyV2::withdraw"); _burn(msg.sender, amount); _withdrawDepositTokens(depositTokenAmount); _safeTransfer(address(depositToken), msg.sender, depositTokenAmount); emit Withdraw(msg.sender, depositTokenAmount); } function _withdrawDepositTokens(uint256 amount) private { _unrollDebt(amount); require( tokenDelegator.redeemUnderlying(amount) == 0, "BenqiStrategyV2::failed to redeem" ); } function reinvest() external override onlyEOA { ( uint256 qiRewards, uint256 avaxRewards, uint256 totalAvaxRewards ) = _checkRewards(); require(totalAvaxRewards >= MIN_TOKENS_TO_REINVEST, "BenqiStrategyV2::reinvest"); _reinvest(qiRewards, avaxRewards, totalAvaxRewards); } receive() external payable { require( msg.sender == address(rewardController), "BenqiStrategyV2::payments not allowed" ); } /** * @notice Reinvest rewards from staking contract to deposit tokens * @dev Reverts if the expected amount of tokens are not returned from `stakingContract` * @param amount deposit tokens to reinvest */ function _reinvest( uint256 qiRewards, uint256 avaxRewards, uint256 amount ) private { rewardController.claimReward(0, address(this)); rewardController.claimReward(1, address(this)); if (avaxRewards > 0) { WAVAX.deposit{value: avaxRewards}(); } if (qiRewards > 0) { DexLibrary.swap( qiRewards, address(rewardToken0), address(rewardToken1), swapPairToken0 ); } uint256 devFee = amount.mul(DEV_FEE_BIPS).div(BIPS_DIVISOR); if (devFee > 0) { _safeTransfer(address(rewardToken), devAddr, devFee); } uint256 reinvestFee = amount.mul(REINVEST_REWARD_BIPS).div(BIPS_DIVISOR); if (reinvestFee > 0) { _safeTransfer(address(rewardToken), msg.sender, reinvestFee); } uint256 depositTokenAmount = DexLibrary.swap( amount.sub(devFee).sub(reinvestFee), address(rewardToken1), address(depositToken), swapPairToken1 ); _stakeDepositTokens(depositTokenAmount); emit Reinvest(totalDeposits(), totalSupply); } function _rollupDebt(uint256 principal, uint256 borrowed) internal { (uint256 borrowLimit, uint256 borrowBips) = _getBorrowLimit(); uint256 supplied = principal; uint256 lendTarget = principal.sub(borrowed).mul(leverageLevel).div( leverageBips ); uint256 totalBorrowed = borrowed; while (supplied < lendTarget) { uint256 toBorrowAmount = _getBorrowable( supplied, totalBorrowed, borrowLimit, borrowBips ); if (supplied.add(toBorrowAmount) > lendTarget) { toBorrowAmount = lendTarget.sub(supplied); } // safeguard needed because we can't mint below a certain threshold if (toBorrowAmount < minMinting) { break; } require( tokenDelegator.borrow(toBorrowAmount) == 0, "BenqiStrategyV2::borrowing failed" ); require( tokenDelegator.mint(toBorrowAmount) == 0, "BenqiStrategyV2::lending failed" ); supplied = tokenDelegator.balanceOfUnderlying(address(this)); totalBorrowed = totalBorrowed.add(toBorrowAmount); } } function _getRedeemable( uint256 balance, uint256 borrowed, uint256 borrowLimit, uint256 bips ) internal view returns (uint256) { return balance .sub(borrowed.mul(bips).div(borrowLimit)) .mul(redeemLimitSafetyMargin) .div(leverageBips); } function _getBorrowable( uint256 balance, uint256 borrowed, uint256 borrowLimit, uint256 bips ) internal pure returns (uint256) { return balance.mul(borrowLimit).div(bips).sub(borrowed); } function _getBorrowLimit() internal view returns (uint256, uint256) { (, uint256 borrowLimit) = rewardController.markets(address(tokenDelegator)); return (borrowLimit, 1e18); } function _unrollDebt(uint256 amountToBeFreed) internal { uint256 borrowed = tokenDelegator.borrowBalanceCurrent(address(this)); uint256 balance = tokenDelegator.balanceOfUnderlying(address(this)); uint256 targetBorrow = balance .sub(borrowed) .sub(amountToBeFreed) .mul(leverageLevel) .div(leverageBips) .sub(balance.sub(borrowed).sub(amountToBeFreed)); uint256 toRepay = borrowed.sub(targetBorrow); (uint256 borrowLimit, uint256 borrowBips) = _getBorrowLimit(); while (toRepay > 0) { uint256 unrollAmount = _getRedeemable( balance, borrowed, borrowLimit, borrowBips ); if (unrollAmount > toRepay) { unrollAmount = toRepay; } require( tokenDelegator.redeemUnderlying(unrollAmount) == 0, "BenqiStrategyV2::failed to redeem" ); require( tokenDelegator.repayBorrow(unrollAmount) == 0, "BenqiStrategyV2::failed to repay borrow" ); balance = tokenDelegator.balanceOfUnderlying(address(this)); borrowed = tokenDelegator.borrowBalanceCurrent(address(this)); if (targetBorrow >= borrowed) { break; } toRepay = borrowed.sub(targetBorrow); } } function _stakeDepositTokens(uint256 amount) private { require(amount > 0, "BenqiStrategyV2::_stakeDepositTokens"); require(tokenDelegator.mint(amount) == 0, "BenqiStrategyV2::Deposit failed"); uint256 borrowed = tokenDelegator.borrowBalanceCurrent(address(this)); uint256 principal = tokenDelegator.balanceOfUnderlying(address(this)); _rollupDebt(principal, borrowed); } /** * @notice Safely transfer using an anonymosu ERC20 token * @dev Requires token to return true on transfer * @param token address * @param to recipient address * @param value amount */ function _safeTransfer( address token, address to, uint256 value ) private { require( IERC20(token).transfer(to, value), "BenqiStrategyV2::TRANSFER_FROM_FAILED" ); } function _checkRewards() internal view returns ( uint256 qiAmount, uint256 avaxAmount, uint256 totalAvaxAmount ) { uint256 qiRewards = _getReward(0, address(this)); uint256 avaxRewards = _getReward(1, address(this)); uint256 qiAsWavax = DexLibrary.estimateConversionThroughPair( qiRewards, address(rewardToken0), address(rewardToken1), swapPairToken0 ); return (qiRewards, avaxRewards, avaxRewards.add(qiAsWavax)); } function checkReward() public view override returns (uint256) { (, , uint256 avaxRewards) = _checkRewards(); return avaxRewards; } function _getReward(uint8 tokenIndex, address account) internal view returns (uint256) { uint256 rewardAccrued = rewardController.rewardAccrued(tokenIndex, account); (uint224 supplyIndex, ) = rewardController.rewardSupplyState( tokenIndex, account ); uint256 supplierIndex = rewardController.rewardSupplierIndex( tokenIndex, address(tokenDelegator), account ); uint256 supplyIndexDelta = 0; if (supplyIndex > supplierIndex) { supplyIndexDelta = supplyIndex - supplierIndex; } uint256 supplyAccrued = tokenDelegator.balanceOf(account).mul(supplyIndexDelta); (uint224 borrowIndex, ) = rewardController.rewardBorrowState( tokenIndex, account ); uint256 borrowerIndex = rewardController.rewardBorrowerIndex( tokenIndex, address(tokenDelegator), account ); uint256 borrowIndexDelta = 0; if (borrowIndex > borrowerIndex) { borrowIndexDelta = borrowIndex - borrowerIndex; } uint256 borrowAccrued = tokenDelegator.borrowBalanceStored(account).mul( borrowIndexDelta ); return rewardAccrued.add(supplyAccrued.sub(borrowAccrued)); } function getActualLeverage() public view returns (uint256) { ( , uint256 internalBalance, uint256 borrow, uint256 exchangeRate ) = tokenDelegator.getAccountSnapshot(address(this)); uint256 balance = internalBalance.mul(exchangeRate).div(1e18); return balance.mul(1e18).div(balance.sub(borrow)); } function estimateDeployedBalance() external view override returns (uint256) { return totalDeposits(); } function rescueDeployedFunds(uint256 minReturnAmountAccepted, bool disableDeposits) external override onlyOwner { uint256 balanceBefore = depositToken.balanceOf(address(this)); uint256 borrowed = tokenDelegator.borrowBalanceCurrent(address(this)); uint256 balance = tokenDelegator.balanceOfUnderlying(address(this)); _unrollDebt(balance.sub(borrowed)); tokenDelegator.redeemUnderlying( tokenDelegator.balanceOfUnderlying(address(this)) ); uint256 balanceAfter = depositToken.balanceOf(address(this)); require( balanceAfter.sub(balanceBefore) >= minReturnAmountAccepted, "BenqiStrategyV2::rescueDeployedFunds" ); emit Reinvest(totalDeposits(), totalSupply); if (DEPOSITS_ENABLED == true && disableDeposits == true) { updateDepositsEnabled(false); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./lib/SafeMath.sol"; import "./lib/Ownable.sol"; import "./lib/Permissioned.sol"; import "./interfaces/IERC20.sol"; import "./YakERC20.sol"; /** * @notice YakStrategy should be inherited by new strategies */ abstract contract YakStrategyV2 is YakERC20, Ownable, Permissioned { using SafeMath for uint; IERC20 public depositToken; IERC20 public rewardToken; address public devAddr; uint public MIN_TOKENS_TO_REINVEST; uint public MAX_TOKENS_TO_DEPOSIT_WITHOUT_REINVEST; bool public DEPOSITS_ENABLED; uint public REINVEST_REWARD_BIPS; uint public ADMIN_FEE_BIPS; uint public DEV_FEE_BIPS; uint constant internal BIPS_DIVISOR = 10000; uint constant internal MAX_UINT = uint(-1); event Deposit(address indexed account, uint amount); event Withdraw(address indexed account, uint amount); event Reinvest(uint newTotalDeposits, uint newTotalSupply); event Recovered(address token, uint amount); event UpdateAdminFee(uint oldValue, uint newValue); event UpdateDevFee(uint oldValue, uint newValue); event UpdateReinvestReward(uint oldValue, uint newValue); event UpdateMinTokensToReinvest(uint oldValue, uint newValue); event UpdateMaxTokensToDepositWithoutReinvest(uint oldValue, uint newValue); event UpdateDevAddr(address oldValue, address newValue); event DepositsEnabled(bool newValue); /** * @notice Throws if called by smart contract */ modifier onlyEOA() { require(tx.origin == msg.sender, "YakStrategy::onlyEOA"); _; } /** * @notice Only called by dev */ modifier onlyDev() { require(msg.sender == devAddr, "YakStrategy::onlyDev"); _; } /** * @notice Approve tokens for use in Strategy * @dev Should use modifier `onlyOwner` to avoid griefing */ function setAllowances() public virtual; /** * @notice Revoke token allowance * @param token address * @param spender address */ function revokeAllowance(address token, address spender) external onlyOwner { require(IERC20(token).approve(spender, 0)); } /** * @notice Deposit and deploy deposits tokens to the strategy * @dev Must mint receipt tokens to `msg.sender` * @param amount deposit tokens */ function deposit(uint amount) external virtual; /** * @notice Deposit using Permit * @dev Should revert for tokens without Permit * @param amount Amount of tokens to deposit * @param deadline The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function depositWithPermit(uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external virtual; /** * @notice Deposit on behalf of another account * @dev Must mint receipt tokens to `account` * @param account address to receive receipt tokens * @param amount deposit tokens */ function depositFor(address account, uint amount) external virtual; /** * @notice Redeem receipt tokens for deposit tokens * @param amount receipt tokens */ function withdraw(uint amount) external virtual; /** * @notice Reinvest reward tokens into deposit tokens */ function reinvest() external virtual; /** * @notice Estimate reinvest reward * @return reward tokens */ function estimateReinvestReward() external view returns (uint) { uint unclaimedRewards = checkReward(); if (unclaimedRewards >= MIN_TOKENS_TO_REINVEST) { return unclaimedRewards.mul(REINVEST_REWARD_BIPS).div(BIPS_DIVISOR); } return 0; } /** * @notice Reward tokens avialable to strategy, including balance * @return reward tokens */ function checkReward() public virtual view returns (uint); /** * @notice Estimated deposit token balance deployed by strategy, excluding balance * @return deposit tokens */ function estimateDeployedBalance() external virtual view returns (uint); /** * @notice Rescue all available deployed deposit tokens back to Strategy * @param minReturnAmountAccepted min deposit tokens to receive * @param disableDeposits bool */ function rescueDeployedFunds(uint minReturnAmountAccepted, bool disableDeposits) external virtual; /** * @notice This function returns a snapshot of last available quotes * @return total deposits available on the contract */ function totalDeposits() public virtual view returns (uint); /** * @notice Calculate receipt tokens for a given amount of deposit tokens * @dev If contract is empty, use 1:1 ratio * @dev Could return zero shares for very low amounts of deposit tokens * @param amount deposit tokens * @return receipt tokens */ function getSharesForDepositTokens(uint amount) public view returns (uint) { if (totalSupply.mul(totalDeposits()) == 0) { return amount; } return amount.mul(totalSupply).div(totalDeposits()); } /** * @notice Calculate deposit tokens for a given amount of receipt tokens * @param amount receipt tokens * @return deposit tokens */ function getDepositTokensForShares(uint amount) public view returns (uint) { if (totalSupply.mul(totalDeposits()) == 0) { return 0; } return amount.mul(totalDeposits()).div(totalSupply); } /** * @notice Update reinvest min threshold * @param newValue threshold */ function updateMinTokensToReinvest(uint newValue) public onlyOwner { emit UpdateMinTokensToReinvest(MIN_TOKENS_TO_REINVEST, newValue); MIN_TOKENS_TO_REINVEST = newValue; } /** * @notice Update reinvest max threshold before a deposit * @param newValue threshold */ function updateMaxTokensToDepositWithoutReinvest(uint newValue) public onlyOwner { emit UpdateMaxTokensToDepositWithoutReinvest(MAX_TOKENS_TO_DEPOSIT_WITHOUT_REINVEST, newValue); MAX_TOKENS_TO_DEPOSIT_WITHOUT_REINVEST = newValue; } /** * @notice Update developer fee * @param newValue fee in BIPS */ function updateDevFee(uint newValue) public onlyOwner { require(newValue.add(ADMIN_FEE_BIPS).add(REINVEST_REWARD_BIPS) <= BIPS_DIVISOR); emit UpdateDevFee(DEV_FEE_BIPS, newValue); DEV_FEE_BIPS = newValue; } /** * @notice Update admin fee * @param newValue fee in BIPS */ function updateAdminFee(uint newValue) public onlyOwner { require(newValue.add(DEV_FEE_BIPS).add(REINVEST_REWARD_BIPS) <= BIPS_DIVISOR); emit UpdateAdminFee(ADMIN_FEE_BIPS, newValue); ADMIN_FEE_BIPS = newValue; } /** * @notice Update reinvest reward * @param newValue fee in BIPS */ function updateReinvestReward(uint newValue) public onlyOwner { require(newValue.add(ADMIN_FEE_BIPS).add(DEV_FEE_BIPS) <= BIPS_DIVISOR); emit UpdateReinvestReward(REINVEST_REWARD_BIPS, newValue); REINVEST_REWARD_BIPS = newValue; } /** * @notice Enable/disable deposits * @param newValue bool */ function updateDepositsEnabled(bool newValue) public onlyOwner { require(DEPOSITS_ENABLED != newValue); DEPOSITS_ENABLED = newValue; emit DepositsEnabled(newValue); } /** * @notice Update devAddr * @param newValue address */ function updateDevAddr(address newValue) public onlyDev { emit UpdateDevAddr(devAddr, newValue); devAddr = newValue; } /** * @notice Recover ERC20 from contract * @param tokenAddress token address * @param tokenAmount amount to recover */ function recoverERC20(address tokenAddress, uint tokenAmount) external onlyOwner { require(tokenAmount > 0); require(IERC20(tokenAddress).transfer(msg.sender, tokenAmount)); emit Recovered(tokenAddress, tokenAmount); } /** * @notice Recover AVAX from contract * @param amount amount */ function recoverAVAX(uint amount) external onlyOwner { require(amount > 0); msg.sender.transfer(amount); emit Recovered(address(0), amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface IBenqiUnitroller { function enterMarkets(address[] memory cTokens) external returns (uint[] memory); function exitMarket(address cTokenAddress) external returns (uint); function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint); function redeemAllowed(address cToken, address redeemer, uint redeemTokens) external returns (uint); function borrowAllowed(address cToken, address borrower, uint borrowAmount) external returns (uint); function claimReward(uint8 rewardType, address holder) external; //reward type 0 is qi, 1 is avax function rewardAccrued(uint8 rewardType, address holder) external view returns (uint); function markets(address cTokenAddress) external view returns (bool, uint); function getClaimableRewards(uint rewardToken) external view returns (uint, uint); function rewardSupplyState(uint8 rewardType, address holder) external view returns (uint224 index, uint32 timestamp); function rewardBorrowState(uint8 rewardType, address holder) external view returns (uint224 index, uint32 timestamp); function rewardSupplierIndex(uint8 rewardType, address qiContractAddress, address holder) external view returns (uint supplierIndex); function rewardBorrowerIndex(uint8 rewardType, address qiContractAddress, address holder) external view returns (uint borrowerIndex); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./IERC20.sol"; interface IBenqiERC20Delegator is IERC20 { function exchangeRateStored() external view returns (uint256); function exchangeRateCurrent() external returns (uint); function mint(uint256 mintAmount) external returns (uint256); function redeem(uint256 redeemTokens) external returns (uint256); function redeemUnderlying(uint256 redeemAmount) external returns (uint256); function borrow(uint256 borrowAmount) external returns (uint256); function repayBorrow(uint256 repayAmount) external returns (uint256); function balanceOfUnderlying(address owner) external returns (uint256); function borrowBalanceCurrent(address owner) external returns (uint256); function borrowBalanceStored(address owner) external view returns (uint256); function getAccountSnapshot(address account) external view returns (uint256 error, uint256 balance, uint256 borrow, uint256 mantissa); function getCash() external returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface IWAVAX { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function balanceOf(address owner) external view returns (uint); function withdraw(uint) external; function approve(address to, uint value) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./SafeMath.sol"; import "../interfaces/IPair.sol"; import "../interfaces/IWAVAX.sol"; library DexLibrary { using SafeMath for uint; bytes private constant zeroBytes = new bytes(0); IWAVAX private constant WAVAX = IWAVAX(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7); /** * @notice Swap directly through a Pair * @param amountIn input amount * @param fromToken address * @param toToken address * @param pair Pair used for swap * @return output amount */ function swap(uint amountIn, address fromToken, address toToken, IPair pair) internal returns (uint) { (address token0,) = sortTokens(fromToken, toToken); (uint112 reserve0, uint112 reserve1,) = pair.getReserves(); if (token0 != fromToken) (reserve0, reserve1) = (reserve1, reserve0); uint amountOut1 = 0; uint amountOut2 = getAmountOut(amountIn, reserve0, reserve1); if (token0 != fromToken) (amountOut1, amountOut2) = (amountOut2, amountOut1); safeTransfer(fromToken, address(pair), amountIn); pair.swap(amountOut1, amountOut2, address(this), zeroBytes); return amountOut2 > amountOut1 ? amountOut2 : amountOut1; } function checkSwapPairCompatibility(IPair pair, address tokenA, address tokenB) internal pure returns (bool) { return (tokenA == pair.token0() || tokenA == pair.token1()) && (tokenB == pair.token0() || tokenB == pair.token1()) && tokenA != tokenB; } function estimateConversionThroughPair(uint amountIn, address fromToken, address toToken, IPair swapPair) internal view returns (uint) { (address token0,) = sortTokens(fromToken, toToken); (uint112 reserve0, uint112 reserve1,) = swapPair.getReserves(); if (token0 != fromToken) (reserve0, reserve1) = (reserve1, reserve0); return getAmountOut(amountIn, reserve0, reserve1); } /** * @notice Converts reward tokens to deposit tokens * @dev No price checks enforced * @param amount reward tokens * @return deposit tokens */ function convertRewardTokensToDepositTokens(uint amount, address rewardToken, address depositToken, IPair swapPairToken0, IPair swapPairToken1) internal returns (uint) { uint amountIn = amount.div(2); require(amountIn > 0, "DexLibrary::_convertRewardTokensToDepositTokens"); address token0 = IPair(depositToken).token0(); uint amountOutToken0 = amountIn; if (rewardToken != token0) { amountOutToken0 = DexLibrary.swap(amountIn, rewardToken, token0, swapPairToken0); } address token1 = IPair(depositToken).token1(); uint amountOutToken1 = amountIn; if (rewardToken != token1) { amountOutToken1 = DexLibrary.swap(amountIn, rewardToken, token1, swapPairToken1); } return DexLibrary.addLiquidity(depositToken, amountOutToken0, amountOutToken1); } /** * @notice Add liquidity directly through a Pair * @dev Checks adding the max of each token amount * @param depositToken address * @param maxAmountIn0 amount token0 * @param maxAmountIn1 amount token1 * @return liquidity tokens */ function addLiquidity(address depositToken, uint maxAmountIn0, uint maxAmountIn1) internal returns (uint) { (uint112 reserve0, uint112 reserve1,) = IPair(address(depositToken)).getReserves(); uint amountIn1 = _quoteLiquidityAmountOut(maxAmountIn0, reserve0, reserve1); if (amountIn1 > maxAmountIn1) { amountIn1 = maxAmountIn1; maxAmountIn0 = _quoteLiquidityAmountOut(maxAmountIn1, reserve1, reserve0); } safeTransfer(IPair(depositToken).token0(), depositToken, maxAmountIn0); safeTransfer(IPair(depositToken).token1(), depositToken, amountIn1); return IPair(depositToken).mint(address(this)); } /** * @notice Quote liquidity amount out * @param amountIn input tokens * @param reserve0 size of input asset reserve * @param reserve1 size of output asset reserve * @return liquidity tokens */ function _quoteLiquidityAmountOut(uint amountIn, uint reserve0, uint reserve1) private pure returns (uint) { return amountIn.mul(reserve1).div(reserve0); } /** * @notice Given two tokens, it'll return the tokens in the right order for the tokens pair * @dev TokenA must be different from TokenB, and both shouldn't be address(0), no validations * @param tokenA address * @param tokenB address * @return sorted tokens */ function sortTokens(address tokenA, address tokenB) internal pure returns (address, address) { return tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); } /** * @notice Given an input amount of an asset and pair reserves, returns maximum output amount of the other asset * @dev Assumes swap fee is 0.30% * @param amountIn input asset * @param reserveIn size of input asset reserve * @param reserveOut size of output asset reserve * @return maximum output amount */ function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint) { uint amountInWithFee = amountIn.mul(997); uint numerator = amountInWithFee.mul(reserveOut); uint denominator = reserveIn.mul(1000).add(amountInWithFee); return numerator.div(denominator); } /** * @notice Safely transfer using an anonymous ERC20 token * @dev Requires token to return true on transfer * @param token address * @param to recipient address * @param value amount */ function safeTransfer(address token, address to, uint256 value) internal { require(IERC20(token).transfer(to, value), "DexLibrary::TRANSFER_FROM_FAILED"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction underflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, errorMessage); return c; } /** * @dev Returns the integer division of two unsigned integers. * Reverts on division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. * Reverts with custom message on division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./Ownable.sol"; import "./SafeMath.sol"; abstract contract Permissioned is Ownable { using SafeMath for uint; uint public numberOfAllowedDepositors; mapping(address => bool) public allowedDepositors; event AllowDepositor(address indexed account); event RemoveDepositor(address indexed account); modifier onlyAllowedDeposits() { if (numberOfAllowedDepositors > 0) { require(allowedDepositors[msg.sender] == true, "Permissioned::onlyAllowedDeposits, not allowed"); } _; } /** * @notice Add an allowed depositor * @param depositor address */ function allowDepositor(address depositor) external onlyOwner { require(allowedDepositors[depositor] == false, "Permissioned::allowDepositor"); allowedDepositors[depositor] = true; numberOfAllowedDepositors = numberOfAllowedDepositors.add(1); emit AllowDepositor(depositor); } /** * @notice Remove an allowed depositor * @param depositor address */ function removeDepositor(address depositor) external onlyOwner { require(numberOfAllowedDepositors > 0, "Permissioned::removeDepositor, no allowed depositors"); require(allowedDepositors[depositor] == true, "Permissioned::removeDepositor, not allowed"); allowedDepositors[depositor] = false; numberOfAllowedDepositors = numberOfAllowedDepositors.sub(1); emit RemoveDepositor(depositor); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./lib/SafeMath.sol"; import "./interfaces/IERC20.sol"; abstract contract YakERC20 { using SafeMath for uint256; string public name = "Yield Yak"; string public symbol = "YRT"; uint8 public constant decimals = 18; uint256 public totalSupply; mapping (address => mapping (address => uint256)) internal allowances; mapping (address => uint256) internal balances; /// @dev keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") bytes32 public constant DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; /// @dev keccak256("1"); bytes32 public constant VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; /// @dev keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor() {} /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved */ function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * It is recommended to use increaseAllowance and decreaseAllowance instead * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint256 amount) external returns (bool) { _approve(msg.sender, spender, amount); return true; } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view returns (uint) { return balances[account]; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint256 amount) external returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint256 amount) external returns (bool) { address spender = msg.sender; uint256 spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint256(-1)) { uint256 newAllowance = spenderAllowance.sub(amount, "transferFrom: transfer amount exceeds allowance"); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } /** * @notice Approval implementation * @param owner The address of the account which owns tokens * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "_approve::owner zero address"); require(spender != address(0), "_approve::spender zero address"); allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @notice Transfer implementation * @param from The address of the account which owns tokens * @param to The address of the account which is receiving tokens * @param value The number of tokens that are being transferred */ function _transferTokens(address from, address to, uint256 value) internal { require(to != address(0), "_transferTokens: cannot transfer to the zero address"); balances[from] = balances[from].sub(value, "_transferTokens: transfer exceeds from balance"); balances[to] = balances[to].add(value); emit Transfer(from, to, value); } function _mint(address to, uint256 value) internal { totalSupply = totalSupply.add(value); balances[to] = balances[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint256 value) internal { balances[from] = balances[from].sub(value, "_burn: burn amount exceeds from balance"); totalSupply = totalSupply.sub(value, "_burn: burn amount exceeds total supply"); emit Transfer(from, address(0), value); } /** * @notice Triggers an approval from owner to spender * @param owner The address to approve from * @param spender The address to be approved * @param value The number of tokens that are approved (2^256-1 means infinite) * @param deadline The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, "permit::expired"); bytes32 encodeData = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)); _validateSignedData(owner, encodeData, v, r, s); _approve(owner, spender, value); } /** * @notice Recovers address from signed data and validates the signature * @param signer Address that signed the data * @param encodeData Data signed by the address * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function _validateSignedData(address signer, bytes32 encodeData, uint8 v, bytes32 r, bytes32 s) internal view { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", getDomainSeparator(), encodeData ) ); address recoveredAddress = ecrecover(digest, v, r, s); // Explicitly disallow authorizations for address(0) as ecrecover returns address(0) on malformed messages require(recoveredAddress != address(0) && recoveredAddress == signer, "Arch::validateSig: invalid signature"); } /** * @notice EIP-712 Domain separator * @return Separator */ function getDomainSeparator() public view returns (bytes32) { return keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name)), VERSION_HASH, _getChainId(), address(this) ) ); } /** * @notice Current id of the chain where this contract is deployed * @return Chain id */ function _getChainId() internal pure returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./IERC20.sol"; interface IPair is IERC20 { function token0() external pure returns (address); function token1() external pure returns (address); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function mint(address to) external returns (uint liquidity); function sync() external; }
{ "optimizer": { "enabled": true, "runs": 999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"address","name":"_depositToken","type":"address"},{"internalType":"address","name":"_rewardController","type":"address"},{"internalType":"address","name":"_tokenDelegator","type":"address"},{"internalType":"address","name":"_rewardToken0","type":"address"},{"internalType":"address","name":"_rewardToken1","type":"address"},{"internalType":"address","name":"_swapPairToken0","type":"address"},{"internalType":"address","name":"_swapPairToken1","type":"address"},{"internalType":"address","name":"_timelock","type":"address"},{"internalType":"uint256","name":"_minMinting","type":"uint256"},{"internalType":"uint256","name":"_leverageLevel","type":"uint256"},{"internalType":"uint256","name":"_leverageBips","type":"uint256"},{"internalType":"uint256","name":"_minTokensToReinvest","type":"uint256"},{"internalType":"uint256","name":"_adminFeeBips","type":"uint256"},{"internalType":"uint256","name":"_devFeeBips","type":"uint256"},{"internalType":"uint256","name":"_reinvestRewardBips","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"AllowDepositor","type":"event"},{"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":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newValue","type":"bool"}],"name":"DepositsEnabled","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":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTotalDeposits","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalSupply","type":"uint256"}],"name":"Reinvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"RemoveDepositor","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":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"UpdateAdminFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValue","type":"address"},{"indexed":false,"internalType":"address","name":"newValue","type":"address"}],"name":"UpdateDevAddr","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"UpdateDevFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"UpdateMaxTokensToDepositWithoutReinvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"UpdateMinTokensToReinvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"UpdateReinvestReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"ADMIN_FEE_BIPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSITS_ENABLED","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEV_FEE_BIPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TOKENS_TO_DEPOSIT_WITHOUT_REINVEST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_TOKENS_TO_REINVEST","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REINVEST_REWARD_BIPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"allowDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedDepositors","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"depositWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"estimateDeployedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"estimateReinvestReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActualLeverage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getDepositTokensForShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getSharesForDepositTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfAllowedDepositors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverAVAX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reinvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"}],"name":"removeDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minReturnAmountAccepted","type":"uint256"},{"internalType":"bool","name":"disableDeposits","type":"bool"}],"name":"rescueDeployedFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"revokeAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"setAllowances","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposits","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":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","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":"newValue","type":"uint256"}],"name":"updateAdminFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"newValue","type":"bool"}],"name":"updateDepositsEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"updateDevAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"updateDevFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_leverageLevel","type":"uint256"},{"internalType":"uint256","name":"_leverageBips","type":"uint256"},{"internalType":"uint256","name":"_redeemLimitSafetyMargin","type":"uint256"}],"name":"updateLeverage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"updateMaxTokensToDepositWithoutReinvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"updateMinTokensToReinvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"updateReinvestReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x60806040526004361061036f5760003560e01c80638da5cb5b116101c6578063cff1b6ef116100f7578063dd8ce4d611610095578063ed24911d1161006f578063ed24911d14610c33578063f2fde38b14610c48578063f7c618c114610c7b578063fdb5a03e14610c90576103bf565b8063dd8ce4d614610bb5578063e21ac82514610bdf578063eab89a5a14610c09576103bf565b8063da09c72c116100d1578063da09c72c14610b3b578063db8dd95c14610b50578063dbd9a4d414610b65578063dd62ed3e14610b7a576103bf565b8063cff1b6ef14610a7d578063d505accf14610aa7578063d6ec2a4914610b05576103bf565b8063ac0d31ff11610164578063b9e57b801161013e578063b9e57b8014610a29578063bd079f5514610a3e578063c4b24a4614610a53578063c89039c514610a68576103bf565b8063ac0d31ff146109b8578063b52a321f146109ea578063b6b55f25146109ff576103bf565b806399729ec1116101a057806399729ec1146109165780639e4e731814610940578063a8ae2b7c14610955578063a9059cbb1461097f576103bf565b80638da5cb5b1461089d5780639291d563146108ce57806395d89b4114610901576103bf565b80634bebd1e7116102a05780637ae267731161023e578063818372301161021857806381837230146107f25780638980f11f1461081c5780638aff733d146108555780638b73e6061461086a576103bf565b80637ae267731461076f5780637d882097146107aa5780637ecebe00146107bf576103bf565b80635ea682ea1161027a5780635ea682ea146106fd57806370a0823114610712578063715018a614610745578063789139bc1461075a576103bf565b80634bebd1e7146106745780634e77ace5146106a75780634ebb7916146106d3576103bf565b80632e1a7d4d1161030d578063313ce567116102e7578063313ce567146105bc5780633bdc6e72146105e7578063483c2ef0146105fc5780634a970be71461062f576103bf565b80632e1a7d4d146105445780632f4f21e21461056e57806330adf81f146105a7576103bf565b80630f23475d116103495780630f23475d146104c257806318160ddd146104d757806320606b70146104ec57806323b872dd14610501576103bf565b806306fdde03146103c4578063076771111461044e578063095ea7b314610475576103bf565b366103bf576012546001600160a01b031633146103bd5760405162461bcd60e51b8152600401808060200182810382526025815260200180614cef6025913960400191505060405180910390fd5b005b600080fd5b3480156103d057600080fd5b506103d9610ca5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104135781810151838201526020016103fb565b50505050905090810190601f1680156104405780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045a57600080fd5b50610463610d33565b60408051918252519081900360200190f35b34801561048157600080fd5b506104ae6004803603604081101561049857600080fd5b506001600160a01b038135169060200135610d39565b604080519115158252519081900360200190f35b3480156104ce57600080fd5b50610463610d50565b3480156104e357600080fd5b50610463610d60565b3480156104f857600080fd5b50610463610d66565b34801561050d57600080fd5b506104ae6004803603606081101561052457600080fd5b506001600160a01b03813581169160208101359091169060400135610d8a565b34801561055057600080fd5b506103bd6004803603602081101561056757600080fd5b5035610e6c565b34801561057a57600080fd5b506103bd6004803603604081101561059157600080fd5b506001600160a01b038135169060200135610f47565b3480156105b357600080fd5b50610463610f55565b3480156105c857600080fd5b506105d1610f79565b6040805160ff9092168252519081900360200190f35b3480156105f357600080fd5b50610463610f7e565b34801561060857600080fd5b506104ae6004803603602081101561061f57600080fd5b50356001600160a01b0316610f84565b34801561063b57600080fd5b506103bd600480360360a081101561065257600080fd5b5080359060208101359060ff6040820135169060608101359060800135610f99565b34801561068057600080fd5b506103bd6004803603602081101561069757600080fd5b50356001600160a01b0316611052565b3480156106b357600080fd5b506103bd600480360360208110156106ca57600080fd5b5035151561118e565b3480156106df57600080fd5b506103bd600480360360208110156106f657600080fd5b503561124d565b34801561070957600080fd5b50610463611329565b34801561071e57600080fd5b506104636004803603602081101561073557600080fd5b50356001600160a01b031661132f565b34801561075157600080fd5b506103bd61134e565b34801561076657600080fd5b50610463611407565b34801561077b57600080fd5b506103bd6004803603604081101561079257600080fd5b506001600160a01b038135811691602001351661140d565b3480156107b657600080fd5b506104636114fc565b3480156107cb57600080fd5b50610463600480360360208110156107e257600080fd5b50356001600160a01b03166115b8565b3480156107fe57600080fd5b506103bd6004803603602081101561081557600080fd5b50356115ca565b34801561082857600080fd5b506103bd6004803603604081101561083f57600080fd5b506001600160a01b03813516906020013561166e565b34801561086157600080fd5b506104636117c2565b34801561087657600080fd5b506103bd6004803603602081101561088d57600080fd5b50356001600160a01b03166117c8565b3480156108a957600080fd5b506108b261192f565b604080516001600160a01b039092168252519081900360200190f35b3480156108da57600080fd5b506103bd600480360360208110156108f157600080fd5b50356001600160a01b031661193e565b34801561090d57600080fd5b506103d9611a14565b34801561092257600080fd5b506103bd6004803603602081101561093957600080fd5b5035611a6e565b34801561094c57600080fd5b50610463611b41565b34801561096157600080fd5b506103bd6004803603602081101561097857600080fd5b5035611b65565b34801561098b57600080fd5b506104ae600480360360408110156109a257600080fd5b506001600160a01b038135169060200135611c32565b3480156109c457600080fd5b506103bd600480360360408110156109db57600080fd5b50803590602001351515611c3f565b3480156109f657600080fd5b506104ae612061565b348015610a0b57600080fd5b506103bd60048036036020811015610a2257600080fd5b503561206a565b348015610a3557600080fd5b50610463612077565b348015610a4a57600080fd5b506104636120b8565b348015610a5f57600080fd5b506104636120be565b348015610a7457600080fd5b506108b26120c9565b348015610a8957600080fd5b506103bd60048036036020811015610aa057600080fd5b50356120d8565b348015610ab357600080fd5b506103bd600480360360e0811015610aca57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356121a5565b348015610b1157600080fd5b506103bd60048036036060811015610b2857600080fd5b50803590602081013590604001356122a5565b348015610b4757600080fd5b506108b261243a565b348015610b5c57600080fd5b50610463612449565b348015610b7157600080fd5b506103bd61251f565b348015610b8657600080fd5b5061046360048036036040811015610b9d57600080fd5b506001600160a01b0381358116916020013516612687565b348015610bc157600080fd5b5061046360048036036020811015610bd857600080fd5b50356126b2565b348015610beb57600080fd5b506103bd60048036036020811015610c0257600080fd5b50356126ec565b348015610c1557600080fd5b5061046360048036036020811015610c2c57600080fd5b5035612790565b348015610c3f57600080fd5b506104636127c1565b348015610c5457600080fd5b506103bd60048036036020811015610c6b57600080fd5b50356001600160a01b03166128ce565b348015610c8757600080fd5b506108b26129de565b348015610c9c57600080fd5b506103bd6129ed565b6000805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b820191906000526020600020905b815481529060010190602001808311610d0e57829003601f168201915b505050505081565b60105481565b6000610d46338484612bb7565b5060015b92915050565b6000610d5a6114fc565b90505b90565b60025481565b7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6001600160a01b038316600081815260036020908152604080832033808552925282205491929091908214801590610dc457506000198114155b15610e55576000610df0856040518060600160405280602f8152602001614e8f602f9139849190612ccf565b6001600160a01b0380891660008181526003602090815260408083209489168084529482529182902085905581518581529151949550929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a3505b610e60868686612d66565b50600195945050505050565b6000610e8c600254610e8684610e80612e73565b90612abb565b90612b1b565b905060008111610ee3576040805162461bcd60e51b815260206004820152601960248201527f42656e7169537472617465677956323a3a776974686472617700000000000000604482015290519081900360640190fd5b610eed3383612f81565b610ef681613056565b600954610f0d906001600160a01b03163383613115565b60408051828152905133917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a25050565b610f5182826131d3565b5050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60075481565b60086020526000908152604090205460ff1681565b600954604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018890526064810187905260ff8616608482015260a4810185905260c4810184905290516001600160a01b039092169163d505accf9160e48082019260009290919082900301818387803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b5050505061104b33866131d3565b5050505050565b61105a61344c565b6001600160a01b031661106b61192f565b6001600160a01b0316146110b4576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526008602052604090205460ff1615611122576040805162461bcd60e51b815260206004820152601c60248201527f5065726d697373696f6e65643a3a616c6c6f774465706f7369746f7200000000604482015290519081900360640190fd5b6001600160a01b0381166000908152600860205260409020805460ff1916600190811790915560075461115491612b5d565b6007556040516001600160a01b038216907fc0a1035c16faf8d1304056d92c00edf028f87e62b8235a938f00af9e3c0312c590600090a250565b61119661344c565b6001600160a01b03166111a761192f565b6001600160a01b0316146111f0576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b600e5460ff161515811515141561120657600080fd5b600e805482151560ff19909116811790915560408051918252517f7b014ed3854e7f5cb0218d58b3c6ae7d53a68bb0af2f67bfb029ea42c38a7e859181900360200190a150565b61125561344c565b6001600160a01b031661126661192f565b6001600160a01b0316146112af576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b600081116112bc57600080fd5b604051339082156108fc029083906000818181858888f193505050501580156112e9573d6000803e3d6000fd5b5060408051600081526020810183905281517f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28929181900390910190a150565b60115481565b6001600160a01b0381166000908152600460205260409020545b919050565b61135661344c565b6001600160a01b031661136761192f565b6001600160a01b0316146113b0576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b6006546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36006805473ffffffffffffffffffffffffffffffffffffffff19169055565b600d5481565b61141561344c565b6001600160a01b031661142661192f565b6001600160a01b03161461146f576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b816001600160a01b031663095ea7b38260006040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156114c757600080fd5b505af11580156114db573d6000803e3d6000fd5b505050506040513d60208110156114f157600080fd5b5051610f5157600080fd5b601354604080516361bfb47160e11b815230600482015290516000928392839283926001600160a01b03169163c37f68e2916024808301926080929190829003018186803b15801561154d57600080fd5b505afa158015611561573d6000803e3d6000fd5b505050506040513d608081101561157757600080fd5b506020810151604082015160609092015190945090925090506115b0826115aa670de0b6b3a7640000610e868786612abb565b90613450565b935050505090565b60056020526000908152604090205481565b6115d261344c565b6001600160a01b03166115e361192f565b6001600160a01b03161461162c576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b600c54604080519182526020820183905280517f481f79ac3a523b6d6db3c5a720e190e986d1cc1b41adcdf50f9caef8499011009281900390910190a1600c55565b61167661344c565b6001600160a01b031661168761192f565b6001600160a01b0316146116d0576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b600081116116dd57600080fd5b604080517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810183905290516001600160a01b0384169163a9059cbb9160448083019260209291908290030181600087803b15801561174557600080fd5b505af1158015611759573d6000803e3d6000fd5b505050506040513d602081101561176f57600080fd5b505161177a57600080fd5b604080516001600160a01b03841681526020810183905281517f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28929181900390910190a15050565b600f5481565b6117d061344c565b6001600160a01b03166117e161192f565b6001600160a01b03161461182a576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b60006007541161186b5760405162461bcd60e51b8152600401808060200182810382526034815260200180614c976034913960400191505060405180910390fd5b6001600160a01b03811660009081526008602052604090205460ff1615156001146118c75760405162461bcd60e51b815260040180806020018281038252602a815260200180614d38602a913960400191505060405180910390fd5b6001600160a01b0381166000908152600860205260409020805460ff191690556007546118f5906001613450565b6007556040516001600160a01b038216907f0e86f6608b536e5339a25b65ff531f5ea91e1313d056ecd4752b35cbd16137d490600090a250565b6006546001600160a01b031690565b600b546001600160a01b0316331461199d576040805162461bcd60e51b815260206004820152601460248201527f59616b53747261746567793a3a6f6e6c79446576000000000000000000000000604482015290519081900360640190fd5b600b54604080516001600160a01b039283168152918316602083015280517fa8e91499ed37682f43cffb045fcc7d379a91e8c9a14e6321877ee34dee564c009281900390910190a1600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d2b5780601f10610d0057610100808354040283529160200191610d2b565b611a7661344c565b6001600160a01b0316611a8761192f565b6001600160a01b031614611ad0576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b612710611af4600f54611aee60105485612b5d90919063ffffffff16565b90612b5d565b1115611aff57600080fd5b601154604080519182526020820183905280517f2a42303d002f0ba6cfe8259c91d4684443fb0b3de286ba74991175d6517261319281900390910190a1601155565b7fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc681565b611b6d61344c565b6001600160a01b0316611b7e61192f565b6001600160a01b031614611bc7576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b612710611be5601154611aee60105485612b5d90919063ffffffff16565b1115611bf057600080fd5b600f54604080519182526020820183905280517fe7f97d51d307dc44045597c9978bec0f842e6bb40d19b9444084cfa30d9ed4f29281900390910190a1600f55565b6000610d46338484612d66565b611c4761344c565b6001600160a01b0316611c5861192f565b6001600160a01b031614611ca1576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b600954604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611cec57600080fd5b505afa158015611d00573d6000803e3d6000fd5b505050506040513d6020811015611d1657600080fd5b5051601354604080516305eff7ef60e21b815230600482015290519293506000926001600160a01b03909216916317bfdfbc9160248082019260209290919082900301818787803b158015611d6a57600080fd5b505af1158015611d7e573d6000803e3d6000fd5b505050506040513d6020811015611d9457600080fd5b505160135460408051633af9e66960e01b815230600482015290519293506000926001600160a01b0390921691633af9e6699160248082019260209290919082900301818787803b158015611de857600080fd5b505af1158015611dfc573d6000803e3d6000fd5b505050506040513d6020811015611e1257600080fd5b50519050611e28611e238284613450565b613492565b60135460408051633af9e66960e01b815230600482015290516001600160a01b039092169163852a12e3918391633af9e669916024808201926020929091908290030181600087803b158015611e7d57600080fd5b505af1158015611e91573d6000803e3d6000fd5b505050506040513d6020811015611ea757600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092525160248083019260209291908290030181600087803b158015611f0057600080fd5b505af1158015611f14573d6000803e3d6000fd5b505050506040513d6020811015611f2a57600080fd5b5050600954604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611f7757600080fd5b505afa158015611f8b573d6000803e3d6000fd5b505050506040513d6020811015611fa157600080fd5b5051905085611fb08286613450565b1015611fed5760405162461bcd60e51b8152600401808060200182810382526024815260200180614d146024913960400191505060405180910390fd5b7fc7606d21ac05cd309191543e409f0845c016120563783d70e4f41419dc0ef2346120166114fc565b6002546040805192835260208301919091528051918290030190a1600e5460ff161515600114801561204a57506001851515145b1561205957612059600061118e565b505050505050565b600e5460ff1681565b61207433826131d3565b50565b6000806120826120be565b9050600c5481106120b0576120a8612710610e86600f5484612abb90919063ffffffff16565b915050610d5d565b600091505090565b600c5481565b6000806115b06138a5565b6009546001600160a01b031681565b6120e061344c565b6001600160a01b03166120f161192f565b6001600160a01b03161461213a576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b612710612158600f54611aee60115485612b5d90919063ffffffff16565b111561216357600080fd5b601054604080519182526020820183905280517f3cc372f330f95ac9540626dc8a25f5bf21ba607215a5d58304cb804d446f104a9281900390910190a1601055565b428410156121fa576040805162461bcd60e51b815260206004820152600f60248201527f7065726d69743a3a657870697265640000000000000000000000000000000000604482015290519081900360640190fd5b6001600160a01b0380881660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938a1660608401526080830189905260a083019390935260c08083018890528151808403909101815260e090920190528051910120612290888286868661390c565b61229b888888612bb7565b5050505050505050565b600b546001600160a01b03163314612304576040805162461bcd60e51b815260206004820152601460248201527f59616b53747261746567793a3a6f6e6c79446576000000000000000000000000604482015290519081900360640190fd5b61230f838383613a3b565b601354604080516305eff7ef60e21b815230600482015290516000926001600160a01b0316916317bfdfbc91602480830192602092919082900301818787803b15801561235b57600080fd5b505af115801561236f573d6000803e3d6000fd5b505050506040513d602081101561238557600080fd5b505160135460408051633af9e66960e01b815230600482015290519293506000926001600160a01b0390921691633af9e6699160248082019260209290919082900301818787803b1580156123d957600080fd5b505af11580156123ed573d6000803e3d6000fd5b505050506040513d602081101561240357600080fd5b50519050612414611e238284613450565b60006124208284613450565b111561104b5761104b6124338284613450565b6000613a49565b600b546001600160a01b031681565b601354604080516361bfb47160e11b815230600482015290516000928392839283926001600160a01b03169163c37f68e2916024808301926080929190829003018186803b15801561249a57600080fd5b505afa1580156124ae573d6000803e3d6000fd5b505050506040513d60808110156124c457600080fd5b5060208101516040820151606090920151909450909250905060006124f5670de0b6b3a7640000610e868685612abb565b90506125166125048285613450565b610e8683670de0b6b3a7640000612abb565b94505050505090565b61252761344c565b6001600160a01b031661253861192f565b6001600160a01b031614612581576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b6009546013546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b1580156125db57600080fd5b505af11580156125ef573d6000803e3d6000fd5b505050506040513d602081101561260557600080fd5b50506013546040805163095ea7b360e01b81526001600160a01b039092166004830181905260001960248401529051909163095ea7b39160448083019260209291908290030181600087803b15801561265d57600080fd5b505af1158015612671573d6000803e3d6000fd5b505050506040513d6020811015610f5157600080fd5b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b60006126c86126bf6114fc565b60025490612abb565b6126d3575080611349565b610d4a6126de6114fc565b600254610e86908590612abb565b6126f461344c565b6001600160a01b031661270561192f565b6001600160a01b03161461274e576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b600d54604080519182526020820183905280517fa5dae50539d56dfe1fb5273d883b0c39bc76750a25d036fc5fbd09ad8fd5f57f9281900390910190a1600d55565b600061279d6126bf6114fc565b6127a957506000611349565b610d4a600254610e866127ba6114fc565b8590612abb565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60001b600060405180828054600181600116156101000203166002900480156128445780601f10612822576101008083540402835291820191612844565b820191906000526020600020905b815481529060010190602001808311612830575b505091505060405180910390207fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660001b61287d613cf0565b3060405160200180868152602001858152602001848152602001838152602001826001600160a01b031681526020019550505050505060405160208183030381529060405280519060200120905090565b6128d661344c565b6001600160a01b03166128e761192f565b6001600160a01b031614612930576040805162461bcd60e51b81526020600482018190526024820152600080516020614daa833981519152604482015290519081900360640190fd5b6001600160a01b0381166129755760405162461bcd60e51b8152600401808060200182810382526026815260200180614c436026913960400191505060405180910390fd5b6006546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600a546001600160a01b031681565b323314612a41576040805162461bcd60e51b815260206004820152601460248201527f59616b53747261746567793a3a6f6e6c79454f41000000000000000000000000604482015290519081900360640190fd5b6000806000612a4e6138a5565b925092509250600c54811015612aab576040805162461bcd60e51b815260206004820152601960248201527f42656e7169537472617465677956323a3a7265696e7665737400000000000000604482015290519081900360640190fd5b612ab6838383613cf4565b505050565b600082612aca57506000610d4a565b82820282848281612ad757fe5b0414612b145760405162461bcd60e51b8152600401808060200182810382526021815260200180614d896021913960400191505060405180910390fd5b9392505050565b6000612b1483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613f6f565b600082820183811015612b14576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b038316612c12576040805162461bcd60e51b815260206004820152601c60248201527f5f617070726f76653a3a6f776e6572207a65726f206164647265737300000000604482015290519081900360640190fd5b6001600160a01b038216612c6d576040805162461bcd60e51b815260206004820152601e60248201527f5f617070726f76653a3a7370656e646572207a65726f20616464726573730000604482015290519081900360640190fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60008184841115612d5e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d23578181015183820152602001612d0b565b50505050905090810190601f168015612d505780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216612dab5760405162461bcd60e51b8152600401808060200182810382526034815260200180614e346034913960400191505060405180910390fd5b612de8816040518060600160405280602e8152602001614ee5602e91396001600160a01b0386166000908152600460205260409020549190612ccf565b6001600160a01b038085166000908152600460205260408082209390935590841681522054612e179082612b5d565b6001600160a01b0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b601354604080516305eff7ef60e21b8152306004820152905160009283926001600160a01b03909116916317bfdfbc9160248082019260209290919082900301818787803b158015612ec457600080fd5b505af1158015612ed8573d6000803e3d6000fd5b505050506040513d6020811015612eee57600080fd5b505160135460408051633af9e66960e01b815230600482015290519293506000926001600160a01b0390921691633af9e6699160248082019260209290919082900301818787803b158015612f4257600080fd5b505af1158015612f56573d6000803e3d6000fd5b505050506040513d6020811015612f6c57600080fd5b50519050612f7a8183613450565b9250505090565b612fbe81604051806060016040528060278152602001614ebe602791396001600160a01b0385166000908152600460205260409020549190612ccf565b60046000846001600160a01b03166001600160a01b031681526020019081526020016000208190555061300e81604051806060016040528060278152602001614d62602791396002549190612ccf565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b61305f81613492565b6013546040805163852a12e360e01b81526004810184905290516001600160a01b039092169163852a12e3916024808201926020929091908290030181600087803b1580156130ad57600080fd5b505af11580156130c1573d6000803e3d6000fd5b505050506040513d60208110156130d757600080fd5b5051156120745760405162461bcd60e51b8152600401808060200182810382526021815260200180614e136021913960400191505060405180910390fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561316c57600080fd5b505af1158015613180573d6000803e3d6000fd5b505050506040513d602081101561319657600080fd5b5051612ab65760405162461bcd60e51b8152600401808060200182810382526025815260200180614dee6025913960400191505060405180910390fd5b6007541561322e573360009081526008602052604090205460ff16151560011461322e5760405162461bcd60e51b815260040180806020018281038252602e815260200180614c69602e913960400191505060405180910390fd5b600e5460ff16151560011461328a576040805162461bcd60e51b815260206004820152601960248201527f42656e7169537472617465677956323a3a5f6465706f73697400000000000000604482015290519081900360640190fd5b600d54156132be57600080600061329f6138a5565b925092509250600d548111156132ba576132ba838383613cf4565b5050505b600954604080517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561333157600080fd5b505af1158015613345573d6000803e3d6000fd5b505050506040513d602081101561335b57600080fd5b50516133ae576040805162461bcd60e51b815260206004820181905260248201527f42656e7169537472617465677956323a3a7472616e73666572206661696c6564604482015290519081900360640190fd5b8060006133b9612e73565b905060006133d282600254612abb90919063ffffffff16565b11156133f4576133f181610e8660025486612abb90919063ffffffff16565b91505b6133fe8483613fd4565b6134078361405f565b6040805184815290516001600160a01b038616917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a250505050565b3390565b6000612b1483836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f7700815250612ccf565b601354604080516305eff7ef60e21b815230600482015290516000926001600160a01b0316916317bfdfbc91602480830192602092919082900301818787803b1580156134de57600080fd5b505af11580156134f2573d6000803e3d6000fd5b505050506040513d602081101561350857600080fd5b505160135460408051633af9e66960e01b815230600482015290519293506000926001600160a01b0390921691633af9e6699160248082019260209290919082900301818787803b15801561355c57600080fd5b505af1158015613570573d6000803e3d6000fd5b505050506040513d602081101561358657600080fd5b5051905060006135c061359d856115aa8587613450565b6115aa601954610e86601854610e808a6115aa8b8b61345090919063ffffffff16565b905060006135ce8483613450565b90506000806135db61426c565b915091505b821561389c5760006135f486888585614316565b9050838111156136015750825b6013546040805163852a12e360e01b81526004810184905290516001600160a01b039092169163852a12e3916024808201926020929091908290030181600087803b15801561364f57600080fd5b505af1158015613663573d6000803e3d6000fd5b505050506040513d602081101561367957600080fd5b5051156136b75760405162461bcd60e51b8152600401808060200182810382526021815260200180614e136021913960400191505060405180910390fd5b601354604080517f0e7527020000000000000000000000000000000000000000000000000000000081526004810184905290516001600160a01b0390921691630e752702916024808201926020929091908290030181600087803b15801561371e57600080fd5b505af1158015613732573d6000803e3d6000fd5b505050506040513d602081101561374857600080fd5b5051156137865760405162461bcd60e51b8152600401808060200182810382526027815260200180614e686027913960400191505060405180910390fd5b60135460408051633af9e66960e01b815230600482015290516001600160a01b0390921691633af9e669916024808201926020929091908290030181600087803b1580156137d357600080fd5b505af11580156137e7573d6000803e3d6000fd5b505050506040513d60208110156137fd57600080fd5b5051601354604080516305eff7ef60e21b815230600482015290519298506001600160a01b03909116916317bfdfbc916024808201926020929091908290030181600087803b15801561384f57600080fd5b505af1158015613863573d6000803e3d6000fd5b505050506040513d602081101561387957600080fd5b5051965086851061388a575061389c565b6138948786613450565b9350506135e0565b50505050505050565b6000806000806138b660003061434e565b905060006138c560013061434e565b6014546015546016549293506000926138f09286926001600160a01b039182169290821691166147e0565b905082826138fe8184612b5d565b955095509550505050909192565b60006139166127c1565b8560405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018286868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156139ca573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590613a005750866001600160a01b0316816001600160a01b0316145b61389c5760405162461bcd60e51b8152600401808060200182810382526024815260200180614ccb6024913960400191505060405180910390fd5b601892909255601955601b55565b600080613a5461426c565b9150915060008490506000613a7e601954610e86601854610e80898b61345090919063ffffffff16565b9050845b8183101561389c576000613a98848388886148b0565b905082613aa58583612b5d565b1115613ab857613ab58385613450565b90505b601a54811015613ac8575061389c565b601354604080517fc5ebeaec0000000000000000000000000000000000000000000000000000000081526004810184905290516001600160a01b039092169163c5ebeaec916024808201926020929091908290030181600087803b158015613b2f57600080fd5b505af1158015613b43573d6000803e3d6000fd5b505050506040513d6020811015613b5957600080fd5b505115613b975760405162461bcd60e51b8152600401808060200182810382526021815260200180614c226021913960400191505060405180910390fd5b6013546040805163140e25ad60e31b81526004810184905290516001600160a01b039092169163a0712d68916024808201926020929091908290030181600087803b158015613be557600080fd5b505af1158015613bf9573d6000803e3d6000fd5b505050506040513d6020811015613c0f57600080fd5b505115613c63576040805162461bcd60e51b815260206004820152601f60248201527f42656e7169537472617465677956323a3a6c656e64696e67206661696c656400604482015290519081900360640190fd5b60135460408051633af9e66960e01b815230600482015290516001600160a01b0390921691633af9e669916024808201926020929091908290030181600087803b158015613cb057600080fd5b505af1158015613cc4573d6000803e3d6000fd5b505050506040513d6020811015613cda57600080fd5b50519350613ce88282612b5d565b915050613a82565b4690565b60125460408051630952c56360e01b815260006004820181905230602483015291516001600160a01b0390931692630952c5639260448084019391929182900301818387803b158015613d4657600080fd5b505af1158015613d5a573d6000803e3d6000fd5b505060125460408051630952c56360e01b81526001600482015230602482015290516001600160a01b039092169350630952c563925060448082019260009290919082900301818387803b158015613db157600080fd5b505af1158015613dc5573d6000803e3d6000fd5b505050506000821115613e3b5773b31f66aa3c1e785363f0875a1b74e27b85fd66c76001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015613e2157600080fd5b505af1158015613e35573d6000803e3d6000fd5b50505050505b8215613e6857601454601554601654613e669286926001600160a01b039182169290821691166148c4565b505b6000613e85612710610e8660115485612abb90919063ffffffff16565b90508015613eaa57600a54600b54613eaa916001600160a01b03908116911683613115565b6000613ec7612710610e86600f5486612abb90919063ffffffff16565b90508015613ee657600a54613ee6906001600160a01b03163383613115565b6000613f18613ef9836115aa8787613450565b6015546009546017546001600160a01b039283169291821691166148c4565b9050613f238161405f565b7fc7606d21ac05cd309191543e409f0845c016120563783d70e4f41419dc0ef234613f4c6114fc565b6002546040805192835260208301919091528051918290030190a1505050505050565b60008183613fbe5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612d23578181015183820152602001612d0b565b506000838581613fca57fe5b0495945050505050565b600254613fe19082612b5d565b6002556001600160a01b0382166000908152600460205260409020546140079082612b5d565b6001600160a01b03831660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000811161409e5760405162461bcd60e51b8152600401808060200182810382526024815260200180614dca6024913960400191505060405180910390fd5b6013546040805163140e25ad60e31b81526004810184905290516001600160a01b039092169163a0712d68916024808201926020929091908290030181600087803b1580156140ec57600080fd5b505af1158015614100573d6000803e3d6000fd5b505050506040513d602081101561411657600080fd5b50511561416a576040805162461bcd60e51b815260206004820152601f60248201527f42656e7169537472617465677956323a3a4465706f736974206661696c656400604482015290519081900360640190fd5b601354604080516305eff7ef60e21b815230600482015290516000926001600160a01b0316916317bfdfbc91602480830192602092919082900301818787803b1580156141b657600080fd5b505af11580156141ca573d6000803e3d6000fd5b505050506040513d60208110156141e057600080fd5b505160135460408051633af9e66960e01b815230600482015290519293506000926001600160a01b0390921691633af9e6699160248082019260209290919082900301818787803b15801561423457600080fd5b505af1158015614248573d6000803e3d6000fd5b505050506040513d602081101561425e57600080fd5b50519050612ab68183613a49565b601254601354604080517f8e8f294b0000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152815160009485948594911692638e8f294b9260248083019392829003018186803b1580156142d657600080fd5b505afa1580156142ea573d6000803e3d6000fd5b505050506040513d604081101561430057600080fd5b506020015193670de0b6b3a76400009350915050565b6000614345601954610e86601b54610e8061433e88610e86898c612abb90919063ffffffff16565b8a90613450565b95945050505050565b601254604080517f05b9783d00000000000000000000000000000000000000000000000000000000815260ff851660048201526001600160a01b0384811660248301529151600093849316916305b9783d916044808301926020929190829003018186803b1580156143bf57600080fd5b505afa1580156143d3573d6000803e3d6000fd5b505050506040513d60208110156143e957600080fd5b5051601254604080517fd81c5e4500000000000000000000000000000000000000000000000000000000815260ff881660048201526001600160a01b038781166024830152825194955060009493169263d81c5e4592604480840193919291829003018186803b15801561445c57600080fd5b505afa158015614470573d6000803e3d6000fd5b505050506040513d604081101561448657600080fd5b5051601254601354604080517f88e972b800000000000000000000000000000000000000000000000000000000815260ff8a1660048201526001600160a01b0392831660248201528883166044820152905193945060009391909216916388e972b8916064808301926020929190829003018186803b15801561450857600080fd5b505afa15801561451c573d6000803e3d6000fd5b505050506040513d602081101561453257600080fd5b5051905060006001600160e01b0383168210156145585781836001600160e01b03160390505b601354604080516370a0823160e01b81526001600160a01b03898116600483015291516000936145df9386939116916370a0823191602480820192602092909190829003018186803b1580156145ad57600080fd5b505afa1580156145c1573d6000803e3d6000fd5b505050506040513d60208110156145d757600080fd5b505190612abb565b601254604080517f4b3a0a7400000000000000000000000000000000000000000000000000000000815260ff8c1660048201526001600160a01b038b811660248301528251949550600094931692634b3a0a7492604480840193919291829003018186803b15801561465057600080fd5b505afa158015614664573d6000803e3d6000fd5b505050506040513d604081101561467a57600080fd5b5051601254601354604080517f7937969d00000000000000000000000000000000000000000000000000000000815260ff8e1660048201526001600160a01b0392831660248201528c8316604482015290519394506000939190921691637937969d916064808301926020929190829003018186803b1580156146fc57600080fd5b505afa158015614710573d6000803e3d6000fd5b505050506040513d602081101561472657600080fd5b5051905060006001600160e01b03831682101561474c5781836001600160e01b03160390505b601354604080517f95dd91930000000000000000000000000000000000000000000000000000000081526001600160a01b038d8116600483015291516000936147ba9386939116916395dd919391602480820192602092909190829003018186803b1580156145ad57600080fd5b90506147d06147c98683613450565b8a90612b5d565b9c9b505050505050505050505050565b6000806147ed8585614ad4565b509050600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561482c57600080fd5b505afa158015614840573d6000803e3d6000fd5b505050506040513d606081101561485657600080fd5b50805160209091015190925090506001600160a01b038381169088161461487957905b6148a488836dffffffffffffffffffffffffffff16836dffffffffffffffffffffffffffff16614b05565b98975050505050505050565b6000614345846115aa84610e868988612abb565b6000806148d18585614ad4565b509050600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561491057600080fd5b505afa158015614924573d6000803e3d6000fd5b505050506040513d606081101561493a57600080fd5b50805160209091015190925090506001600160a01b038381169088161461495d57905b60008061498b8a856dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff16614b05565b9050886001600160a01b0316856001600160a01b0316146149a857905b6149b389888c614b4d565b60408051600080825260208201928390527f022c0d9f00000000000000000000000000000000000000000000000000000000835260248201858152604483018590523060648401819052608060848501908152845160a486018190526001600160a01b038e169663022c0d9f968a968a9691949193919260c486019290918190849084905b83811015614a50578181015183820152602001614a38565b50505050905090810190601f168015614a7d5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015614a9f57600080fd5b505af1158015614ab3573d6000803e3d6000fd5b50505050818111614ac45781614ac6565b805b9a9950505050505050505050565b600080826001600160a01b0316846001600160a01b031610614af7578284614afa565b83835b915091509250929050565b600080614b14856103e5612abb565b90506000614b228285612abb565b90506000614b3683611aee886103e8612abb565b9050614b428282612b1b565b979650505050505050565b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015614ba457600080fd5b505af1158015614bb8573d6000803e3d6000fd5b505050506040513d6020811015614bce57600080fd5b5051612ab6576040805162461bcd60e51b815260206004820181905260248201527f4465784c6962726172793a3a5452414e534645525f46524f4d5f4641494c4544604482015290519081900360640190fdfe42656e7169537472617465677956323a3a626f72726f77696e67206661696c65644f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735065726d697373696f6e65643a3a6f6e6c79416c6c6f7765644465706f736974732c206e6f7420616c6c6f7765645065726d697373696f6e65643a3a72656d6f76654465706f7369746f722c206e6f20616c6c6f776564206465706f7369746f7273417263683a3a76616c69646174655369673a20696e76616c6964207369676e617475726542656e7169537472617465677956323a3a7061796d656e7473206e6f7420616c6c6f77656442656e7169537472617465677956323a3a7265736375654465706c6f79656446756e64735065726d697373696f6e65643a3a72656d6f76654465706f7369746f722c206e6f7420616c6c6f7765645f6275726e3a206275726e20616d6f756e74206578636565647320746f74616c20737570706c79536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657242656e7169537472617465677956323a3a5f7374616b654465706f736974546f6b656e7342656e7169537472617465677956323a3a5452414e534645525f46524f4d5f4641494c454442656e7169537472617465677956323a3a6661696c656420746f2072656465656d5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f206164647265737342656e7169537472617465677956323a3a6661696c656420746f20726570617920626f72726f777472616e7366657246726f6d3a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655f6275726e3a206275726e20616d6f756e7420657863656564732066726f6d2062616c616e63655f7472616e73666572546f6b656e733a207472616e7366657220657863656564732066726f6d2062616c616e6365a2646970667358221220a6ab07e509c19ec41209d2a54c9ac8c1fbf363fb36a02e7eac042b9061a32de564736f6c63430007030033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.