Contract Overview
Balance:
0 AVAX
AVAX Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0xbb70b415151959cd1069bcc0938987bc76f80f48ea7a1d7517142fb6be207292 | 0x60806040 | 18282882 | 11 days 22 hrs ago | 0x3f68a3c1023d736d8be867ca49cb18c543373b99 | IN | Create: Aave3Vault | 0 AVAX | 0.084104425 |
[ Download CSV Export ]
Contract Name:
Aave3Vault
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "../libs/DataTypes.sol"; import "../libs/Price.sol"; interface IUniRouter { function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity) ; function getAmountsOut(uint amountIn, address[] memory path) external view returns (uint[] memory amounts); } interface IERC20UpgradeableEx is IERC20Upgradeable { function decimals() external view returns (uint8); } interface IAToken is IERC20Upgradeable { function UNDERLYING_ASSET_ADDRESS() external view returns (address); function POOL() external view returns (address); function getIncentivesController() external view returns (address); } interface IPool { function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; function withdraw(address asset, uint256 amount, address to ) external returns (uint256); function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); } interface IRewardsController { /// @dev asset The incentivized asset. It should be address of AToken function getRewardsByAsset(address asset) external view returns (address[] memory); function getRewardsData(address asset, address reward) external view returns ( uint256 index, uint256 emissionPerSecond, uint256 lastUpdateTimestamp, uint256 distributionEnd ); function getAllUserRewards(address[] calldata assets, address user) external view returns (address[] memory, uint256[] memory); function getUserRewards(address[] calldata assets, address user, address reward) external view returns (uint256); function claimAllRewards(address[] calldata assets, address to) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); function claimAllRewardsToSelf(address[] calldata assets) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); } contract Aave3Vault is Initializable, ERC20Upgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable{ using SafeERC20Upgradeable for IERC20Upgradeable; IERC20Upgradeable public constant WAVAX = IERC20Upgradeable(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7); IUniRouter public constant JoeRouter = IUniRouter(0x60aE616a2155Ee3d9A68541Ba4544862310933d4); uint constant DENOMINATOR = 10000; uint public yieldFee; IAToken public aToken; IERC20Upgradeable public token; uint8 private tokenDecimals; IPool public aPool; IRewardsController public aRewardsController; address public treasuryWallet; address public admin; mapping(address => uint) private depositedBlock; uint constant DAY_IN_SEC = 86400; // 3600 * 24 uint constant YEAR_IN_SEC = 365 * DAY_IN_SEC; event Deposit(address _user, uint _amount, uint _shares); event EmergencyWithdraw(uint _amount); event Invest(uint _amount); event SetAdmin(address _oldAdmin, address _newAdmin); event SetYieldFeePerc(uint _fee); event SetTreasuryWallet(address _wallet); event Withdraw(address _user, uint _amount, uint _shares); event YieldFee(uint _amount); event Yield(uint _amount); modifier onlyOwnerOrAdmin { require(msg.sender == owner() || msg.sender == admin, "Only owner or admin"); _; } function initialize(string memory _name, string memory _symbol, IAToken _aToken, address _treasury, address _admin ) external initializer { __ERC20_init(_name, _symbol); __Ownable_init(); yieldFee = 2000; //20% aToken = _aToken; token = IERC20Upgradeable(aToken.UNDERLYING_ASSET_ADDRESS()); tokenDecimals = IERC20UpgradeableEx(address(token)).decimals(); aPool = IPool(aToken.POOL()); aRewardsController = IRewardsController(aToken.getIncentivesController()); treasuryWallet = _treasury; admin = _admin; token.approve(address(aPool), type(uint).max); aToken.approve(address(aPool), type(uint).max); WAVAX.approve(address(JoeRouter), type(uint).max); } /** *@param _amount amount of lptokens to deposit */ function deposit(uint _amount) external nonReentrant whenNotPaused{ require(_amount > 0, "Invalid amount"); uint _pool = getAllPool(); token.safeTransferFrom(msg.sender, address(this), _amount); depositedBlock[msg.sender] = block.number; aPool.supply(address(token), token.balanceOf(address(this)), address(this), 0); uint _totalSupply = totalSupply(); uint _shares = (_pool == 0 || _totalSupply == 0) ? _amount : _amount * _totalSupply / _pool; _mint(msg.sender, _shares); emit Deposit(msg.sender, _amount, _shares); } /** *@param _shares amount of shares to burn */ function withdraw(uint _shares) external nonReentrant{ require(_shares > 0, "Invalid Amount"); require(balanceOf(msg.sender) >= _shares, "Not enough balance"); require(depositedBlock[msg.sender] != block.number, "Withdraw within same block"); uint _amountToWithdraw = getAllPool() * _shares / totalSupply(); uint available = token.balanceOf(address(this)); if(available < _amountToWithdraw) { aPool.withdraw(address(token), _amountToWithdraw - available, address(this)); } _burn(msg.sender, _shares); token.safeTransfer(msg.sender, _amountToWithdraw); emit Withdraw(msg.sender, _amountToWithdraw, _shares); } function _invest() private returns (uint available){ available = token.balanceOf(address(this)); if(available > 0) { aPool.supply(address(token), available, address(this), 0); } } ///@notice Withdraws funds staked in mirror to this vault and pauses deposit, yield, invest functions function emergencyWithdraw() external onlyOwnerOrAdmin whenNotPaused{ _pause(); _yield(); uint stakedTokens = aToken.balanceOf(address(this)); if(stakedTokens > 0 ) { aPool.withdraw(address(token), stakedTokens, address(this)); } emit EmergencyWithdraw(stakedTokens); } ///@notice Unpauses deposit, yield, invest functions, and invests funds. function reinvest() external onlyOwnerOrAdmin whenPaused { _unpause(); _invest(); } function setAdmin(address _newAdmin) external onlyOwner{ address oldAdmin = admin; admin = _newAdmin; emit SetAdmin(oldAdmin, _newAdmin); } ///@notice Function to set deposit and yield fee ///@param _yieldFeePerc deposit fee percentage. 2000 for 20% function setFee(uint _yieldFeePerc) external onlyOwner{ require(_yieldFeePerc < 3001, "Yield Fee cannot > 30%"); yieldFee = _yieldFeePerc; emit SetYieldFeePerc(_yieldFeePerc); } function setTreasuryWallet(address _wallet) external onlyOwner { require(_wallet != address(0), "wallet invalid"); treasuryWallet = _wallet; emit SetTreasuryWallet(_wallet); } function yield() external onlyOwnerOrAdmin whenNotPaused { _yield(); } function _yield() private { address[] memory assets = new address[](1); assets[0] = address(aToken); (address[] memory rewards, uint[] memory amounts) = aRewardsController.claimAllRewardsToSelf(assets); uint rewardsCount = rewards.length; for (uint i = 0; i < rewardsCount; i ++) { address reward = rewards[i]; uint amount = amounts[i]; if (0 < amount && reward != address(WAVAX)) { IERC20Upgradeable(reward).safeTransfer(treasuryWallet, amount); } } uint AVAXAmt = WAVAX.balanceOf(address(this)); if(AVAXAmt > 0) { uint fee = AVAXAmt * yieldFee / DENOMINATOR; //yield fee WAVAX.safeTransfer(treasuryWallet, fee); AVAXAmt -= fee; if (token != WAVAX) { _swap(address(WAVAX), address(token), AVAXAmt); } _invest(); uint AVAXPriceInUSD = PriceLib.getAssetPrice(address(WAVAX)); emit Yield((AVAXAmt + fee) * AVAXPriceInUSD / 1e8); emit YieldFee(fee * AVAXPriceInUSD / 1e8); } } function _swap(address _tokenA, address _tokenB, uint _amt) private returns (uint[] memory amounts){ address[] memory path = new address[](2); path[0] = address(_tokenA); path[1] = address(_tokenB); amounts = JoeRouter.swapExactTokensForTokens(_amt, 0, path, address(this), block.timestamp); } function getAllPool() public view returns (uint ) { return token.balanceOf(address(this)) + aToken.balanceOf(address(this)); } function getAllPoolInUSD() public view returns (uint) { uint priceInUSD = PriceLib.getAssetPrice(address(token)); uint _pool = getAllPool(); if (tokenDecimals < 18) { _pool = _pool * (10 ** (18-tokenDecimals)); } return _pool * priceInUSD / 1e8; } function getPricePerFullShare(bool inUSD) external view returns (uint) { uint _totalSupply = totalSupply(); if (_totalSupply == 0) return 1e18; return inUSD == true ? getAllPoolInUSD() * 1e18 / _totalSupply : getAllPool() * 1e18 / _totalSupply; } ///@notice Returns the pending rewards in USD. function getPendingRewards() public view returns (uint) { address[] memory assets = new address[](1); assets[0] = address(aToken); (address[] memory rewards, uint[] memory amounts) = aRewardsController.getAllUserRewards(assets, address(this)); uint rewardsCount = rewards.length; uint pending; for (uint i = 0; i < rewardsCount; i ++) { address reward = rewards[i]; uint priceInUSD = PriceLib.getAssetPrice(address(reward)); uint numeratorDecimals = 18; // USD precision uint denominatorDecimals = IERC20UpgradeableEx(address(reward)).decimals() // against to amounts + 8; // against to priceInUSD uint _pending = (numeratorDecimals < denominatorDecimals) ? amounts[i] * priceInUSD / (10 ** (denominatorDecimals-numeratorDecimals)) : amounts[i] * priceInUSD * (10 ** (numeratorDecimals-denominatorDecimals)); pending += _pending; } return pending; } function getAPR() external view returns (uint) { DataTypes.ReserveData memory reserveData = aPool.getReserveData(address(token)); uint liquidityApr = reserveData.currentLiquidityRate / 1e9; // currentLiquidityRate is expressed in ray, 1e27 address[] memory rewards = aRewardsController.getRewardsByAsset(address(aToken)); uint rewardsCount = rewards.length; uint _totalSupply = aToken.totalSupply(); uint TokenPriceInUSD = PriceLib.getAssetPrice(address(token)); uint rewardsApr; for (uint i = 0; i < rewardsCount; i ++) { address reward = rewards[i]; (, uint emissionPerSecond,,) = aRewardsController.getRewardsData(address(aToken), reward); uint priceInUSD = PriceLib.getAssetPrice(address(reward)); uint numeratorDecimals = 18 // APR precision + tokenDecimals; // against to totalSupply uint denominatorDecimals = IERC20UpgradeableEx(address(reward)).decimals(); // against to emissionPerSecond uint rewardApr = YEAR_IN_SEC * emissionPerSecond * priceInUSD * (10 ** (numeratorDecimals-denominatorDecimals)) / (_totalSupply * TokenPriceInUSD); rewardsApr += rewardApr; } return liquidityApr + (rewardsApr * (DENOMINATOR-yieldFee) / DENOMINATOR); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
//SPDX-License-Identifier: MIT pragma solidity 0.8.9; library DataTypes { struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //the current supply rate. Expressed in ray uint128 currentLiquidityRate; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current variable borrow rate. Expressed in ray uint128 currentVariableBorrowRate; //the current stable borrow rate. Expressed in ray uint128 currentStableBorrowRate; //timestamp of last update uint40 lastUpdateTimestamp; //the id of the reserve. Represents the position in the list of the active reserves uint16 id; //aToken address address aTokenAddress; //stableDebtToken address address stableDebtTokenAddress; //variableDebtToken address address variableDebtTokenAddress; //address of the interest rate strategy address interestRateStrategyAddress; //the current treasury balance, scaled uint128 accruedToTreasury; //the outstanding unbacked aTokens minted through the bridging feature uint128 unbacked; //the outstanding debt borrowed against this asset in isolation mode uint128 isolationModeTotalDebt; } struct ReserveConfigurationMap { //bit 0-15: LTV //bit 16-31: Liq. threshold //bit 32-47: Liq. bonus //bit 48-55: Decimals //bit 56: reserve is active //bit 57: reserve is frozen //bit 58: borrowing is enabled //bit 59: stable rate borrowing enabled //bit 60: asset is paused //bit 61: borrowing in isolation mode is enabled //bit 62-63: reserved //bit 64-79: reserve factor //bit 80-115 borrow cap in whole tokens, borrowCap == 0 => no cap //bit 116-151 supply cap in whole tokens, supplyCap == 0 => no cap //bit 152-167 liquidation protocol fee //bit 168-175 eMode category //bit 176-211 unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled //bit 212-251 debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals //bit 252-255 unused uint256 data; } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IChainlink { function latestAnswer() external view returns (int256); } interface IAaveOracle { function getAssetPrice(address asset) external view returns (uint256); } library PriceLib { IAaveOracle internal constant AaveOracle = IAaveOracle(0xEBd36016B3eD09D4693Ed4251c67Bd858c3c7C9C); address internal constant USDT = 0xc7198437980c041c805A1EDcbA50c1Ce5db95118; /// @return the price in USD of 8 decimals in precision. function getAssetPrice(address asset) internal view returns (uint) { if (asset == USDT) { return uint(IChainlink(0xEBE676ee90Fe1112671f19b6B7459bC678B67e8a).latestAnswer()); } return AaveOracle.getAssetPrice(asset); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"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":false,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Invest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"_newAdmin","type":"address"}],"name":"SetAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_wallet","type":"address"}],"name":"SetTreasuryWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"SetYieldFeePerc","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":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Yield","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"YieldFee","type":"event"},{"inputs":[],"name":"JoeRouter","outputs":[{"internalType":"contract IUniRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WAVAX","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aPool","outputs":[{"internalType":"contract IPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aRewardsController","outputs":[{"internalType":"contract IRewardsController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aToken","outputs":[{"internalType":"contract IAToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAPR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllPoolInUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"inUSD","type":"bool"}],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"contract IAToken","name":"_aToken","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reinvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAdmin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_yieldFeePerc","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"setTreasuryWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"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":[],"name":"treasuryWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yield","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yieldFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50613be4806100206000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c806395d89b4111610130578063c89d5b8b116100b8578063e595cbb61161007c578063e595cbb614610495578063f2fde38b146104a8578063f851a440146104bb578063fc0c546a146104cf578063fdb5a03e146104e257600080fd5b8063c89d5b8b14610457578063d9621f9e1461045f578063db0ed6a014610467578063db2e21bc1461047a578063dd62ed3e1461048257600080fd5b8063a8602fea116100ff578063a8602fea146103fb578063a9059cbb1461040e578063b6b55f2514610421578063bd244af414610434578063c12f857f1461043c57600080fd5b806395d89b41146103c5578063a0c1f15e146103cd578063a20a4cb4146103e0578063a457c2d7146103e857600080fd5b8063313ce567116101be578063704b6c0211610182578063704b6c021461035557806370a0823114610368578063715018a61461039157806373b295c2146103995780638da5cb5b146103b457600080fd5b8063313ce5671461030157806339509351146103105780634626402b146103235780635c975abb1461033757806369fe0e2d1461034257600080fd5b806318160ddd1161020557806318160ddd146102b657806320f14908146102be57806323b872dd146102d157806328593984146102e45780632e1a7d4d146102ee57600080fd5b8063034f40831461023757806306fdde0314610253578063095ea7b31461026857806314085ff01461028b575b600080fd5b61024060fb5481565b6040519081526020015b60405180910390f35b61025b6104ea565b60405161024a9190613108565b61027b610276366004613150565b61057c565b604051901515815260200161024a565b60ff5461029e906001600160a01b031681565b6040516001600160a01b03909116815260200161024a565b603554610240565b6102406102cc36600461318a565b610596565b61027b6102df3660046131a7565b610619565b6102ec61063d565b005b6102ec6102fc3660046131e8565b610698565b6040516012815260200161024a565b61027b61031e366004613150565b6109aa565b6101005461029e906001600160a01b031681565b60975460ff1661027b565b6102ec6103503660046131e8565b6109cc565b6102ec610363366004613201565b610a5a565b610240610376366004613201565b6001600160a01b031660009081526033602052604090205490565b6102ec610ac4565b61029e73b31f66aa3c1e785363f0875a1b74e27b85fd66c781565b6065546001600160a01b031661029e565b61025b610ad6565b60fc5461029e906001600160a01b031681565b610240610ae5565b61027b6103f6366004613150565b610beb565b6102ec610409366004613201565b610c66565b61027b61041c366004613150565b610d04565b6102ec61042f3660046131e8565b610d12565b610240610f71565b61029e7360ae616a2155ee3d9a68541ba4544862310933d481565b610240611000565b6102406113ff565b6102ec6104753660046132ff565b611668565b6102ec611bbf565b61024061049036600461339d565b611d5b565b60fe5461029e906001600160a01b031681565b6102ec6104b6366004613201565b611d86565b6101015461029e906001600160a01b031681565b60fd5461029e906001600160a01b031681565b6102ec611dff565b6060603680546104f9906133d6565b80601f0160208091040260200160405190810160405280929190818152602001828054610525906133d6565b80156105725780601f1061054757610100808354040283529160200191610572565b820191906000526020600020905b81548152906001019060200180831161055557829003601f168201915b5050505050905090565b60003361058a818585611e57565b60019150505b92915050565b6000806105a260355490565b9050806105b95750670de0b6b3a764000092915050565b6001831515146105ed57806105cc610ae5565b6105de90670de0b6b3a7640000613427565b6105e8919061345c565b610612565b806105f6610f71565b61060890670de0b6b3a7640000613427565b610612919061345c565b9392505050565b600033610627858285611f7c565b610632858585611ff6565b506001949350505050565b6065546001600160a01b03163314806106615750610101546001600160a01b031633145b6106865760405162461bcd60e51b815260040161067d90613470565b60405180910390fd5b61068e6121c4565b61069661220a565b565b600260c95414156106eb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b600260c9558061072e5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908105b5bdd5b9d60921b604482015260640161067d565b336000908152603360205260409020548111156107825760405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015260640161067d565b33600090815261010260205260409020544314156107e25760405162461bcd60e51b815260206004820152601a60248201527f57697468647261772077697468696e2073616d6520626c6f636b000000000000604482015260640161067d565b60006107ed60355490565b826107f6610ae5565b6108009190613427565b61080a919061345c565b60fd546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b15801561085357600080fd5b505afa158015610867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088b919061349d565b90508181101561093e5760fe5460fd546001600160a01b03918216916369328dec91166108b884866134b6565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152306044820152606401602060405180830381600087803b15801561090457600080fd5b505af1158015610918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093c919061349d565b505b61094833846125a4565b60fd5461095f906001600160a01b031633846126ef565b60408051338152602081018490529081018490527ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689060600160405180910390a15050600160c95550565b60003361058a8185856109bd8383611d5b565b6109c791906134cd565b611e57565b6109d4612752565b610bb98110610a1e5760405162461bcd60e51b81526020600482015260166024820152755969656c64204665652063616e6e6f74203e2033302560501b604482015260640161067d565b60fb8190556040518181527f5cdc47cbc2be1e35e5429dd646b1e2047ab328f4108873ab71318989f7566ceb906020015b60405180910390a150565b610a62612752565b61010180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f848ac24ab84501710d6631faab117b66b79aba7ec6f7778cf3bcff428c1a4efc910160405180910390a15050565b610acc612752565b61069660006127ac565b6060603780546104f9906133d6565b60fc546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610b2957600080fd5b505afa158015610b3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b61919061349d565b60fd546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015610ba457600080fd5b505afa158015610bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdc919061349d565b610be691906134cd565b905090565b60003381610bf98286611d5b565b905083811015610c595760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161067d565b6106328286868403611e57565b610c6e612752565b6001600160a01b038116610cb55760405162461bcd60e51b815260206004820152600e60248201526d1dd85b1b195d081a5b9d985b1a5960921b604482015260640161067d565b61010080546001600160a01b0319166001600160a01b0383169081179091556040519081527f60edc991b058a7e279075cf86f19a6b478334efec47e089d09890b139c78232790602001610a4f565b60003361058a818585611ff6565b600260c9541415610d655760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161067d565b600260c955610d726121c4565b60008111610db35760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b604482015260640161067d565b6000610dbd610ae5565b60fd54909150610dd8906001600160a01b03163330856127fe565b33600090815261010260205260409081902043905560fe5460fd5491516370a0823160e01b81523060048201526001600160a01b039182169263617ba03792169081906370a082319060240160206040518083038186803b158015610e3c57600080fd5b505afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e74919061349d565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015230604482015260006064820152608401600060405180830381600087803b158015610ec757600080fd5b505af1158015610edb573d6000803e3d6000fd5b505050506000610eea60355490565b90506000821580610ef9575081155b610f175782610f088386613427565b610f12919061345c565b610f19565b835b9050610f253382612836565b60408051338152602081018690529081018290527f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060600160405180910390a15050600160c9555050565b60fd546000908190610f8b906001600160a01b0316612916565b90506000610f97610ae5565b60fd549091506012600160a01b90910460ff161015610fe05760fd54610fc890600160a01b900460ff1660126134e5565b610fd390600a6135ec565b610fdd9082613427565b90505b6305f5e100610fef8383613427565b610ff9919061345c565b9250505090565b60fe5460fd546040516335ea6a7560e01b81526001600160a01b039182166004820152600092839216906335ea6a75906024016101e06040518083038186803b15801561104c57600080fd5b505afa158015611060573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611084919061368b565b90506000633b9aca00826040015161109c91906137ae565b60ff5460fc54604051636657732f60e01b81526001600160a01b0391821660048201526001600160801b03939093169350600092911690636657732f9060240160006040518083038186803b1580156110f457600080fd5b505afa158015611108573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611130919081019061386c565b9050600081519050600060fc60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118857600080fd5b505afa15801561119c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c0919061349d565b60fd549091506000906111db906001600160a01b0316612916565b90506000805b848110156113c15760008682815181106111fd576111fd6138a1565b602090810291909101015160ff5460fc54604051630fdfe97560e31b81526001600160a01b0391821660048201528184166024820152929350600092911690637eff4ba89060440160806040518083038186803b15801561125d57600080fd5b505afa158015611271573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129591906138b7565b505091505060006112a583612916565b60fd549091506000906112c390600160a01b900460ff1660126138ed565b60ff1690506000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561130357600080fd5b505afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b9190613912565b60ff169050600061134c898b613427565b61135683856134b6565b61136190600a613935565b85876113726201518061016d613427565b61137c9190613427565b6113869190613427565b6113909190613427565b61139a919061345c565b90506113a681896134cd565b975050505050505080806113b990613941565b9150506111e1565b5061271060fb546127106113d591906134b6565b6113df9083613427565b6113e9919061345c565b6113f390876134cd565b97505050505050505090565b60408051600180825281830190925260009182919060208083019080368337505060fc5482519293506001600160a01b031691839150600090611444576114446138a1565b6001600160a01b03928316602091820292909201015260ff54604051634c0369c360e01b815260009283921690634c0369c39061148790869030906004016139a0565b60006040518083038186803b15801561149f57600080fd5b505afa1580156114b3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526114db9190810190613a25565b815191935091506000805b8281101561165e576000858281518110611502576115026138a1565b60200260200101519050600061151782612916565b90506000601290506000836001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561155a57600080fd5b505afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115929190613912565b61159d9060086138ed565b60ff16905060008183106115f4576115b582846134b6565b6115c090600a613935565b848a88815181106115d3576115d36138a1565b60200260200101516115e59190613427565b6115ef9190613427565b611638565b6115fe83836134b6565b61160990600a613935565b848a888151811061161c5761161c6138a1565b602002602001015161162e9190613427565b611638919061345c565b905061164481886134cd565b96505050505050808061165690613941565b9150506114e6565b5095945050505050565b600054610100900460ff16158080156116885750600054600160ff909116105b806116a25750303b1580156116a2575060005460ff166001145b6117055760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161067d565b6000805460ff191660011790558015611728576000805461ff0019166101001790555b6117328686612a15565b61173a612a46565b6107d060fb5560fc80546001600160a01b0319166001600160a01b038616908117909155604080516358b50cef60e11b8152905163b16a19de91600480820192602092909190829003018186803b15801561179457600080fd5b505afa1580156117a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cc9190613a89565b60fd80546001600160a01b0319166001600160a01b039290921691821790556040805163313ce56760e01b8152905163313ce56791600480820192602092909190829003018186803b15801561182157600080fd5b505afa158015611835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118599190613912565b60fd60146101000a81548160ff021916908360ff16021790555060fc60009054906101000a90046001600160a01b03166001600160a01b0316637535d2466040518163ffffffff1660e01b815260040160206040518083038186803b1580156118c157600080fd5b505afa1580156118d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f99190613a89565b60fe80546001600160a01b0319166001600160a01b0392831617905560fc54604080516375d2641360e01b8152905191909216916375d26413916004808301926020929190829003018186803b15801561195257600080fd5b505afa158015611966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198a9190613a89565b60ff80546001600160a01b03199081166001600160a01b039384161790915561010080548216868416179055610101805490911684831617905560fd5460fe5460405163095ea7b360e01b81529083166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015611a0d57600080fd5b505af1158015611a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a459190613aa6565b5060fc5460fe5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015611a9757600080fd5b505af1158015611aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611acf9190613aa6565b5060405163095ea7b360e01b81527360ae616a2155ee3d9a68541ba4544862310933d46004820152600019602482015273b31f66aa3c1e785363f0875a1b74e27b85fd66c79063095ea7b390604401602060405180830381600087803b158015611b3857600080fd5b505af1158015611b4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b709190613aa6565b508015611bb7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6065546001600160a01b0316331480611be35750610101546001600160a01b031633145b611bff5760405162461bcd60e51b815260040161067d90613470565b611c076121c4565b611c0f612a75565b611c1761220a565b60fc546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015611c5b57600080fd5b505afa158015611c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c93919061349d565b90508015611d2b5760fe5460fd54604051631a4ca37b60e21b81526001600160a01b039182166004820152602481018490523060448201529116906369328dec90606401602060405180830381600087803b158015611cf157600080fd5b505af1158015611d05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d29919061349d565b505b6040518181527f99d7f8b71cfb9126984f7a5eed3a40e64a8959e9b0e442221546fb04ec6a489c90602001610a4f565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b611d8e612752565b6001600160a01b038116611df35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161067d565b611dfc816127ac565b50565b6065546001600160a01b0316331480611e235750610101546001600160a01b031633145b611e3f5760405162461bcd60e51b815260040161067d90613470565b611e47612acf565b611e4f612b18565b611dfc612b51565b6001600160a01b038316611eb95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161067d565b6001600160a01b038216611f1a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161067d565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000611f888484611d5b565b90506000198114611ff05781811015611fe35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161067d565b611ff08484848403611e57565b50505050565b6001600160a01b03831661205a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161067d565b6001600160a01b0382166120bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161067d565b6001600160a01b038316600090815260336020526040902054818110156121345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161067d565b6001600160a01b0380851660009081526033602052604080822085850390559185168152908120805484929061216b9084906134cd565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516121b791815260200190565b60405180910390a3611ff0565b60975460ff16156106965760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161067d565b60408051600180825281830190925260009160208083019080368337505060fc5482519293506001600160a01b03169183915060009061224c5761224c6138a1565b6001600160a01b03928316602091820292909201015260ff54604051635fc87b1d60e11b81526000928392169063bf90f63a9061228d908690600401613ac3565b600060405180830381600087803b1580156122a757600080fd5b505af11580156122bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122e39190810190613a25565b8151919350915060005b81811015612393576000848281518110612309576123096138a1565b602002602001015190506000848381518110612327576123276138a1565b6020026020010151905080600010801561235e57506001600160a01b03821673b31f66aa3c1e785363f0875a1b74e27b85fd66c714155b1561237e576101005461237e906001600160a01b038481169116836126ef565b5050808061238b90613941565b9150506122ed565b506040516370a0823160e01b815230600482015260009073b31f66aa3c1e785363f0875a1b74e27b85fd66c7906370a082319060240160206040518083038186803b1580156123e157600080fd5b505afa1580156123f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612419919061349d565b9050801561259d57600061271060fb54836124349190613427565b61243e919061345c565b6101005490915061246e9073b31f66aa3c1e785363f0875a1b74e27b85fd66c7906001600160a01b0316836126ef565b61247881836134b6565b60fd549092506001600160a01b031673b31f66aa3c1e785363f0875a1b74e27b85fd66c7146124cf5760fd546124cd9073b31f66aa3c1e785363f0875a1b74e27b85fd66c7906001600160a01b031684612c4e565b505b6124d7612b51565b5060006124f773b31f66aa3c1e785363f0875a1b74e27b85fd66c7612916565b90507f913f67bfd2c6ac4a84007665147ed6861715996d03ed38d610c52e28c08838036305f5e1008261252a85876134cd565b6125349190613427565b61253e919061345c565b60405190815260200160405180910390a17f6d415483528749d9b4bfa85837aeca6271d845839c39bfa4614240e15dabeb1e6305f5e10061257f8385613427565b612589919061345c565b60405190815260200160405180910390a150505b5050505050565b6001600160a01b0382166126045760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161067d565b6001600160a01b038216600090815260336020526040902054818110156126785760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161067d565b6001600160a01b03831660009081526033602052604081208383039055603580548492906126a79084906134b6565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001611f6f565b505050565b6040516001600160a01b0383166024820152604481018290526126ea90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d72565b6065546001600160a01b031633146106965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161067d565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052611ff09085906323b872dd60e01b9060840161271b565b6001600160a01b03821661288c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161067d565b806035600082825461289e91906134cd565b90915550506001600160a01b038216600090815260336020526040812080548392906128cb9084906134cd565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35b5050565b60006001600160a01b03821673c7198437980c041c805a1edcba50c1ce5db9511814156129c25773ebe676ee90fe1112671f19b6b7459bc678b67e8a6001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561298a57600080fd5b505afa15801561299e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610590919061349d565b60405163b3596f0760e01b81526001600160a01b038316600482015273ebd36016b3ed09d4693ed4251c67bd858c3c7c9c9063b3596f079060240160206040518083038186803b15801561298a57600080fd5b600054610100900460ff16612a3c5760405162461bcd60e51b815260040161067d90613ad6565b6129128282612e44565b600054610100900460ff16612a6d5760405162461bcd60e51b815260040161067d90613ad6565b610696612e92565b612a7d6121c4565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612ab23390565b6040516001600160a01b03909116815260200160405180910390a1565b60975460ff166106965760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161067d565b612b20612acf565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612ab2565b60fd546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015612b9557600080fd5b505afa158015612ba9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bcd919061349d565b90508015612c4b5760fe5460fd5460405163617ba03760e01b81526001600160a01b039182166004820152602481018490523060448201526000606482015291169063617ba03790608401600060405180830381600087803b158015612c3257600080fd5b505af1158015612c46573d6000803e3d6000fd5b505050505b90565b604080516002808252606080830184529260009291906020830190803683370190505090508481600081518110612c8757612c876138a1565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600181518110612cbb57612cbb6138a1565b6001600160a01b03909216602092830291909101909101526040516338ed173960e01b81527360ae616a2155ee3d9a68541ba4544862310933d4906338ed173990612d13908690600090869030904290600401613b21565b600060405180830381600087803b158015612d2d57600080fd5b505af1158015612d41573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612d699190810190613b5d565b95945050505050565b6000612dc7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ec29092919063ffffffff16565b8051909150156126ea5780806020019051810190612de59190613aa6565b6126ea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161067d565b600054610100900460ff16612e6b5760405162461bcd60e51b815260040161067d90613ad6565b8151612e7e906036906020850190613043565b5080516126ea906037906020840190613043565b600054610100900460ff16612eb95760405162461bcd60e51b815260040161067d90613ad6565b610696336127ac565b6060612ed18484600085612ed9565b949350505050565b606082471015612f3a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161067d565b6001600160a01b0385163b612f915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161067d565b600080866001600160a01b03168587604051612fad9190613b92565b60006040518083038185875af1925050503d8060008114612fea576040519150601f19603f3d011682016040523d82523d6000602084013e612fef565b606091505b5091509150612fff82828661300a565b979650505050505050565b60608315613019575081610612565b8251156130295782518084602001fd5b8160405162461bcd60e51b815260040161067d9190613108565b82805461304f906133d6565b90600052602060002090601f01602090048101928261307157600085556130b7565b82601f1061308a57805160ff19168380011785556130b7565b828001600101855582156130b7579182015b828111156130b757825182559160200191906001019061309c565b506130c39291506130c7565b5090565b5b808211156130c357600081556001016130c8565b60005b838110156130f75781810151838201526020016130df565b83811115611ff05750506000910152565b60208152600082518060208401526131278160408501602087016130dc565b601f01601f19169190910160400192915050565b6001600160a01b0381168114611dfc57600080fd5b6000806040838503121561316357600080fd5b823561316e8161313b565b946020939093013593505050565b8015158114611dfc57600080fd5b60006020828403121561319c57600080fd5b81356106128161317c565b6000806000606084860312156131bc57600080fd5b83356131c78161313b565b925060208401356131d78161313b565b929592945050506040919091013590565b6000602082840312156131fa57600080fd5b5035919050565b60006020828403121561321357600080fd5b81356106128161313b565b634e487b7160e01b600052604160045260246000fd5b6040516101e0810167ffffffffffffffff811182821017156132585761325861321e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156132875761328761321e565b604052919050565b600082601f8301126132a057600080fd5b813567ffffffffffffffff8111156132ba576132ba61321e565b6132cd601f8201601f191660200161325e565b8181528460208386010111156132e257600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561331757600080fd5b853567ffffffffffffffff8082111561332f57600080fd5b61333b89838a0161328f565b9650602088013591508082111561335157600080fd5b5061335e8882890161328f565b945050604086013561336f8161313b565b9250606086013561337f8161313b565b9150608086013561338f8161313b565b809150509295509295909350565b600080604083850312156133b057600080fd5b82356133bb8161313b565b915060208301356133cb8161313b565b809150509250929050565b600181811c908216806133ea57607f821691505b6020821081141561340b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561344157613441613411565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261346b5761346b613446565b500490565b60208082526013908201527227b7363c9037bbb732b91037b91030b236b4b760691b604082015260600190565b6000602082840312156134af57600080fd5b5051919050565b6000828210156134c8576134c8613411565b500390565b600082198211156134e0576134e0613411565b500190565b600060ff821660ff8416808210156134ff576134ff613411565b90039392505050565b600181815b8085111561354357816000190482111561352957613529613411565b8085161561353657918102915b93841c939080029061350d565b509250929050565b60008261355a57506001610590565b8161356757506000610590565b816001811461357d5760028114613587576135a3565b6001915050610590565b60ff84111561359857613598613411565b50506001821b610590565b5060208310610133831016604e8410600b84101617156135c6575081810a610590565b6135d08383613508565b80600019048211156135e4576135e4613411565b029392505050565b600061061260ff84168361354b565b60006020828403121561360d57600080fd5b6040516020810181811067ffffffffffffffff821117156136305761363061321e565b6040529151825250919050565b80516001600160801b038116811461365457600080fd5b919050565b805164ffffffffff8116811461365457600080fd5b805161ffff8116811461365457600080fd5b80516136548161313b565b60006101e0828403121561369e57600080fd5b6136a6613234565b6136b084846135fb565b81526136be6020840161363d565b60208201526136cf6040840161363d565b60408201526136e06060840161363d565b60608201526136f16080840161363d565b608082015261370260a0840161363d565b60a082015261371360c08401613659565b60c082015261372460e0840161366e565b60e0820152610100613737818501613680565b90820152610120613749848201613680565b9082015261014061375b848201613680565b9082015261016061376d848201613680565b9082015261018061377f84820161363d565b908201526101a061379184820161363d565b908201526101c06137a384820161363d565b908201529392505050565b60006001600160801b03808416806137c8576137c8613446565b92169190910492915050565b600067ffffffffffffffff8211156137ee576137ee61321e565b5060051b60200190565b600082601f83011261380957600080fd5b8151602061381e613819836137d4565b61325e565b82815260059290921b8401810191818101908684111561383d57600080fd5b8286015b848110156138615780516138548161313b565b8352918301918301613841565b509695505050505050565b60006020828403121561387e57600080fd5b815167ffffffffffffffff81111561389557600080fd5b612ed1848285016137f8565b634e487b7160e01b600052603260045260246000fd5b600080600080608085870312156138cd57600080fd5b505082516020840151604085015160609095015191969095509092509050565b600060ff821660ff84168060ff0382111561390a5761390a613411565b019392505050565b60006020828403121561392457600080fd5b815160ff8116811461061257600080fd5b6000610612838361354b565b600060001982141561395557613955613411565b5060010190565b600081518084526020808501945080840160005b838110156139955781516001600160a01b031687529582019590820190600101613970565b509495945050505050565b6040815260006139b3604083018561395c565b905060018060a01b03831660208301529392505050565b600082601f8301126139db57600080fd5b815160206139eb613819836137d4565b82815260059290921b84018101918181019086841115613a0a57600080fd5b8286015b848110156138615780518352918301918301613a0e565b60008060408385031215613a3857600080fd5b825167ffffffffffffffff80821115613a5057600080fd5b613a5c868387016137f8565b93506020850151915080821115613a7257600080fd5b50613a7f858286016139ca565b9150509250929050565b600060208284031215613a9b57600080fd5b81516106128161313b565b600060208284031215613ab857600080fd5b81516106128161317c565b602081526000610612602083018461395c565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b85815284602082015260a060408201526000613b4060a083018661395c565b6001600160a01b0394909416606083015250608001529392505050565b600060208284031215613b6f57600080fd5b815167ffffffffffffffff811115613b8657600080fd5b612ed1848285016139ca565b60008251613ba48184602087016130dc565b919091019291505056fea26469706673582212207e082bc1a3d6435793b385f3f55dbbe04634a5ad7cd53a7963ed2b61d7cc27a764736f6c63430008090033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.