Latest 25 from a total of 203,648 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw ETH | 28098812 | 49 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ETH | 28098565 | 49 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ERC20 | 28098387 | 49 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ETH | 28098224 | 49 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ERC20 | 25716686 | 104 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ERC20 | 25715819 | 104 days ago | IN | 0 ETH | 0.00000031 | ||||
| Withdraw ERC20 | 25713708 | 104 days ago | IN | 0 ETH | 0.00000024 | ||||
| Withdraw ERC20 | 25713341 | 104 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ERC20 | 25713128 | 104 days ago | IN | 0 ETH | 0.00000007 | ||||
| Withdraw ERC20 | 24602351 | 130 days ago | IN | 0 ETH | 0 | ||||
| Repay ETH | 24558590 | 131 days ago | IN | 0.000001 ETH | 0.00000006 | ||||
| Withdraw ERC20 | 24434415 | 134 days ago | IN | 0 ETH | 0 | ||||
| Supply ERC20 | 24434391 | 134 days ago | IN | 0 ETH | 0 | ||||
| Withdraw ERC20 | 24315870 | 137 days ago | IN | 0 ETH | 0.00000046 | ||||
| Deposit ETH | 24315855 | 137 days ago | IN | 0.000001 ETH | 0.00000033 | ||||
| Withdraw ERC20 | 24315175 | 137 days ago | IN | 0 ETH | 0.00000046 | ||||
| Supply ERC20 | 24315158 | 137 days ago | IN | 0 ETH | 0.00000034 | ||||
| Withdraw ERC20 | 24299108 | 137 days ago | IN | 0 ETH | 0 | ||||
| Deposit ETH | 24299055 | 137 days ago | IN | 0.000001 ETH | 0 | ||||
| Withdraw ERC20 | 24297723 | 137 days ago | IN | 0 ETH | 0 | ||||
| Deposit ETH | 24297369 | 137 days ago | IN | 0.000001 ETH | 0 | ||||
| Withdraw ERC20 | 24261346 | 138 days ago | IN | 0 ETH | 0.00000052 | ||||
| Supply ERC20 | 24261251 | 138 days ago | IN | 0 ETH | 0.00000022 | ||||
| Withdraw ERC20 | 24192572 | 140 days ago | IN | 0 ETH | 0.00000046 | ||||
| Supply ERC20 | 24192483 | 140 days ago | IN | 0 ETH | 0.00000034 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 24558590 | 131 days ago | 0.000001 ETH | ||||
| 24315855 | 137 days ago | 0.000001 ETH | ||||
| 24299055 | 137 days ago | 0.000001 ETH | ||||
| 24297369 | 137 days ago | 0.000001 ETH | ||||
| 24015150 | 144 days ago | 0.000001 ETH | ||||
| 24015078 | 144 days ago | 0.000003 ETH | ||||
| 24015071 | 144 days ago | 0.000003 ETH | ||||
| 24015055 | 144 days ago | 0.000003 ETH | ||||
| 24014536 | 144 days ago | 0.00009999 ETH | ||||
| 24014536 | 144 days ago | 0.00000011 ETH | ||||
| 24013737 | 144 days ago | 0.0000011 ETH | ||||
| 23759937 | 150 days ago | 0.000001 ETH | ||||
| 23758713 | 150 days ago | 0.000003 ETH | ||||
| 23135203 | 164 days ago | 0.000001 ETH | ||||
| 22920783 | 169 days ago | 0.000001 ETH | ||||
| 22680470 | 175 days ago | 0.0015 ETH | ||||
| 22548275 | 178 days ago | 0.000001 ETH | ||||
| 22425685 | 180 days ago | 0.000001 ETH | ||||
| 22022474 | 190 days ago | 0.00009999 ETH | ||||
| 22022474 | 190 days ago | 0.00000057 ETH | ||||
| 22022361 | 190 days ago | 0.000022 ETH | ||||
| 21987845 | 191 days ago | 0.000001 ETH | ||||
| 21779311 | 195 days ago | 0.015 ETH | ||||
| 21696709 | 197 days ago | 12 ETH | ||||
| 21332086 | 206 days ago | 0.000001 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PacPoolWrapper
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 100000 runs
Other Settings:
berlin EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IPool, DataTypes} from "./core-v3/contracts/interfaces/IPool.sol";
import {IPoolAddressesProvider} from "./core-v3/contracts/interfaces/IPoolAddressesProvider.sol";
import {IWETH} from "./core-v3/contracts/misc/interfaces/IWETH.sol";
import {IFlashLoanSimpleReceiver} from "./core-v3/contracts/flashloan/interfaces/IFlashLoanSimpleReceiver.sol";
import {IAToken} from "./core-v3/contracts/interfaces/IAToken.sol";
import {DataTypesHelper} from "./periphery-v3/contracts/libraries/DataTypesHelper.sol";
import {IGasRefund} from "./interfaces/IGasRefund.sol";
import {IBlast} from "./interfaces/IBlast.sol";
import {IUniswapV2Router02} from "./dependencies/uniswapv2/interfaces/IUniswapV2Router02.sol";
/// @title PAC Pool Wrapper Contract
/// @author PAC
contract PacPoolWrapper is Ownable, ReentrancyGuard, IFlashLoanSimpleReceiver {
using SafeERC20 for IERC20;
/// @notice Lending Pool address
IPool public immutable POOL;
/// @notice Wrapped ETH contract address
IWETH public immutable WETH;
/// @notice UniswapV2 swap router contract address
IUniswapV2Router02 public swapRouter;
/// @notice Gas refund contract address
address public gasRefund;
uint16 private constant referralCode = 0;
error AddressZero();
error ReceiveNotAllowed();
error InvalidFlashLoan();
error ZeroAmount();
error InvalidMsgValue();
error InvalidParam();
error FeatureNotActive();
enum OperationType {
Leverage,
Multiplier
}
/**
* @dev Emitted during leverageDeposit()
* @param user The address of the user
* @param asset The address of the asset
* @param cashAmount The amount of cash for the deposit
* @param borrowAmount The amount borrowed from lending pool for the deposit
**/
event LeverageDeposit(
address user,
address asset,
uint256 cashAmount,
uint256 borrowAmount
);
/**
* @dev Emitted during multiplierDeposit()
* @param user The address of the user
* @param asset The address of the asset
* @param cashAmount The amount of cash for the deposit
* @param borrowAmount The amount borrowed from lending pool for the deposit
* @param depositAsset The address of the deposit asset
**/
event MultiplierDeposit(
address user,
address asset,
uint256 cashAmount,
uint256 borrowAmount,
address depositAsset
);
/**
* @dev Emitted during rescueToken()
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount being rescued
**/
event RescueToken(
address indexed token,
address indexed to,
uint256 amount
);
constructor(address _lendingPool, address _weth) {
if (address(_lendingPool) == address(0)) revert AddressZero();
if (address(_weth) == address(0)) revert AddressZero();
POOL = IPool(_lendingPool);
WETH = IWETH(_weth);
WETH.approve(_lendingPool, type(uint256).max);
address blast = POOL.BLAST();
if (blast != address(0)) {
IBlast(blast).configureClaimableGas();
}
}
/**
* @dev Only WETH contract is allowed to transfer ETH here. Prevent other addresses to send Ether to this contract.
*/
receive() external payable {
if (msg.sender != address(WETH)) revert ReceiveNotAllowed();
}
function _addGasRefund(
uint256 gasConsumed,
IGasRefund.RefundType refundType
) internal {
if (gasRefund != address(0)) {
uint256 refund = gasConsumed * tx.gasprice;
IGasRefund(gasRefund).addGasRefund(msg.sender, refund, refundType);
}
}
/**
* @dev deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (aTokens)
* is minted.
* @param onBehalfOf address of the user who will receive the aTokens representing the deposit
**/
function depositETH(address onBehalfOf) external payable nonReentrant {
WETH.deposit{value: msg.value}();
uint256 gasBegin = gasleft();
POOL.deposit(address(WETH), msg.value, onBehalfOf, referralCode);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.SUPPLY);
}
/**
* @dev withdraws the WETH _reserves of msg.sender.
* @param amount amount of aWETH to withdraw and receive native ETH
* @param to address of the user who will receive native ETH
*/
function withdrawETH(uint256 amount, address to) external nonReentrant {
IAToken aWETH = IAToken(
POOL.getReserveData(address(WETH)).aTokenAddress
);
uint256 userBalance = aWETH.balanceOf(msg.sender);
uint256 amountToWithdraw = amount;
// if amount is equal to uint(-1), the user wants to redeem everything
if (amount == type(uint256).max) {
amountToWithdraw = userBalance;
}
aWETH.transferFrom(msg.sender, address(this), amountToWithdraw);
uint256 gasBegin = gasleft();
POOL.withdraw(address(WETH), amountToWithdraw, address(this));
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.WITHDRAW);
WETH.withdraw(amountToWithdraw);
_safeTransferETH(to, amountToWithdraw);
}
/**
* @dev repays a borrow on the WETH reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
* @param amount the amount to repay, or uint256(-1) if the user wants to repay everything
* @param rateMode the rate mode to repay
* @param onBehalfOf the address for which msg.sender is repaying
*/
function repayETH(
uint256 amount,
uint256 rateMode,
address onBehalfOf
) external payable nonReentrant {
(uint256 stableDebt, uint256 variableDebt) = DataTypesHelper
.getUserCurrentDebt(onBehalfOf, POOL.getReserveData(address(WETH)));
uint256 paybackAmount = DataTypes.InterestRateMode(rateMode) ==
DataTypes.InterestRateMode.STABLE
? stableDebt
: variableDebt;
if (amount < paybackAmount) {
paybackAmount = amount;
}
require(
msg.value >= paybackAmount,
"msg.value is less than repayment amount"
);
WETH.deposit{value: paybackAmount}();
uint256 gasBegin = gasleft();
POOL.repay(address(WETH), msg.value, rateMode, onBehalfOf);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.REPAY);
// refund remaining dust eth
if (msg.value > paybackAmount)
_safeTransferETH(msg.sender, msg.value - paybackAmount);
}
/**
* @dev borrow WETH, unwraps to ETH and send both the ETH and DebtTokens to msg.sender, via `approveDelegation` and onBehalf argument in `Pool.borrow`.
* @param amount the amount of ETH to borrow
* @param interestRateMode the interest rate mode
*/
function borrowETH(
uint256 amount,
uint256 interestRateMode
) external nonReentrant {
uint256 gasBegin = gasleft();
POOL.borrow(
address(WETH),
amount,
interestRateMode,
referralCode,
msg.sender
);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.BORROW);
WETH.withdraw(amount);
_safeTransferETH(msg.sender, amount);
}
/**
* @notice Supplly an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
*/
function supplyERC20(
address asset,
uint256 amount,
address onBehalfOf
) external nonReentrant {
if (amount == 0) revert ZeroAmount();
if (amount > 0) {
IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);
}
_checkApprove(asset, address(POOL));
uint256 gasBegin = gasleft();
POOL.supply(asset, amount, onBehalfOf, referralCode);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.SUPPLY);
}
/**
* @notice Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
* @param asset The address of the underlying asset to withdraw
* @param amount The underlying amount to be withdrawn
* - Send the value type(uint256).max in order to withdraw the whole aToken balance
* @param to The address that will receive the underlying, same as msg.sender if the user
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
*/
function withdrawERC20(
address asset,
uint256 amount,
address to
) external nonReentrant {
IAToken aToken = IAToken(
POOL.getReserveData(address(asset)).aTokenAddress
);
uint256 userBalance = aToken.balanceOf(msg.sender);
uint256 amountToWithdraw = amount;
// if amount is equal to uint(-1), the user wants to redeem everything
if (amount == type(uint256).max) {
amountToWithdraw = userBalance;
}
aToken.transferFrom(msg.sender, address(this), amountToWithdraw);
uint256 gasBegin = gasleft();
POOL.withdraw(asset, amountToWithdraw, to);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.WITHDRAW);
}
function borrowERC20(
address asset,
uint256 amount,
uint256 interestRateMode
) external nonReentrant {
uint256 gasBegin = gasleft();
POOL.borrow(asset, amount, interestRateMode, referralCode, msg.sender);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.BORROW);
IERC20(asset).safeTransfer(msg.sender, amount);
}
function repayERC20(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf
) external nonReentrant {
(uint256 stableDebt, uint256 variableDebt) = DataTypesHelper
.getUserCurrentDebt(onBehalfOf, POOL.getReserveData(asset));
uint256 paybackAmount = DataTypes.InterestRateMode(interestRateMode) ==
DataTypes.InterestRateMode.STABLE
? stableDebt
: variableDebt;
if (amount < paybackAmount) {
paybackAmount = amount;
}
if (paybackAmount == 0) revert ZeroAmount();
IERC20(asset).safeTransferFrom(
msg.sender,
address(this),
paybackAmount
);
uint256 gasBegin = gasleft();
POOL.repay(asset, paybackAmount, interestRateMode, onBehalfOf);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.REPAY);
}
/**
* @dev Loop the deposit and borrow of an asset
* @param asset to deposit
* @param cashAmount cash amount for the deposit
* @param borrowAmount borrow amount for the deposit
**/
function leverageDeposit(
address asset,
uint256 cashAmount,
uint256 borrowAmount
) external payable nonReentrant {
if (borrowAmount == 0) revert ZeroAmount();
if (asset == address(0)) {
if (cashAmount != msg.value) revert InvalidMsgValue();
WETH.deposit{value: cashAmount}();
asset = address(WETH);
} else {
if (msg.value != 0) revert InvalidMsgValue();
if (cashAmount > 0) {
IERC20(asset).safeTransferFrom(
msg.sender,
address(this),
cashAmount
);
}
}
uint256 gasBegin = gasleft();
bytes memory params = abi.encode(
OperationType.Leverage,
msg.sender,
cashAmount,
borrowAmount
);
POOL.flashLoanSimple(
address(this),
asset,
borrowAmount,
params,
referralCode
);
uint256 gasEnd = gasleft();
_addGasRefund(gasBegin - gasEnd, IGasRefund.RefundType.LEVERAGEDEPOSIT);
emit LeverageDeposit(msg.sender, asset, cashAmount, borrowAmount);
}
struct MultiplierLocalVars {
address user;
uint256 cashAmount;
uint256 borrowAmount;
uint256 minDepositAmount;
address[] swapPath;
}
function multiplierDeposit(
address asset,
uint256 cashAmount,
uint256 borrowAmount,
address depositAsset,
uint256 minDepositAmount,
address[] calldata swapPath
) external payable nonReentrant {
if (address(swapRouter) == address(0)) revert FeatureNotActive();
if (asset == depositAsset) revert InvalidParam();
if (asset == address(0)) {
if (cashAmount != msg.value) revert InvalidMsgValue();
WETH.deposit{value: cashAmount}();
asset = address(WETH);
} else {
if (msg.value != 0) revert InvalidMsgValue();
if (cashAmount > 0) {
IERC20(asset).safeTransferFrom(
msg.sender,
address(this),
cashAmount
);
}
}
MultiplierLocalVars memory localVars;
localVars.user = msg.sender;
localVars.cashAmount = cashAmount;
localVars.borrowAmount = borrowAmount;
localVars.minDepositAmount = minDepositAmount;
localVars.swapPath = swapPath;
uint256 gasBegin = gasleft();
bytes memory params = abi.encode(OperationType.Multiplier, localVars);
POOL.flashLoanSimple(
address(this),
asset,
borrowAmount,
params,
referralCode
);
uint256 gasEnd = gasleft();
_addGasRefund(
gasBegin - gasEnd,
IGasRefund.RefundType.MULTIPLIERDEPOSIT
);
emit MultiplierDeposit(
msg.sender,
asset,
cashAmount,
borrowAmount,
depositAsset
);
}
/// @inheritdoc IFlashLoanSimpleReceiver
function executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata params
) external returns (bool) {
OperationType operationType = abi.decode(params, (OperationType));
if (operationType == OperationType.Leverage) {
//decode param
(address user, uint256 cashAmount, uint256 borrowAmount) = abi
.decode(params[32:], (address, uint256, uint256));
if (
msg.sender != address(POOL) ||
initiator != address(this) ||
borrowAmount != amount
) revert InvalidFlashLoan();
_checkApprove(asset, address(POOL));
//supply asset
uint256 supplyAmount = cashAmount + borrowAmount - premium;
POOL.supply(asset, supplyAmount, user, referralCode);
//borrow asset
POOL.borrow(asset, borrowAmount, 2, referralCode, user);
//nothing need to do for repaying flash loan since we've approved asset.
return true;
} else if (operationType == OperationType.Multiplier) {
//decode param
MultiplierLocalVars memory localVars;
(operationType, localVars) = abi.decode(
params,
(OperationType, MultiplierLocalVars)
);
if (
msg.sender != address(POOL) ||
initiator != address(this) ||
localVars.borrowAmount != amount
) revert InvalidFlashLoan();
//supply asset
_checkApprove(asset, address(swapRouter));
uint256 tokenInAmount = localVars.cashAmount +
localVars.borrowAmount -
premium;
uint[] memory amounts = swapRouter.swapExactTokensForTokens(
tokenInAmount,
localVars.minDepositAmount,
localVars.swapPath,
address(this),
block.timestamp
);
address supplyAsset = localVars.swapPath[
localVars.swapPath.length - 1
];
_checkApprove(supplyAsset, address(POOL));
POOL.supply(
supplyAsset,
amounts[amounts.length - 1],
localVars.user,
referralCode
);
//borrow asset
POOL.borrow(
asset,
localVars.borrowAmount,
2,
referralCode,
localVars.user
);
//approve asset to repay flashloan
_checkApprove(asset, address(POOL));
return true;
}
//will revert in lending pool
return false;
}
/// @inheritdoc IFlashLoanSimpleReceiver
function ADDRESSES_PROVIDER()
external
view
returns (IPoolAddressesProvider)
{
return POOL.ADDRESSES_PROVIDER();
}
/**
* @notice Rescue erc20/ETH from this contract address. Only owner can call this function
* @param token The token address to be rescued
* @param to The account address to receive token
* @param amount The amount to be rescued
**/
function rescueToken(
address token,
address to,
uint256 amount
) external onlyOwner {
if (token == address(0)) {
_safeTransferETH(to, amount);
} else {
IERC20(token).safeTransfer(to, amount);
}
emit RescueToken(token, to, amount);
}
/**
* @notice Set gas refund address. Only owner can call this function
* @param _gasRefund The address of user gas refund contract
**/
function setGasRefund(address _gasRefund) external onlyOwner {
gasRefund = _gasRefund;
}
function setSwapRouter(address _swapRouter) external onlyOwner {
swapRouter = IUniswapV2Router02(_swapRouter);
}
/**
* @dev transfer ETH to an address, revert if it fails.
* @param to recipient of the transfer
* @param value the amount to send
*/
function _safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, "ETH_TRANSFER_FAILED");
}
/**
* @notice Approves token allowance for lending pool.
* @param asset Address of the asset
**/
function _checkApprove(address asset, address target) internal {
if (IERC20(asset).allowance(address(this), target) == 0) {
IERC20(asset).safeApprove(target, type(uint256).max);
}
}
function claimRefundedGas(address recipient) external onlyOwner {
address blast = POOL.BLAST();
if (blast != address(0)) {
IBlast(blast).claimMaxGas(address(this), recipient);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_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. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @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 ReentrancyGuard {
// 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;
constructor() {
_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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation 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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(
address recipient,
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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
import {IPoolAddressesProvider} from "../../interfaces/IPoolAddressesProvider.sol";
import {IPool} from "../../interfaces/IPool.sol";
/**
* @title IFlashLoanSimpleReceiver
* @author Aave
* @notice Defines the basic interface of a flashloan-receiver contract.
* @dev Implement this interface to develop a flashloan-compatible flashLoanReceiver contract
*/
interface IFlashLoanSimpleReceiver {
/**
* @notice Executes an operation after receiving the flash-borrowed asset
* @dev Ensure that the contract can return the debt + premium, e.g., has
* enough funds to repay and has approved the Pool to pull the total amount
* @param asset The address of the flash-borrowed asset
* @param amount The amount of the flash-borrowed asset
* @param premium The fee of the flash-borrowed asset
* @param initiator The address of the flashloan initiator
* @param params The byte-encoded params passed when initiating the flashloan
* @return True if the execution of the operation succeeds, false otherwise
*/
function executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes calldata params
) external returns (bool);
function ADDRESSES_PROVIDER()
external
view
returns (IPoolAddressesProvider);
function POOL() external view returns (IPool);
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
/**
* @title IAaveIncentivesController
* @author Aave
* @notice Defines the basic interface for an Aave Incentives Controller.
* @dev It only contains one single function, needed as a hook on aToken and debtToken transfers.
*/
interface IAaveIncentivesController {
/**
* @dev Called by the corresponding asset on transfer hook in order to update the rewards distribution.
* @dev The units of `totalSupply` and `userBalance` should be the same.
* @param user The address of the user whose asset balance has changed
* @param totalSupply The total supply of the asset prior to user balance change
* @param userBalance The previous user balance prior to balance change
*/
function handleAction(
address user,
uint256 totalSupply,
uint256 userBalance
) external;
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
import {IERC20} from "../dependencies/openzeppelin/contracts/IERC20.sol";
import {IScaledBalanceToken} from "./IScaledBalanceToken.sol";
import {IInitializableAToken} from "./IInitializableAToken.sol";
/**
* @title IAToken
* @author Aave
* @notice Defines the basic interface for an AToken.
*/
interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @dev Emitted during the transfer action
* @param from The user whose tokens are being transferred
* @param to The recipient
* @param value The scaled amount being transferred
* @param index The next liquidity index of the reserve
*/
event BalanceTransfer(
address indexed from,
address indexed to,
uint256 value,
uint256 index
);
/**
* @notice Mints `amount` aTokens to `user`
* @param caller The address performing the mint
* @param onBehalfOf The address of the user that will receive the minted aTokens
* @param amount The amount of tokens getting minted
* @param index The next liquidity index of the reserve
* @return `true` if the the previous balance of the user was 0
*/
function mint(
address caller,
address onBehalfOf,
uint256 amount,
uint256 index
) external returns (bool);
/**
* @notice Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`
* @dev In some instances, the mint event could be emitted from a burn transaction
* if the amount to burn is less than the interest that the user accrued
* @param from The address from which the aTokens will be burned
* @param receiverOfUnderlying The address that will receive the underlying
* @param amount The amount being burned
* @param index The next liquidity index of the reserve
*/
function burn(
address from,
address receiverOfUnderlying,
uint256 amount,
uint256 index
) external;
/**
* @notice Mints aTokens to the reserve treasury
* @param amount The amount of tokens getting minted
* @param index The next liquidity index of the reserve
*/
function mintToTreasury(uint256 amount, uint256 index) external;
/**
* @notice Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
* @param from The address getting liquidated, current owner of the aTokens
* @param to The recipient
* @param value The amount of tokens getting transferred
*/
function transferOnLiquidation(
address from,
address to,
uint256 value
) external;
/**
* @notice Transfers the underlying asset to `target`.
* @dev Used by the Pool to transfer assets in borrow(), withdraw() and flashLoan()
* @param target The recipient of the underlying
* @param amount The amount getting transferred
*/
function transferUnderlyingTo(address target, uint256 amount) external;
/**
* @notice Handles the underlying received by the aToken after the transfer has been completed.
* @dev The default implementation is empty as with standard ERC20 tokens, nothing needs to be done after the
* transfer is concluded. However in the future there may be aTokens that allow for example to stake the underlying
* to receive LM rewards. In that case, `handleRepayment()` would perform the staking of the underlying asset.
* @param user The user executing the repayment
* @param onBehalfOf The address of the user who will get his debt reduced/removed
* @param amount The amount getting repaid
*/
function handleRepayment(
address user,
address onBehalfOf,
uint256 amount
) external;
/**
* @notice Allow passing a signed message to approve spending
* @dev implements the permit function as for
* https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md
* @param owner The owner of the funds
* @param spender The spender
* @param value The amount
* @param deadline The deadline timestamp, type(uint256).max for max deadline
* @param v Signature param
* @param s Signature param
* @param r Signature param
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @return The address of the underlying asset
*/
function UNDERLYING_ASSET_ADDRESS() external view returns (address);
/**
* @notice Returns the address of the Aave treasury, receiving the fees on this aToken.
* @return Address of the Aave treasury
*/
function RESERVE_TREASURY_ADDRESS() external view returns (address);
/**
* @notice Get the domain separator for the token
* @dev Return cached value if chainId matches cache, otherwise recomputes separator
* @return The domain separator of the token at current chain
*/
function DOMAIN_SEPARATOR() external view returns (bytes32);
/**
* @notice Returns the nonce for owner.
* @param owner The address of the owner
* @return The nonce of the owner
*/
function nonces(address owner) external view returns (uint256);
/**
* @notice Rescue and transfer tokens locked in this contract
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(address token, address to, uint256 amount) external;
function configureClaimableYield() external;
/**
* @notice Configure blast point operator
* @param blastPoints The address of BlastPoints
* @param pointsOperator The address of the point operator
*/
function configurePointOperator(
address blastPoints,
address pointsOperator
) external;
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
import {IAaveIncentivesController} from "./IAaveIncentivesController.sol";
import {IPool} from "./IPool.sol";
/**
* @title IInitializableAToken
* @author Aave
* @notice Interface for the initialize function on AToken
*/
interface IInitializableAToken {
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated pool
* @param treasury The address of the treasury
* @param incentivesController The address of the incentives controller for this aToken
* @param aTokenDecimals The decimals of the underlying
* @param aTokenName The name of the aToken
* @param aTokenSymbol The symbol of the aToken
* @param params A set of encoded parameters for additional initialization
*/
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address treasury,
address incentivesController,
uint8 aTokenDecimals,
string aTokenName,
string aTokenSymbol,
bytes params
);
/**
* @notice Initializes the aToken
* @param pool The pool contract that is initializing this contract
* @param treasury The address of the Aave treasury, receiving the fees on this aToken
* @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @param incentivesController The smart contract managing potential incentives distribution
* @param aTokenDecimals The decimals of the aToken, same as the underlying asset's
* @param aTokenName The name of the aToken
* @param aTokenSymbol The symbol of the aToken
* @param params A set of encoded parameters for additional initialization
*/
function initialize(
IPool pool,
address treasury,
address underlyingAsset,
IAaveIncentivesController incentivesController,
uint8 aTokenDecimals,
string calldata aTokenName,
string calldata aTokenSymbol,
bytes calldata params
) external;
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
import {IPoolAddressesProvider} from "./IPoolAddressesProvider.sol";
import {DataTypes} from "../protocol/libraries/types/DataTypes.sol";
/**
* @title IPool
* @author Aave
* @notice Defines the basic interface for an Aave Pool.
*/
interface IPool {
/**
* @dev Emitted on mintUnbacked()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supplied assets, receiving the aTokens
* @param amount The amount of supplied assets
* @param referralCode The referral code used
*/
event MintUnbacked(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on backUnbacked()
* @param reserve The address of the underlying asset of the reserve
* @param backer The address paying for the backing
* @param amount The amount added as backing
* @param fee The amount paid in fees
*/
event BackUnbacked(
address indexed reserve,
address indexed backer,
uint256 amount,
uint256 fee
);
/**
* @dev Emitted on supply()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supply, receiving the aTokens
* @param amount The amount supplied
* @param referralCode The referral code used
*/
event Supply(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on withdraw()
* @param reserve The address of the underlying asset being withdrawn
* @param user The address initiating the withdrawal, owner of aTokens
* @param to The address that will receive the underlying
* @param amount The amount to be withdrawn
*/
event Withdraw(
address indexed reserve,
address indexed user,
address indexed to,
uint256 amount
);
/**
* @dev Emitted on borrow() and flashLoan() when debt needs to be opened
* @param reserve The address of the underlying asset being borrowed
* @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
* initiator of the transaction on flashLoan()
* @param onBehalfOf The address that will be getting the debt
* @param amount The amount borrowed out
* @param interestRateMode The rate mode: 1 for Stable, 2 for Variable
* @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
* @param referralCode The referral code used
*/
event Borrow(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
DataTypes.InterestRateMode interestRateMode,
uint256 borrowRate,
uint16 indexed referralCode
);
/**
* @dev Emitted on repay()
* @param reserve The address of the underlying asset of the reserve
* @param user The beneficiary of the repayment, getting his debt reduced
* @param repayer The address of the user initiating the repay(), providing the funds
* @param amount The amount repaid
* @param useATokens True if the repayment is done using aTokens, `false` if done with underlying asset directly
*/
event Repay(
address indexed reserve,
address indexed user,
address indexed repayer,
uint256 amount,
bool useATokens
);
/**
* @dev Emitted on swapBorrowRateMode()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user swapping his rate mode
* @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
*/
event SwapBorrowRateMode(
address indexed reserve,
address indexed user,
DataTypes.InterestRateMode interestRateMode
);
/**
* @dev Emitted on borrow(), repay() and liquidationCall() when using isolated assets
* @param asset The address of the underlying asset of the reserve
* @param totalDebt The total isolation mode debt for the reserve
*/
event IsolationModeTotalDebtUpdated(
address indexed asset,
uint256 totalDebt
);
/**
* @dev Emitted when the user selects a certain asset category for eMode
* @param user The address of the user
* @param categoryId The category id
*/
event UserEModeSet(address indexed user, uint8 categoryId);
/**
* @dev Emitted on setUserUseReserveAsCollateral()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user enabling the usage as collateral
*/
event ReserveUsedAsCollateralEnabled(
address indexed reserve,
address indexed user
);
/**
* @dev Emitted on setUserUseReserveAsCollateral()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user enabling the usage as collateral
*/
event ReserveUsedAsCollateralDisabled(
address indexed reserve,
address indexed user
);
/**
* @dev Emitted on rebalanceStableBorrowRate()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user for which the rebalance has been executed
*/
event RebalanceStableBorrowRate(
address indexed reserve,
address indexed user
);
/**
* @dev Emitted on flashLoan()
* @param target The address of the flash loan receiver contract
* @param initiator The address initiating the flash loan
* @param asset The address of the asset being flash borrowed
* @param amount The amount flash borrowed
* @param interestRateMode The flashloan mode: 0 for regular flashloan, 1 for Stable debt, 2 for Variable debt
* @param premium The fee flash borrowed
* @param referralCode The referral code used
*/
event FlashLoan(
address indexed target,
address initiator,
address indexed asset,
uint256 amount,
DataTypes.InterestRateMode interestRateMode,
uint256 premium,
uint16 indexed referralCode
);
/**
* @dev Emitted when a borrower is liquidated.
* @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
* @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
* @param user The address of the borrower getting liquidated
* @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
* @param liquidatedCollateralAmount The amount of collateral received by the liquidator
* @param liquidator The address of the liquidator
* @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
* to receive the underlying collateral asset directly
*/
event LiquidationCall(
address indexed collateralAsset,
address indexed debtAsset,
address indexed user,
uint256 debtToCover,
uint256 liquidatedCollateralAmount,
address liquidator,
bool receiveAToken
);
/**
* @dev Emitted when the state of a reserve is updated.
* @param reserve The address of the underlying asset of the reserve
* @param liquidityRate The next liquidity rate
* @param stableBorrowRate The next stable borrow rate
* @param variableBorrowRate The next variable borrow rate
* @param liquidityIndex The next liquidity index
* @param variableBorrowIndex The next variable borrow index
*/
event ReserveDataUpdated(
address indexed reserve,
uint256 liquidityRate,
uint256 stableBorrowRate,
uint256 variableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex
);
/**
* @dev Emitted when the protocol treasury receives minted aTokens from the accrued interest.
* @param reserve The address of the reserve
* @param amountMinted The amount minted to the treasury
*/
event MintedToTreasury(address indexed reserve, uint256 amountMinted);
/**
* @notice Mints an `amount` of aTokens to the `onBehalfOf`
* @param asset The address of the underlying asset to mint
* @param amount The amount to mint
* @param onBehalfOf The address that will receive the aTokens
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function mintUnbacked(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
/**
* @notice Back the current unbacked underlying with `amount` and pay `fee`.
* @param asset The address of the underlying asset to back
* @param amount The amount to back
* @param fee The amount paid in fees
* @return The backed amount
*/
function backUnbacked(
address asset,
uint256 amount,
uint256 fee
) external returns (uint256);
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function supply(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
/**
* @notice Supply with transfer approval of asset to be supplied done via permit function
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param deadline The deadline timestamp that the permit is valid
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
* @param permitS The S parameter of ERC712 permit sig
*/
function supplyWithPermit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external;
/**
* @notice Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
* @param asset The address of the underlying asset to withdraw
* @param amount The underlying amount to be withdrawn
* - Send the value type(uint256).max in order to withdraw the whole aToken balance
* @param to The address that will receive the underlying, same as msg.sender if the user
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
* @return The final amount withdrawn
*/
function withdraw(
address asset,
uint256 amount,
address to
) external returns (uint256);
/**
* @notice Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
* already supplied enough collateral, or he was given enough allowance by a credit delegator on the
* corresponding debt token (StableDebtToken or VariableDebtToken)
* - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
* and 100 stable/variable debt tokens, depending on the `interestRateMode`
* @param asset The address of the underlying asset to borrow
* @param amount The amount to be borrowed
* @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param onBehalfOf The address of the user who will receive the debt. Should be the address of the borrower itself
* calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
* if he has been given credit delegation allowance
*/
function borrow(
address asset,
uint256 amount,
uint256 interestRateMode,
uint16 referralCode,
address onBehalfOf
) external;
/**
* @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
* - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
* @param onBehalfOf The address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
* @return The final amount repaid
*/
function repay(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf
) external returns (uint256);
/**
* @notice Repay with transfer approval of asset to be repaid done via permit function
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
* @param deadline The deadline timestamp that the permit is valid
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
* @param permitS The S parameter of ERC712 permit sig
* @return The final amount repaid
*/
function repayWithPermit(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external returns (uint256);
/**
* @notice Repays a borrowed `amount` on a specific reserve using the reserve aTokens, burning the
* equivalent debt tokens
* - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable/stable debt tokens
* @dev Passing uint256.max as amount will clean up any residual aToken dust balance, if the user aToken
* balance is not enough to cover the whole debt
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
* @return The final amount repaid
*/
function repayWithATokens(
address asset,
uint256 amount,
uint256 interestRateMode
) external returns (uint256);
/**
* @notice Allows a borrower to swap his debt between stable and variable mode, or vice versa
* @param asset The address of the underlying asset borrowed
* @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
*/
function swapBorrowRateMode(
address asset,
uint256 interestRateMode
) external;
/**
* @notice Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
* - Users can be rebalanced if the following conditions are satisfied:
* 1. Usage ratio is above 95%
* 2. the current supply APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too
* much has been borrowed at a stable rate and suppliers are not earning enough
* @param asset The address of the underlying asset borrowed
* @param user The address of the user to be rebalanced
*/
function rebalanceStableBorrowRate(address asset, address user) external;
/**
* @notice Allows suppliers to enable/disable a specific supplied asset as collateral
* @param asset The address of the underlying asset supplied
* @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
*/
function setUserUseReserveAsCollateral(
address asset,
bool useAsCollateral
) external;
/**
* @notice Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
* - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
* a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
* @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
* @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
* @param user The address of the borrower getting liquidated
* @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
* @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
* to receive the underlying collateral asset directly
*/
function liquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
bool receiveAToken
) external;
/**
* @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
* into consideration. For further details please visit https://docs.aave.com/developers/
* @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface
* @param assets The addresses of the assets being flash-borrowed
* @param amounts The amounts of the assets being flash-borrowed
* @param interestRateModes Types of the debt to open if the flash loan is not returned:
* 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
* 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
* 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
* @param onBehalfOf The address that will receive the debt in the case of using on `modes` 1 or 2
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function flashLoan(
address receiverAddress,
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata interestRateModes,
address onBehalfOf,
bytes calldata params,
uint16 referralCode
) external;
/**
* @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
* into consideration. For further details please visit https://docs.aave.com/developers/
* @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface
* @param asset The address of the asset being flash-borrowed
* @param amount The amount of the asset being flash-borrowed
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function flashLoanSimple(
address receiverAddress,
address asset,
uint256 amount,
bytes calldata params,
uint16 referralCode
) external;
/**
* @notice Returns the user account data across all the reserves
* @param user The address of the user
* @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
* @return totalDebtBase The total debt of the user in the base currency used by the price feed
* @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
* @return currentLiquidationThreshold The liquidation threshold of the user
* @return ltv The loan to value of The user
* @return healthFactor The current health factor of the user
*/
function getUserAccountData(
address user
)
external
view
returns (
uint256 totalCollateralBase,
uint256 totalDebtBase,
uint256 availableBorrowsBase,
uint256 currentLiquidationThreshold,
uint256 ltv,
uint256 healthFactor
);
/**
* @notice Initializes a reserve, activating it, assigning an aToken and debt tokens and an
* interest rate strategy
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param aTokenAddress The address of the aToken that will be assigned to the reserve
* @param stableDebtAddress The address of the StableDebtToken that will be assigned to the reserve
* @param variableDebtAddress The address of the VariableDebtToken that will be assigned to the reserve
* @param interestRateStrategyAddress The address of the interest rate strategy contract
*/
function initReserve(
address asset,
address aTokenAddress,
address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external;
/**
* @notice Drop a reserve
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
*/
function dropReserve(address asset) external;
/**
* @notice Updates the address of the interest rate strategy contract
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param rateStrategyAddress The address of the interest rate strategy contract
*/
function setReserveInterestRateStrategyAddress(
address asset,
address rateStrategyAddress
) external;
/**
* @notice Sets the configuration bitmap of the reserve as a whole
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param configuration The new configuration bitmap
*/
function setConfiguration(
address asset,
DataTypes.ReserveConfigurationMap calldata configuration
) external;
/**
* @notice Returns the configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The configuration of the reserve
*/
function getConfiguration(
address asset
) external view returns (DataTypes.ReserveConfigurationMap memory);
/**
* @notice Returns the configuration of the user across all the reserves
* @param user The user address
* @return The configuration of the user
*/
function getUserConfiguration(
address user
) external view returns (DataTypes.UserConfigurationMap memory);
/**
* @notice Returns the normalized income of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve's normalized income
*/
function getReserveNormalizedIncome(
address asset
) external view returns (uint256);
/**
* @notice Returns the normalized variable debt per unit of asset
* @dev WARNING: This function is intended to be used primarily by the protocol itself to get a
* "dynamic" variable index based on time, current stored index and virtual rate at the current
* moment (approx. a borrower would get if opening a position). This means that is always used in
* combination with variable debt supply/balances.
* If using this function externally, consider that is possible to have an increasing normalized
* variable debt that is not equivalent to how the variable debt index would be updated in storage
* (e.g. only updates with non-zero variable debt supply)
* @param asset The address of the underlying asset of the reserve
* @return The reserve normalized variable debt
*/
function getReserveNormalizedVariableDebt(
address asset
) external view returns (uint256);
/**
* @notice Returns the state and configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The state and configuration data of the reserve
*/
function getReserveData(
address asset
) external view returns (DataTypes.ReserveData memory);
/**
* @notice Validates and finalizes an aToken transfer
* @dev Only callable by the overlying aToken of the `asset`
* @param asset The address of the underlying asset of the aToken
* @param from The user from which the aTokens are transferred
* @param to The user receiving the aTokens
* @param amount The amount being transferred/withdrawn
* @param balanceFromBefore The aToken balance of the `from` user before the transfer
* @param balanceToBefore The aToken balance of the `to` user before the transfer
*/
function finalizeTransfer(
address asset,
address from,
address to,
uint256 amount,
uint256 balanceFromBefore,
uint256 balanceToBefore
) external;
/**
* @notice Returns the list of the underlying assets of all the initialized reserves
* @dev It does not include dropped reserves
* @return The addresses of the underlying assets of the initialized reserves
*/
function getReservesList() external view returns (address[] memory);
/**
* @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct
* @param id The id of the reserve as stored in the DataTypes.ReserveData struct
* @return The address of the reserve associated with id
*/
function getReserveAddressById(uint16 id) external view returns (address);
/**
* @notice Returns the PoolAddressesProvider connected to this contract
* @return The address of the PoolAddressesProvider
*/
function ADDRESSES_PROVIDER()
external
view
returns (IPoolAddressesProvider);
/**
* @notice Returns the BLAST connected to this contract
* @return The address of the BLAST
*/
function BLAST() external view returns (address);
/**
* @notice Updates the protocol fee on the bridging
* @param bridgeProtocolFee The part of the premium sent to the protocol treasury
*/
function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
/**
* @notice Updates flash loan premiums. Flash loan premium consists of two parts:
* - A part is sent to aToken holders as extra, one time accumulated interest
* - A part is collected by the protocol treasury
* @dev The total premium is calculated on the total borrowed amount
* @dev The premium to protocol is calculated on the total premium, being a percentage of `flashLoanPremiumTotal`
* @dev Only callable by the PoolConfigurator contract
* @param flashLoanPremiumTotal The total premium, expressed in bps
* @param flashLoanPremiumToProtocol The part of the premium sent to the protocol treasury, expressed in bps
*/
function updateFlashloanPremiums(
uint128 flashLoanPremiumTotal,
uint128 flashLoanPremiumToProtocol
) external;
/**
* @notice Configures a new category for the eMode.
* @dev In eMode, the protocol allows very high borrowing power to borrow assets of the same category.
* The category 0 is reserved as it's the default for volatile assets
* @param id The id of the category
* @param config The configuration of the category
*/
function configureEModeCategory(
uint8 id,
DataTypes.EModeCategory memory config
) external;
/**
* @notice Returns the data of an eMode category
* @param id The id of the category
* @return The configuration data of the category
*/
function getEModeCategoryData(
uint8 id
) external view returns (DataTypes.EModeCategory memory);
/**
* @notice Allows a user to use the protocol in eMode
* @param categoryId The id of the category
*/
function setUserEMode(uint8 categoryId) external;
/**
* @notice Returns the eMode the user is using
* @param user The address of the user
* @return The eMode id
*/
function getUserEMode(address user) external view returns (uint256);
/**
* @notice Resets the isolation mode total debt of the given asset to zero
* @dev It requires the given asset has zero debt ceiling
* @param asset The address of the underlying asset to reset the isolationModeTotalDebt
*/
function resetIsolationModeTotalDebt(address asset) external;
/**
* @notice Returns the percentage of available liquidity that can be borrowed at once at stable rate
* @return The percentage of available liquidity to borrow, expressed in bps
*/
function MAX_STABLE_RATE_BORROW_SIZE_PERCENT()
external
view
returns (uint256);
/**
* @notice Returns the total fee on flash loans
* @return The total fee on flashloans
*/
function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint128);
/**
* @notice Returns the part of the bridge fees sent to protocol
* @return The bridge fee sent to the protocol treasury
*/
function BRIDGE_PROTOCOL_FEE() external view returns (uint256);
/**
* @notice Returns the part of the flashloan fees sent to protocol
* @return The flashloan fee sent to the protocol treasury
*/
function FLASHLOAN_PREMIUM_TO_PROTOCOL() external view returns (uint128);
/**
* @notice Returns the maximum number of reserves supported to be listed in this Pool
* @return The maximum number of reserves supported
*/
function MAX_NUMBER_RESERVES() external view returns (uint16);
/**
* @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
* @param assets The list of reserves for which the minting needs to be executed
*/
function mintToTreasury(address[] calldata assets) external;
/**
* @notice Rescue and transfer tokens locked in this contract
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(address token, address to, uint256 amount) external;
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @dev Deprecated: Use the `supply` function instead
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
/**
* @title IPoolAddressesProvider
* @author Aave
* @notice Defines the basic interface for a Pool Addresses Provider.
*/
interface IPoolAddressesProvider {
/**
* @dev Emitted when the market identifier is updated.
* @param oldMarketId The old id of the market
* @param newMarketId The new id of the market
*/
event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
/**
* @dev Emitted when the pool is updated.
* @param oldAddress The old address of the Pool
* @param newAddress The new address of the Pool
*/
event PoolUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool configurator is updated.
* @param oldAddress The old address of the PoolConfigurator
* @param newAddress The new address of the PoolConfigurator
*/
event PoolConfiguratorUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle is updated.
* @param oldAddress The old address of the PriceOracle
* @param newAddress The new address of the PriceOracle
*/
event PriceOracleUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL manager is updated.
* @param oldAddress The old address of the ACLManager
* @param newAddress The new address of the ACLManager
*/
event ACLManagerUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL admin is updated.
* @param oldAddress The old address of the ACLAdmin
* @param newAddress The new address of the ACLAdmin
*/
event ACLAdminUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle sentinel is updated.
* @param oldAddress The old address of the PriceOracleSentinel
* @param newAddress The new address of the PriceOracleSentinel
*/
event PriceOracleSentinelUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the pool data provider is updated.
* @param oldAddress The old address of the PoolDataProvider
* @param newAddress The new address of the PoolDataProvider
*/
event PoolDataProviderUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when a new proxy is created.
* @param id The identifier of the proxy
* @param proxyAddress The address of the created proxy contract
* @param implementationAddress The address of the implementation contract
*/
event ProxyCreated(
bytes32 indexed id,
address indexed proxyAddress,
address indexed implementationAddress
);
/**
* @dev Emitted when a new non-proxied contract address is registered.
* @param id The identifier of the contract
* @param oldAddress The address of the old contract
* @param newAddress The address of the new contract
*/
event AddressSet(
bytes32 indexed id,
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the implementation of the proxy registered with id is updated
* @param id The identifier of the contract
* @param proxyAddress The address of the proxy contract
* @param oldImplementationAddress The address of the old implementation contract
* @param newImplementationAddress The address of the new implementation contract
*/
event AddressSetAsProxy(
bytes32 indexed id,
address indexed proxyAddress,
address oldImplementationAddress,
address indexed newImplementationAddress
);
/**
* @notice Returns the id of the Aave market to which this contract points to.
* @return The market id
*/
function getMarketId() external view returns (string memory);
/**
* @notice Associates an id with a specific PoolAddressesProvider.
* @dev This can be used to create an onchain registry of PoolAddressesProviders to
* identify and validate multiple Aave markets.
* @param newMarketId The market id
*/
function setMarketId(string calldata newMarketId) external;
/**
* @notice Returns an address by its identifier.
* @dev The returned address might be an EOA or a contract, potentially proxied
* @dev It returns ZERO if there is no registered address with the given id
* @param id The id
* @return The address of the registered for the specified id
*/
function getAddress(bytes32 id) external view returns (address);
/**
* @notice General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
* set as implementation the `newImplementationAddress`.
* @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
* setter function, in order to avoid unexpected consequences
* @param id The id
* @param newImplementationAddress The address of the new implementation
*/
function setAddressAsProxy(
bytes32 id,
address newImplementationAddress
) external;
/**
* @notice Sets an address for an id replacing the address saved in the addresses map.
* @dev IMPORTANT Use this function carefully, as it will do a hard replacement
* @param id The id
* @param newAddress The address to set
*/
function setAddress(bytes32 id, address newAddress) external;
/**
* @notice Returns the address of the Pool proxy.
* @return The Pool proxy address
*/
function getPool() external view returns (address);
/**
* @notice Updates the implementation of the Pool, or creates a proxy
* setting the new `pool` implementation when the function is called for the first time.
* @param newPoolImpl The new Pool implementation
*/
function setPoolImpl(address newPoolImpl) external;
/**
* @notice Returns the address of the PoolConfigurator proxy.
* @return The PoolConfigurator proxy address
*/
function getPoolConfigurator() external view returns (address);
/**
* @notice Updates the implementation of the PoolConfigurator, or creates a proxy
* setting the new `PoolConfigurator` implementation when the function is called for the first time.
* @param newPoolConfiguratorImpl The new PoolConfigurator implementation
*/
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
/**
* @notice Returns the address of the price oracle.
* @return The address of the PriceOracle
*/
function getPriceOracle() external view returns (address);
/**
* @notice Updates the address of the price oracle.
* @param newPriceOracle The address of the new PriceOracle
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @notice Returns the address of the ACL manager.
* @return The address of the ACLManager
*/
function getACLManager() external view returns (address);
/**
* @notice Updates the address of the ACL manager.
* @param newAclManager The address of the new ACLManager
*/
function setACLManager(address newAclManager) external;
/**
* @notice Returns the address of the ACL admin.
* @return The address of the ACL admin
*/
function getACLAdmin() external view returns (address);
/**
* @notice Updates the address of the ACL admin.
* @param newAclAdmin The address of the new ACL admin
*/
function setACLAdmin(address newAclAdmin) external;
/**
* @notice Returns the address of the price oracle sentinel.
* @return The address of the PriceOracleSentinel
*/
function getPriceOracleSentinel() external view returns (address);
/**
* @notice Updates the address of the price oracle sentinel.
* @param newPriceOracleSentinel The address of the new PriceOracleSentinel
*/
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
/**
* @notice Returns the address of the data provider.
* @return The address of the DataProvider
*/
function getPoolDataProvider() external view returns (address);
/**
* @notice Updates the address of the data provider.
* @param newDataProvider The address of the new DataProvider
*/
function setPoolDataProvider(address newDataProvider) external;
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
/**
* @title IScaledBalanceToken
* @author Aave
* @notice Defines the basic interface for a scaled-balance token.
*/
interface IScaledBalanceToken {
/**
* @dev Emitted after the mint action
* @param caller The address performing the mint
* @param onBehalfOf The address of the user that will receive the minted tokens
* @param value The scaled-up amount being minted (based on user entered amount and balance increase from interest)
* @param balanceIncrease The increase in scaled-up balance since the last action of 'onBehalfOf'
* @param index The next liquidity index of the reserve
*/
event Mint(
address indexed caller,
address indexed onBehalfOf,
uint256 value,
uint256 balanceIncrease,
uint256 index
);
/**
* @dev Emitted after the burn action
* @dev If the burn function does not involve a transfer of the underlying asset, the target defaults to zero address
* @param from The address from which the tokens will be burned
* @param target The address that will receive the underlying, if any
* @param value The scaled-up amount being burned (user entered amount - balance increase from interest)
* @param balanceIncrease The increase in scaled-up balance since the last action of 'from'
* @param index The next liquidity index of the reserve
*/
event Burn(
address indexed from,
address indexed target,
uint256 value,
uint256 balanceIncrease,
uint256 index
);
/**
* @notice Returns the scaled balance of the user.
* @dev The scaled balance is the sum of all the updated stored balance divided by the reserve's liquidity index
* at the moment of the update
* @param user The user whose balance is calculated
* @return The scaled balance of the user
*/
function scaledBalanceOf(address user) external view returns (uint256);
/**
* @notice Returns the scaled balance of the user and the scaled total supply.
* @param user The address of the user
* @return The scaled balance of the user
* @return The scaled total supply
*/
function getScaledUserBalanceAndSupply(
address user
) external view returns (uint256, uint256);
/**
* @notice Returns the scaled total supply of the scaled balance token. Represents sum(debt/index)
* @return The scaled total supply
*/
function scaledTotalSupply() external view returns (uint256);
/**
* @notice Returns last index interest was accrued to the user's balance
* @param user The address of the user
* @return The last index interest was accrued to the user's balance, expressed in ray
*/
function getPreviousIndex(address user) external view returns (uint256);
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
interface IWETH {
function deposit() external payable;
function withdraw(uint256) external;
function approve(address guy, uint256 wad) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
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: siloed borrowing enabled
//bit 63: flashloaning enabled
//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;
}
struct UserConfigurationMap {
/**
* @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
* The first bit indicates if an asset is used as collateral by the user, the second whether an
* asset is borrowed by the user.
*/
uint256 data;
}
struct EModeCategory {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
// each eMode category may or may not have a custom oracle to override the individual assets price oracles
address priceSource;
string label;
}
enum InterestRateMode {
NONE,
STABLE,
VARIABLE
}
struct ReserveCache {
uint256 currScaledVariableDebt;
uint256 nextScaledVariableDebt;
uint256 currPrincipalStableDebt;
uint256 currAvgStableBorrowRate;
uint256 currTotalStableDebt;
uint256 nextAvgStableBorrowRate;
uint256 nextTotalStableDebt;
uint256 currLiquidityIndex;
uint256 nextLiquidityIndex;
uint256 currVariableBorrowIndex;
uint256 nextVariableBorrowIndex;
uint256 currLiquidityRate;
uint256 currVariableBorrowRate;
uint256 reserveFactor;
ReserveConfigurationMap reserveConfiguration;
address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
uint40 reserveLastUpdateTimestamp;
uint40 stableDebtLastUpdateTimestamp;
}
struct ExecuteLiquidationCallParams {
uint256 reservesCount;
uint256 debtToCover;
address collateralAsset;
address debtAsset;
address user;
bool receiveAToken;
address priceOracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteSupplyParams {
address asset;
uint256 amount;
address onBehalfOf;
uint16 referralCode;
}
struct ExecuteBorrowParams {
address asset;
address user;
address onBehalfOf;
uint256 amount;
InterestRateMode interestRateMode;
uint16 referralCode;
bool releaseUnderlying;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
}
struct ExecuteRepayParams {
address asset;
uint256 amount;
InterestRateMode interestRateMode;
address onBehalfOf;
bool useATokens;
}
struct ExecuteWithdrawParams {
address asset;
uint256 amount;
address to;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteSetUserEModeParams {
uint256 reservesCount;
address oracle;
uint8 categoryId;
}
struct FinalizeTransferParams {
address asset;
address from;
address to;
uint256 amount;
uint256 balanceFromBefore;
uint256 balanceToBefore;
uint256 reservesCount;
address oracle;
uint8 fromEModeCategory;
}
struct FlashloanParams {
address receiverAddress;
address[] assets;
uint256[] amounts;
uint256[] interestRateModes;
address onBehalfOf;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address addressesProvider;
uint8 userEModeCategory;
bool isAuthorizedFlashBorrower;
}
struct FlashloanSimpleParams {
address receiverAddress;
address asset;
uint256 amount;
bytes params;
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
}
struct FlashLoanRepaymentParams {
uint256 amount;
uint256 totalPremium;
uint256 flashLoanPremiumToProtocol;
address asset;
address receiverAddress;
uint16 referralCode;
}
struct CalculateUserAccountDataParams {
UserConfigurationMap userConfig;
uint256 reservesCount;
address user;
address oracle;
uint8 userEModeCategory;
}
struct ValidateBorrowParams {
ReserveCache reserveCache;
UserConfigurationMap userConfig;
address asset;
address userAddress;
uint256 amount;
InterestRateMode interestRateMode;
uint256 maxStableLoanPercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
address priceOracleSentinel;
bool isolationModeActive;
address isolationModeCollateralAddress;
uint256 isolationModeDebtCeiling;
}
struct ValidateLiquidationCallParams {
ReserveCache debtReserveCache;
uint256 totalDebt;
uint256 healthFactor;
address priceOracleSentinel;
}
struct CalculateInterestRatesParams {
uint256 unbacked;
uint256 liquidityAdded;
uint256 liquidityTaken;
uint256 totalStableDebt;
uint256 totalVariableDebt;
uint256 averageStableBorrowRate;
uint256 reserveFactor;
address reserve;
address aToken;
}
struct InitReserveParams {
address asset;
address aTokenAddress;
address stableDebtAddress;
address variableDebtAddress;
address interestRateStrategyAddress;
uint16 reservesCount;
uint16 maxNumberReserves;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external view returns (address);
function WETH() external view returns (address);
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 addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
)
external
payable
returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint[] memory amounts);
function swapTokensForExactETH(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactTokensForETH(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapETHForExactTokens(
uint amountOut,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint[] memory amounts);
function quote(
uint amountA,
uint reserveA,
uint reserveB
) external pure returns (uint amountB);
function getAmountOut(
uint amountIn,
uint reserveIn,
uint reserveOut
) external pure returns (uint amountOut);
function getAmountIn(
uint amountOut,
uint reserveIn,
uint reserveOut
) external pure returns (uint amountIn);
function getAmountsOut(
uint amountIn,
address[] calldata path
) external view returns (uint[] memory amounts);
function getAmountsIn(
uint amountOut,
address[] calldata path
) external view returns (uint[] memory amounts);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.6.2;
import "./IUniswapV2Router01.sol";
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
enum YieldMode {
AUTOMATIC,
VOID,
CLAIMABLE
}
enum GasMode {
VOID,
CLAIMABLE
}
interface IBlast {
// configure
function configureContract(
address contractAddress,
YieldMode _yield,
GasMode gasMode,
address governor
) external;
function configure(
YieldMode _yield,
GasMode gasMode,
address governor
) external;
// base configuration options
function configureClaimableYield() external;
function configureClaimableYieldOnBehalf(address contractAddress) external;
function configureAutomaticYield() external;
function configureAutomaticYieldOnBehalf(address contractAddress) external;
function configureVoidYield() external;
function configureVoidYieldOnBehalf(address contractAddress) external;
function configureClaimableGas() external;
function configureClaimableGasOnBehalf(address contractAddress) external;
function configureVoidGas() external;
function configureVoidGasOnBehalf(address contractAddress) external;
function configureGovernor(address _governor) external;
function configureGovernorOnBehalf(
address _newGovernor,
address contractAddress
) external;
// claim yield
function claimYield(
address contractAddress,
address recipientOfYield,
uint256 amount
) external returns (uint256);
function claimAllYield(
address contractAddress,
address recipientOfYield
) external returns (uint256);
// claim gas
function claimAllGas(
address contractAddress,
address recipientOfGas
) external returns (uint256);
function claimGasAtMinClaimRate(
address contractAddress,
address recipientOfGas,
uint256 minClaimRateBips
) external returns (uint256);
function claimMaxGas(
address contractAddress,
address recipientOfGas
) external returns (uint256);
function claimGas(
address contractAddress,
address recipientOfGas,
uint256 gasToClaim,
uint256 gasSecondsToConsume
) external returns (uint256);
// read functions
function readClaimableYield(
address contractAddress
) external view returns (uint256);
function readYieldConfiguration(
address contractAddress
) external view returns (uint8);
function readGasParams(
address contractAddress
)
external
view
returns (
uint256 etherSeconds,
uint256 etherBalance,
uint256 lastUpdated,
GasMode
);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
interface IGasRefund {
enum RefundType {
SUPPLY,
WITHDRAW,
BORROW,
REPAY,
LEVERAGEDEPOSIT,
MULTIPLIERDEPOSIT
}
function addGasRefund(
address user,
uint256 amount,
RefundType refundType
) external;
}// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
import {IERC20} from "../../../core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol";
import {DataTypes} from "../../../core-v3/contracts/protocol/libraries/types/DataTypes.sol";
/**
* @title DataTypesHelper
* @author Aave
* @dev Helper library to track user current debt balance, used by WrappedTokenGatewayV3
*/
library DataTypesHelper {
/**
* @notice Fetches the user current stable and variable debt balances
* @param user The user address
* @param reserve The reserve data object
* @return The stable debt balance
* @return The variable debt balance
**/
function getUserCurrentDebt(
address user,
DataTypes.ReserveData memory reserve
) internal view returns (uint256, uint256) {
return (
IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
);
}
}{
"optimizer": {
"enabled": true,
"runs": 100000
},
"evmVersion": "berlin",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_lendingPool","type":"address"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"FeatureNotActive","type":"error"},{"inputs":[],"name":"InvalidFlashLoan","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"InvalidParam","type":"error"},{"inputs":[],"name":"ReceiveNotAllowed","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"cashAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"LeverageDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"cashAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"depositAsset","type":"address"}],"name":"MultiplierDeposit","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":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RescueToken","type":"event"},{"inputs":[],"name":"ADDRESSES_PROVIDER","outputs":[{"internalType":"contract IPoolAddressesProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOL","outputs":[{"internalType":"contract IPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"interestRateMode","type":"uint256"}],"name":"borrowERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"interestRateMode","type":"uint256"}],"name":"borrowETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"claimRefundedGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"onBehalfOf","type":"address"}],"name":"depositETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"address","name":"initiator","type":"address"},{"internalType":"bytes","name":"params","type":"bytes"}],"name":"executeOperation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gasRefund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"cashAmount","type":"uint256"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"leverageDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"cashAmount","type":"uint256"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"internalType":"address","name":"depositAsset","type":"address"},{"internalType":"uint256","name":"minDepositAmount","type":"uint256"},{"internalType":"address[]","name":"swapPath","type":"address[]"}],"name":"multiplierDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"interestRateMode","type":"uint256"},{"internalType":"address","name":"onBehalfOf","type":"address"}],"name":"repayERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rateMode","type":"uint256"},{"internalType":"address","name":"onBehalfOf","type":"address"}],"name":"repayETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gasRefund","type":"address"}],"name":"setGasRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_swapRouter","type":"address"}],"name":"setSwapRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"onBehalfOf","type":"address"}],"name":"supplyERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapRouter","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60c06040523480156200001157600080fd5b506040516200453638038062004536833981016040819052620000349162000260565b6200003f33620001f3565b600180556001600160a01b0382166200006b57604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b0381166200009357604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b03828116608081905290821660a081905260405163095ea7b360e01b8152600481019290925260001960248301529063095ea7b3906044016020604051808303816000875af1158015620000f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000118919062000298565b5060006080516001600160a01b03166397d757766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200015c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001829190620002c3565b90506001600160a01b03811615620001ea57806001600160a01b0316634e606c476040518163ffffffff1660e01b8152600401600060405180830381600087803b158015620001d057600080fd5b505af1158015620001e5573d6000803e3d6000fd5b505050505b505050620002e1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200025b57600080fd5b919050565b600080604083850312156200027457600080fd5b6200027f8362000243565b91506200028f6020840162000243565b90509250929050565b600060208284031215620002ab57600080fd5b81518015158114620002bc57600080fd5b9392505050565b600060208284031215620002d657600080fd5b620002bc8262000243565b60805160a05161411062000426600039600081816101a10152818161041a01528181610f3601528181610fb7015281816113b70152818161147601528181611580015281816117be015281816118ae01528181611cdb01528181611dc001528181611eef01528181611f700152818161274601528181612880015261293f0152600081816103a8015281816105200152818161062001528181610730015281816107bb015281816108540152818161091201528181610a0901528181610bdf01528181610c0501528181610d0401528181610de10152818161115701528181611266015281816114b6015281816115ab015281816117f6015281816119d601528181611c0301528181611d210152818161207f015281816121de015281816122630152818161237a015281816124ec01528181612779015261297f01526141106000f3fe6080604052600436106101845760003560e01c8063715018a6116100d6578063c31c9c071161007f578063e5711e8b11610059578063e5711e8b146104c9578063f2fde38b146104e9578063f538ba511461050957600080fd5b8063c31c9c071461045c578063c44a7be914610489578063d4ac1926146104a957600080fd5b8063a7fb3509116100b0578063a7fb3509146103f5578063ad5c464814610408578063b9739e871461043c57600080fd5b8063715018a6146103815780637535d246146103965780638da5cb5b146103ca57600080fd5b80632d2da806116101385780635bc758e2116101125780635bc758e2146103145780635fc3ea0b146103415780636fab3b731461036157600080fd5b80632d2da806146102c157806336118b52146102d457806341273657146102f457600080fd5b80631b11d0ff116101695780631b11d0ff1461025e5780631c95d9331461028e5780632cca1cdf146102a157600080fd5b80630542975c146101ff5780631a2467a51461023e57600080fd5b366101fa573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101f8576040517fcb263c3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b600080fd5b34801561020b57600080fd5b5061021461051c565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561024a57600080fd5b506101f8610259366004613526565b6105b2565b34801561026a57600080fd5b5061027e61027936600461355b565b6106c8565b6040519015158152602001610235565b6101f861029c366004613605565b610e23565b3480156102ad57600080fd5b506101f86102bc3660046136bd565b61125a565b6101f86102cf3660046136bd565b6113ad565b3480156102e057600080fd5b506101f86102ef3660046136e1565b61153b565b34801561030057600080fd5b506101f861030f3660046136bd565b611937565b34801561032057600080fd5b506003546102149073ffffffffffffffffffffffffffffffffffffffff1681565b34801561034d57600080fd5b506101f861035c366004613711565b611986565b34801561036d57600080fd5b506101f861037c366004613753565b611c93565b34801561038d57600080fd5b506101f8611e46565b3480156103a257600080fd5b506102147f000000000000000000000000000000000000000000000000000000000000000081565b3480156103d657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610214565b6101f8610403366004613526565b611e5a565b34801561041457600080fd5b506102147f000000000000000000000000000000000000000000000000000000000000000081565b34801561044857600080fd5b506101f8610457366004613711565b612171565b34801561046857600080fd5b506002546102149073ffffffffffffffffffffffffffffffffffffffff1681565b34801561049557600080fd5b506101f86104a43660046136bd565b6122d3565b3480156104b557600080fd5b506101f86104c4366004613775565b612322565b3480156104d557600080fd5b506101f86104e43660046137bf565b612589565b3480156104f557600080fd5b506101f86105043660046136bd565b612648565b6101f8610517366004613800565b612701565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630542975c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ad919061382e565b905090565b6105ba612a1c565b60005a6040517fa415bcad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820186905260448201859052600060648301523360848301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063a415bcad9060a401600060405180830381600087803b15801561066657600080fd5b505af115801561067a573d6000803e3d6000fd5b5050505060005a9050610697610690828461387a565b6002612a90565b6106b873ffffffffffffffffffffffffffffffffffffffff86163386612b43565b50506106c360018055565b505050565b6000806106d7838501856138a5565b905060008160018111156106ed576106ed6138c0565b141561097e5760008080610704866020818a6138ef565b8101906107119190613526565b919450925090503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016141580610773575073ffffffffffffffffffffffffffffffffffffffff88163014155b8061077e5750898114155b156107b5576040517fbafe1c5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107df8b7f0000000000000000000000000000000000000000000000000000000000000000612c17565b6000896107ec8385613919565b6107f6919061387a565b6040517f617ba03700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e81166004830152602482018390528681166044830152600060648301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063617ba03790608401600060405180830381600087803b15801561089a57600080fd5b505af11580156108ae573d6000803e3d6000fd5b50506040517fa415bcad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8f8116600483015260248201869052600260448301526000606483015287811660848301527f000000000000000000000000000000000000000000000000000000000000000016925063a415bcad915060a401600060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b50505050600195505050505050610e19565b6001816001811115610992576109926138c0565b1415610e13576109e06040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001606081525090565b6109ec84860186613a20565b90925090503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016141580610a4c575073ffffffffffffffffffffffffffffffffffffffff86163014155b80610a5b575087816040015114155b15610a92576040517fbafe1c5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600254610ab6908a9073ffffffffffffffffffffffffffffffffffffffff16612c17565b60008782604001518360200151610acd9190613919565b610ad7919061387a565b600254606084015160808501516040517f38ed173900000000000000000000000000000000000000000000000000000000815293945060009373ffffffffffffffffffffffffffffffffffffffff909316926338ed173992610b4192879230904290600401613b37565b6000604051808303816000875af1158015610b60573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610ba69190810190613bc2565b60808401518051919250600091610bbf9060019061387a565b81518110610bcf57610bcf613c48565b60200260200101519050610c03817f0000000000000000000000000000000000000000000000000000000000000000612c17565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663617ba037828460018651610c4f919061387a565b81518110610c5f57610c5f613c48565b602090810291909101015187516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff9384166004820152602481019290925291909116604482015260006064820152608401600060405180830381600087803b158015610cea57600080fd5b505af1158015610cfe573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a415bcad8d86604001516002600089600001516040518663ffffffff1660e01b8152600401610da995949392919073ffffffffffffffffffffffffffffffffffffffff95861681526020810194909452604084019290925261ffff166060830152909116608082015260a00190565b600060405180830381600087803b158015610dc357600080fd5b505af1158015610dd7573d6000803e3d6000fd5b50505050610e058c7f0000000000000000000000000000000000000000000000000000000000000000612c17565b600195505050505050610e19565b60009150505b9695505050505050565b610e2b612a1c565b60025473ffffffffffffffffffffffffffffffffffffffff16610e7a576040517ff3f0984900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610ee0576040517fd252903400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716610fdd57348614610f34576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f9c57600080fd5b505af1158015610fb0573d6000803e3d6000fd5b50505050507f0000000000000000000000000000000000000000000000000000000000000000965061103d565b3415611015576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b851561103d5761103d73ffffffffffffffffffffffffffffffffffffffff8816333089612cf2565b6110856040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001606081525090565b3381526020808201889052604080830188905260608301869052805184830281810184019092528481529185918591829190850190849080828437600092018290525060808601949094525050505a905060006001836040516020016110ec929190613c8b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f42b0b77c000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906342b0b77c906111959030908e908d908790600090600401613da6565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b5050505060005a90506111e06111d9828561387a565b6005612a90565b6040805133815273ffffffffffffffffffffffffffffffffffffffff8d811660208301528183018d9052606082018c90528a16608082015290517f557ed241a95c9fc974f8ca0089a9ff212637a88579332793e60c15364dff525c9181900360a00190a15050505061125160018055565b50505050505050565b611262612d50565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166397d757766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f3919061382e565b905073ffffffffffffffffffffffffffffffffffffffff8116156113a9576040517f662aa11d00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015282169063662aa11d906044016020604051808303816000875af1158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190613e06565b5050565b6113b5612a1c565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561141d57600080fd5b505af1158015611431573d6000803e3d6000fd5b505050505060005a6040517fe8eda9df00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301523460248301528481166044830152600060648301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063e8eda9df90608401600060405180830381600087803b1580156114fc57600080fd5b505af1158015611510573d6000803e3d6000fd5b5050505060005a905061152d611526828461387a565b6000612a90565b505061153860018055565b50565b611543612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906335ea6a75906024016101e060405180830381865afa1580156115f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116199190613ea8565b61010001516040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa15801561168e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b29190613e06565b9050837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114156116e05750805b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810182905273ffffffffffffffffffffffffffffffffffffffff8416906323b872dd906064016020604051808303816000875af1158015611759573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177d9190613fcb565b5060005a6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018590523060448301529192507f0000000000000000000000000000000000000000000000000000000000000000909116906369328dec906064016020604051808303816000875af1158015611841573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118659190613e06565b5060005a905061187f611878828461387a565b6001612a90565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561190757600080fd5b505af115801561191b573d6000803e3d6000fd5b505050506119298684612dd1565b50505050506113a960018055565b61193f612d50565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61198e612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906335ea6a75906024016101e060405180830381865afa158015611a20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a449190613ea8565b61010001516040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611ab9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611add9190613e06565b9050837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811415611b0b5750805b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810182905273ffffffffffffffffffffffffffffffffffffffff8416906323b872dd906064016020604051808303816000875af1158015611b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba89190613fcb565b5060005a6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301526024820185905287811660448301529192507f0000000000000000000000000000000000000000000000000000000000000000909116906369328dec906064016020604051808303816000875af1158015611c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c729190613e06565b5060005a9050611c85611878828461387a565b50505050506106c360018055565b611c9b612a1c565b60005a6040517fa415bcad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820186905260448201859052600060648301523360848301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063a415bcad9060a401600060405180830381600087803b158015611d6757600080fd5b505af1158015611d7b573d6000803e3d6000fd5b5050505060005a9050611d91610690828461387a565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018590527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015611e1957600080fd5b505af1158015611e2d573d6000803e3d6000fd5b50505050611e3b3385612dd1565b50506113a960018055565b611e4e612d50565b611e586000612eb5565b565b611e62612a1c565b80611e99576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611f9657348214611eed576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015611f5557600080fd5b505af1158015611f69573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000009250611ff6565b3415611fce576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8115611ff657611ff673ffffffffffffffffffffffffffffffffffffffff8416333085612cf2565b60005a90506000803385856040516020016120149493929190613fed565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f42b0b77c000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906342b0b77c906120bd903090899088908790600090600401613da6565b600060405180830381600087803b1580156120d757600080fd5b505af11580156120eb573d6000803e3d6000fd5b5050505060005a9050612108612101828561387a565b6004612a90565b6040805133815273ffffffffffffffffffffffffffffffffffffffff88166020820152908101869052606081018590527f3844eeb24e2d31fa648194b139814a3630ef83d96c0f20200dd364ae344a62609060800160405180910390a15050506106c360018055565b612179612a1c565b816121b0576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81156121d8576121d873ffffffffffffffffffffffffffffffffffffffff8416333085612cf2565b612202837f0000000000000000000000000000000000000000000000000000000000000000612c17565b60005a6040517f617ba03700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152602482018690528481166044830152600060648301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063617ba03790608401600060405180830381600087803b1580156122a957600080fd5b505af11580156122bd573d6000803e3d6000fd5b5050505060005a90506106b8611526828461387a565b6122db612d50565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61232a612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015260009182916123ec9185917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a75906024015b6101e060405180830381865afa1580156123c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e79190613ea8565b612f2a565b909250905060006001856002811115612407576124076138c0565b6002811115612418576124186138c0565b146124235781612425565b825b9050808610156124325750845b80612469576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61248b73ffffffffffffffffffffffffffffffffffffffff8816333084612cf2565b60005a6040517f573ade8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152602482018590526044820189905287811660648301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063573ade81906084016020604051808303816000875af1158015612537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255b9190613e06565b5060005a905061257561256e828461387a565b6003612a90565b505050505061258360018055565b50505050565b612591612d50565b73ffffffffffffffffffffffffffffffffffffffff83166125bb576125b68282612dd1565b6125dc565b6125dc73ffffffffffffffffffffffffffffffffffffffff84168383612b43565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba9108360405161263b91815260200190565b60405180910390a3505050565b612650612d50565b73ffffffffffffffffffffffffffffffffffffffff81166126f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61153881612eb5565b612709612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116600483015260009182916127a89185917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a75906024016123a5565b9092509050600060018560028111156127c3576127c36138c0565b60028111156127d4576127d46138c0565b146127df57816127e1565b825b9050808610156127ee5750845b8034101561287e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f6d73672e76616c7565206973206c657373207468616e2072657061796d656e7460448201527f20616d6f756e740000000000000000000000000000000000000000000000000060648201526084016126ef565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156128e657600080fd5b505af11580156128fa573d6000803e3d6000fd5b505050505060005a6040517f573ade8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301523460248301526044820189905287811660648301529192507f00000000000000000000000000000000000000000000000000000000000000009091169063573ade81906084016020604051808303816000875af11580156129ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ee9190613e06565b5060005a9050612a0161256e828461387a565b82341115611c8557611c8533612a17853461387a565b612dd1565b60026001541415612a89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016126ef565b6002600155565b60035473ffffffffffffffffffffffffffffffffffffffff16156113a9576000612aba3a8461402c565b6003546040517fcff29e6700000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff169063cff29e6790612b1590339085908790600401614069565b600060405180830381600087803b158015612b2f57600080fd5b505af1158015611251573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526106c39084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613067565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff828116602483015283169063dd62ed3e90604401602060405180830381865afa158015612c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cad9190613e06565b6113a9576113a973ffffffffffffffffffffffffffffffffffffffff8316827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613176565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526125839085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612b95565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016126ef565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051612e0891906140ab565b60006040518083038185875af1925050503d8060008114612e45576040519150601f19603f3d011682016040523d82523d6000602084013e612e4a565b606091505b50509050806106c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016126ef565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6101208101516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015260009283929116906370a0823190602401602060405180830381865afa158015612fa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc59190613e06565b6101408401516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152909116906370a0823190602401602060405180830381865afa158015613038573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061305c9190613e06565b915091509250929050565b60006130c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166132f89092919063ffffffff16565b90508051600014806130ea5750808060200190518101906130ea9190613fcb565b6106c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016126ef565b80158061321657506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156131f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132149190613e06565b155b6132a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016126ef565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526106c39084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401612b95565b6060613307848460008561330f565b949350505050565b6060824710156133a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016126ef565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133ca91906140ab565b60006040518083038185875af1925050503d8060008114613407576040519150601f19603f3d011682016040523d82523d6000602084013e61340c565b606091505b509150915061341d87838387613428565b979650505050505050565b606083156134bb5782516134b45773ffffffffffffffffffffffffffffffffffffffff85163b6134b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016126ef565b5081613307565b61330783838151156134d05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ef91906140c7565b73ffffffffffffffffffffffffffffffffffffffff8116811461153857600080fd5b60008060006060848603121561353b57600080fd5b833561354681613504565b95602085013595506040909401359392505050565b60008060008060008060a0878903121561357457600080fd5b863561357f81613504565b95506020870135945060408701359350606087013561359d81613504565b9250608087013567ffffffffffffffff808211156135ba57600080fd5b818901915089601f8301126135ce57600080fd5b8135818111156135dd57600080fd5b8a60208285010111156135ef57600080fd5b6020830194508093505050509295509295509295565b600080600080600080600060c0888a03121561362057600080fd5b873561362b81613504565b96506020880135955060408801359450606088013561364981613504565b93506080880135925060a088013567ffffffffffffffff8082111561366d57600080fd5b818a0191508a601f83011261368157600080fd5b81358181111561369057600080fd5b8b60208260051b85010111156136a557600080fd5b60208301945080935050505092959891949750929550565b6000602082840312156136cf57600080fd5b81356136da81613504565b9392505050565b600080604083850312156136f457600080fd5b82359150602083013561370681613504565b809150509250929050565b60008060006060848603121561372657600080fd5b833561373181613504565b925060208401359150604084013561374881613504565b809150509250925092565b6000806040838503121561376657600080fd5b50508035926020909101359150565b6000806000806080858703121561378b57600080fd5b843561379681613504565b9350602085013592506040850135915060608501356137b481613504565b939692955090935050565b6000806000606084860312156137d457600080fd5b83356137df81613504565b925060208401356137ef81613504565b929592945050506040919091013590565b60008060006060848603121561381557600080fd5b8335925060208401359150604084013561374881613504565b60006020828403121561384057600080fd5b81516136da81613504565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561388c5761388c61384b565b500390565b8035600281106138a057600080fd5b919050565b6000602082840312156138b757600080fd5b6136da82613891565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600080858511156138ff57600080fd5b8386111561390c57600080fd5b5050820193919092039150565b6000821982111561392c5761392c61384b565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561398357613983613931565b60405290565b6040516101e0810167ffffffffffffffff8111828210171561398357613983613931565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156139f4576139f4613931565b604052919050565b600067ffffffffffffffff821115613a1657613a16613931565b5060051b60200190565b60008060408385031215613a3357600080fd5b613a3c83613891565b915060208084013567ffffffffffffffff80821115613a5a57600080fd5b9085019060a08288031215613a6e57600080fd5b613a76613960565b8235613a8181613504565b8082525083830135848201526040830135604082015260608301356060820152608083013582811115613ab357600080fd5b80840193505087601f840112613ac857600080fd5b82359150613add613ad8836139fc565b6139ad565b82815260059290921b83018401918481019089841115613afc57600080fd5b938501935b83851015613b23578435613b1481613504565b82529385019390850190613b01565b608083015250949794965093945050505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015613b9457845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101613b62565b505073ffffffffffffffffffffffffffffffffffffffff969096166060850152505050608001529392505050565b60006020808385031215613bd557600080fd5b825167ffffffffffffffff811115613bec57600080fd5b8301601f81018513613bfd57600080fd5b8051613c0b613ad8826139fc565b81815260059190911b82018301908381019087831115613c2a57600080fd5b928401925b8284101561341d57835182529284019290840190613c2f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60028110613c8757613c876138c0565b9052565b613c958184613c77565b6000602060408184015260e0830173ffffffffffffffffffffffffffffffffffffffff80865116604086015282860151606086015260408601516080860152606086015160a0860152608086015160a060c0870152828151808552610100880191508583019450600092505b80831015613d2357845184168252938501936001929092019190850190613d01565b5098975050505050505050565b60005b83811015613d4b578181015183820152602001613d33565b838111156125835750506000910152565b60008151808452613d74816020860160208601613d30565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525084604083015260a06060830152613de560a0830185613d5c565b905061ffff831660808301529695505050505050565b80516138a081613504565b600060208284031215613e1857600080fd5b5051919050565b600060208284031215613e3157600080fd5b6040516020810181811067ffffffffffffffff82111715613e5457613e54613931565b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff811681146138a057600080fd5b805164ffffffffff811681146138a057600080fd5b805161ffff811681146138a057600080fd5b60006101e08284031215613ebb57600080fd5b613ec3613989565b613ecd8484613e1f565b8152613edb60208401613e61565b6020820152613eec60408401613e61565b6040820152613efd60608401613e61565b6060820152613f0e60808401613e61565b6080820152613f1f60a08401613e61565b60a0820152613f3060c08401613e81565b60c0820152613f4160e08401613e96565b60e0820152610100613f54818501613dfb565b90820152610120613f66848201613dfb565b90820152610140613f78848201613dfb565b90820152610160613f8a848201613dfb565b90820152610180613f9c848201613e61565b908201526101a0613fae848201613e61565b908201526101c0613fc0848201613e61565b908201529392505050565b600060208284031215613fdd57600080fd5b815180151581146136da57600080fd5b60808101613ffb8287613c77565b73ffffffffffffffffffffffffffffffffffffffff8516602083015283604083015282606083015295945050505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156140645761406461384b565b500290565b73ffffffffffffffffffffffffffffffffffffffff8416815260208101839052606081016006831061409d5761409d6138c0565b826040830152949350505050565b600082516140bd818460208701613d30565b9190910192915050565b6020815260006136da6020830184613d5c56fea2646970667358221220cd410000fc111763ce4e0d83f2c66dc239d592df1a1125327dab6df1a1e00f8864736f6c634300080a0033000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa80000000000000000000000004300000000000000000000000000000000000004
Deployed Bytecode
0x6080604052600436106101845760003560e01c8063715018a6116100d6578063c31c9c071161007f578063e5711e8b11610059578063e5711e8b146104c9578063f2fde38b146104e9578063f538ba511461050957600080fd5b8063c31c9c071461045c578063c44a7be914610489578063d4ac1926146104a957600080fd5b8063a7fb3509116100b0578063a7fb3509146103f5578063ad5c464814610408578063b9739e871461043c57600080fd5b8063715018a6146103815780637535d246146103965780638da5cb5b146103ca57600080fd5b80632d2da806116101385780635bc758e2116101125780635bc758e2146103145780635fc3ea0b146103415780636fab3b731461036157600080fd5b80632d2da806146102c157806336118b52146102d457806341273657146102f457600080fd5b80631b11d0ff116101695780631b11d0ff1461025e5780631c95d9331461028e5780632cca1cdf146102a157600080fd5b80630542975c146101ff5780631a2467a51461023e57600080fd5b366101fa573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000430000000000000000000000000000000000000416146101f8576040517fcb263c3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b600080fd5b34801561020b57600080fd5b5061021461051c565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561024a57600080fd5b506101f8610259366004613526565b6105b2565b34801561026a57600080fd5b5061027e61027936600461355b565b6106c8565b6040519015158152602001610235565b6101f861029c366004613605565b610e23565b3480156102ad57600080fd5b506101f86102bc3660046136bd565b61125a565b6101f86102cf3660046136bd565b6113ad565b3480156102e057600080fd5b506101f86102ef3660046136e1565b61153b565b34801561030057600080fd5b506101f861030f3660046136bd565b611937565b34801561032057600080fd5b506003546102149073ffffffffffffffffffffffffffffffffffffffff1681565b34801561034d57600080fd5b506101f861035c366004613711565b611986565b34801561036d57600080fd5b506101f861037c366004613753565b611c93565b34801561038d57600080fd5b506101f8611e46565b3480156103a257600080fd5b506102147f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa881565b3480156103d657600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610214565b6101f8610403366004613526565b611e5a565b34801561041457600080fd5b506102147f000000000000000000000000430000000000000000000000000000000000000481565b34801561044857600080fd5b506101f8610457366004613711565b612171565b34801561046857600080fd5b506002546102149073ffffffffffffffffffffffffffffffffffffffff1681565b34801561049557600080fd5b506101f86104a43660046136bd565b6122d3565b3480156104b557600080fd5b506101f86104c4366004613775565b612322565b3480156104d557600080fd5b506101f86104e43660046137bf565b612589565b3480156104f557600080fd5b506101f86105043660046136bd565b612648565b6101f8610517366004613800565b612701565b60007f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa873ffffffffffffffffffffffffffffffffffffffff16630542975c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ad919061382e565b905090565b6105ba612a1c565b60005a6040517fa415bcad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526024820186905260448201859052600060648301523360848301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063a415bcad9060a401600060405180830381600087803b15801561066657600080fd5b505af115801561067a573d6000803e3d6000fd5b5050505060005a9050610697610690828461387a565b6002612a90565b6106b873ffffffffffffffffffffffffffffffffffffffff86163386612b43565b50506106c360018055565b505050565b6000806106d7838501856138a5565b905060008160018111156106ed576106ed6138c0565b141561097e5760008080610704866020818a6138ef565b8101906107119190613526565b919450925090503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816141580610773575073ffffffffffffffffffffffffffffffffffffffff88163014155b8061077e5750898114155b156107b5576040517fbafe1c5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107df8b7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8612c17565b6000896107ec8385613919565b6107f6919061387a565b6040517f617ba03700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e81166004830152602482018390528681166044830152600060648301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063617ba03790608401600060405180830381600087803b15801561089a57600080fd5b505af11580156108ae573d6000803e3d6000fd5b50506040517fa415bcad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8f8116600483015260248201869052600260448301526000606483015287811660848301527f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816925063a415bcad915060a401600060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b50505050600195505050505050610e19565b6001816001811115610992576109926138c0565b1415610e13576109e06040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001606081525090565b6109ec84860186613a20565b90925090503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816141580610a4c575073ffffffffffffffffffffffffffffffffffffffff86163014155b80610a5b575087816040015114155b15610a92576040517fbafe1c5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600254610ab6908a9073ffffffffffffffffffffffffffffffffffffffff16612c17565b60008782604001518360200151610acd9190613919565b610ad7919061387a565b600254606084015160808501516040517f38ed173900000000000000000000000000000000000000000000000000000000815293945060009373ffffffffffffffffffffffffffffffffffffffff909316926338ed173992610b4192879230904290600401613b37565b6000604051808303816000875af1158015610b60573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610ba69190810190613bc2565b60808401518051919250600091610bbf9060019061387a565b81518110610bcf57610bcf613c48565b60200260200101519050610c03817f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8612c17565b7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa873ffffffffffffffffffffffffffffffffffffffff1663617ba037828460018651610c4f919061387a565b81518110610c5f57610c5f613c48565b602090810291909101015187516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff9384166004820152602481019290925291909116604482015260006064820152608401600060405180830381600087803b158015610cea57600080fd5b505af1158015610cfe573d6000803e3d6000fd5b505050507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa873ffffffffffffffffffffffffffffffffffffffff1663a415bcad8d86604001516002600089600001516040518663ffffffff1660e01b8152600401610da995949392919073ffffffffffffffffffffffffffffffffffffffff95861681526020810194909452604084019290925261ffff166060830152909116608082015260a00190565b600060405180830381600087803b158015610dc357600080fd5b505af1158015610dd7573d6000803e3d6000fd5b50505050610e058c7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8612c17565b600195505050505050610e19565b60009150505b9695505050505050565b610e2b612a1c565b60025473ffffffffffffffffffffffffffffffffffffffff16610e7a576040517ff3f0984900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610ee0576040517fd252903400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716610fdd57348614610f34576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015610f9c57600080fd5b505af1158015610fb0573d6000803e3d6000fd5b50505050507f0000000000000000000000004300000000000000000000000000000000000004965061103d565b3415611015576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b851561103d5761103d73ffffffffffffffffffffffffffffffffffffffff8816333089612cf2565b6110856040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001606081525090565b3381526020808201889052604080830188905260608301869052805184830281810184019092528481529185918591829190850190849080828437600092018290525060808601949094525050505a905060006001836040516020016110ec929190613c8b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f42b0b77c000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816906342b0b77c906111959030908e908d908790600090600401613da6565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b5050505060005a90506111e06111d9828561387a565b6005612a90565b6040805133815273ffffffffffffffffffffffffffffffffffffffff8d811660208301528183018d9052606082018c90528a16608082015290517f557ed241a95c9fc974f8ca0089a9ff212637a88579332793e60c15364dff525c9181900360a00190a15050505061125160018055565b50505050505050565b611262612d50565b60007f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa873ffffffffffffffffffffffffffffffffffffffff166397d757766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f3919061382e565b905073ffffffffffffffffffffffffffffffffffffffff8116156113a9576040517f662aa11d00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015282169063662aa11d906044016020604051808303816000875af1158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c39190613e06565b5050565b6113b5612a1c565b7f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561141d57600080fd5b505af1158015611431573d6000803e3d6000fd5b505050505060005a6040517fe8eda9df00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004300000000000000000000000000000000000004811660048301523460248301528481166044830152600060648301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063e8eda9df90608401600060405180830381600087803b1580156114fc57600080fd5b505af1158015611510573d6000803e3d6000fd5b5050505060005a905061152d611526828461387a565b6000612a90565b505061153860018055565b50565b611543612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004300000000000000000000000000000000000004811660048301526000917f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8909116906335ea6a75906024016101e060405180830381865afa1580156115f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116199190613ea8565b61010001516040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa15801561168e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b29190613e06565b9050837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114156116e05750805b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810182905273ffffffffffffffffffffffffffffffffffffffff8416906323b872dd906064016020604051808303816000875af1158015611759573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177d9190613fcb565b5060005a6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000430000000000000000000000000000000000000481166004830152602482018590523060448301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8909116906369328dec906064016020604051808303816000875af1158015611841573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118659190613e06565b5060005a905061187f611878828461387a565b6001612a90565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490527f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b15801561190757600080fd5b505af115801561191b573d6000803e3d6000fd5b505050506119298684612dd1565b50505050506113a960018055565b61193f612d50565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61198e612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301526000917f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8909116906335ea6a75906024016101e060405180830381865afa158015611a20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a449190613ea8565b61010001516040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611ab9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611add9190613e06565b9050837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811415611b0b5750805b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810182905273ffffffffffffffffffffffffffffffffffffffff8416906323b872dd906064016020604051808303816000875af1158015611b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba89190613fcb565b5060005a6040517f69328dec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301526024820185905287811660448301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8909116906369328dec906064016020604051808303816000875af1158015611c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c729190613e06565b5060005a9050611c85611878828461387a565b50505050506106c360018055565b611c9b612a1c565b60005a6040517fa415bcad00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004300000000000000000000000000000000000004811660048301526024820186905260448201859052600060648301523360848301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063a415bcad9060a401600060405180830381600087803b158015611d6757600080fd5b505af1158015611d7b573d6000803e3d6000fd5b5050505060005a9050611d91610690828461387a565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018590527f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1690632e1a7d4d90602401600060405180830381600087803b158015611e1957600080fd5b505af1158015611e2d573d6000803e3d6000fd5b50505050611e3b3385612dd1565b50506113a960018055565b611e4e612d50565b611e586000612eb5565b565b611e62612a1c565b80611e99576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611f9657348214611eed576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015611f5557600080fd5b505af1158015611f69573d6000803e3d6000fd5b50505050507f00000000000000000000000043000000000000000000000000000000000000049250611ff6565b3415611fce576040517f1841b4e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8115611ff657611ff673ffffffffffffffffffffffffffffffffffffffff8416333085612cf2565b60005a90506000803385856040516020016120149493929190613fed565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f42b0b77c000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816906342b0b77c906120bd903090899088908790600090600401613da6565b600060405180830381600087803b1580156120d757600080fd5b505af11580156120eb573d6000803e3d6000fd5b5050505060005a9050612108612101828561387a565b6004612a90565b6040805133815273ffffffffffffffffffffffffffffffffffffffff88166020820152908101869052606081018590527f3844eeb24e2d31fa648194b139814a3630ef83d96c0f20200dd364ae344a62609060800160405180910390a15050506106c360018055565b612179612a1c565b816121b0576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81156121d8576121d873ffffffffffffffffffffffffffffffffffffffff8416333085612cf2565b612202837f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8612c17565b60005a6040517f617ba03700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152602482018690528481166044830152600060648301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063617ba03790608401600060405180830381600087803b1580156122a957600080fd5b505af11580156122bd573d6000803e3d6000fd5b5050505060005a90506106b8611526828461387a565b6122db612d50565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b61232a612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015260009182916123ec9185917f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816906335ea6a75906024015b6101e060405180830381865afa1580156123c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e79190613ea8565b612f2a565b909250905060006001856002811115612407576124076138c0565b6002811115612418576124186138c0565b146124235781612425565b825b9050808610156124325750845b80612469576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61248b73ffffffffffffffffffffffffffffffffffffffff8816333084612cf2565b60005a6040517f573ade8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152602482018590526044820189905287811660648301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063573ade81906084016020604051808303816000875af1158015612537573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255b9190613e06565b5060005a905061257561256e828461387a565b6003612a90565b505050505061258360018055565b50505050565b612591612d50565b73ffffffffffffffffffffffffffffffffffffffff83166125bb576125b68282612dd1565b6125dc565b6125dc73ffffffffffffffffffffffffffffffffffffffff84168383612b43565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba9108360405161263b91815260200190565b60405180910390a3505050565b612650612d50565b73ffffffffffffffffffffffffffffffffffffffff81166126f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61153881612eb5565b612709612a1c565b6040517f35ea6a7500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000043000000000000000000000000000000000000048116600483015260009182916127a89185917f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa816906335ea6a75906024016123a5565b9092509050600060018560028111156127c3576127c36138c0565b60028111156127d4576127d46138c0565b146127df57816127e1565b825b9050808610156127ee5750845b8034101561287e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f6d73672e76616c7565206973206c657373207468616e2072657061796d656e7460448201527f20616d6f756e740000000000000000000000000000000000000000000000000060648201526084016126ef565b7f000000000000000000000000430000000000000000000000000000000000000473ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156128e657600080fd5b505af11580156128fa573d6000803e3d6000fd5b505050505060005a6040517f573ade8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004300000000000000000000000000000000000004811660048301523460248301526044820189905287811660648301529192507f000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa89091169063573ade81906084016020604051808303816000875af11580156129ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ee9190613e06565b5060005a9050612a0161256e828461387a565b82341115611c8557611c8533612a17853461387a565b612dd1565b60026001541415612a89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016126ef565b6002600155565b60035473ffffffffffffffffffffffffffffffffffffffff16156113a9576000612aba3a8461402c565b6003546040517fcff29e6700000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff169063cff29e6790612b1590339085908790600401614069565b600060405180830381600087803b158015612b2f57600080fd5b505af1158015611251573d6000803e3d6000fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526106c39084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613067565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff828116602483015283169063dd62ed3e90604401602060405180830381865afa158015612c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cad9190613e06565b6113a9576113a973ffffffffffffffffffffffffffffffffffffffff8316827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613176565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526125839085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612b95565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016126ef565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051612e0891906140ab565b60006040518083038185875af1925050503d8060008114612e45576040519150601f19603f3d011682016040523d82523d6000602084013e612e4a565b606091505b50509050806106c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4554485f5452414e534645525f4641494c45440000000000000000000000000060448201526064016126ef565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6101208101516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015260009283929116906370a0823190602401602060405180830381865afa158015612fa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc59190613e06565b6101408401516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152909116906370a0823190602401602060405180830381865afa158015613038573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061305c9190613e06565b915091509250929050565b60006130c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166132f89092919063ffffffff16565b90508051600014806130ea5750808060200190518101906130ea9190613fcb565b6106c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016126ef565b80158061321657506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa1580156131f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132149190613e06565b155b6132a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016126ef565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526106c39084907f095ea7b30000000000000000000000000000000000000000000000000000000090606401612b95565b6060613307848460008561330f565b949350505050565b6060824710156133a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016126ef565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133ca91906140ab565b60006040518083038185875af1925050503d8060008114613407576040519150601f19603f3d011682016040523d82523d6000602084013e61340c565b606091505b509150915061341d87838387613428565b979650505050505050565b606083156134bb5782516134b45773ffffffffffffffffffffffffffffffffffffffff85163b6134b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016126ef565b5081613307565b61330783838151156134d05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ef91906140c7565b73ffffffffffffffffffffffffffffffffffffffff8116811461153857600080fd5b60008060006060848603121561353b57600080fd5b833561354681613504565b95602085013595506040909401359392505050565b60008060008060008060a0878903121561357457600080fd5b863561357f81613504565b95506020870135945060408701359350606087013561359d81613504565b9250608087013567ffffffffffffffff808211156135ba57600080fd5b818901915089601f8301126135ce57600080fd5b8135818111156135dd57600080fd5b8a60208285010111156135ef57600080fd5b6020830194508093505050509295509295509295565b600080600080600080600060c0888a03121561362057600080fd5b873561362b81613504565b96506020880135955060408801359450606088013561364981613504565b93506080880135925060a088013567ffffffffffffffff8082111561366d57600080fd5b818a0191508a601f83011261368157600080fd5b81358181111561369057600080fd5b8b60208260051b85010111156136a557600080fd5b60208301945080935050505092959891949750929550565b6000602082840312156136cf57600080fd5b81356136da81613504565b9392505050565b600080604083850312156136f457600080fd5b82359150602083013561370681613504565b809150509250929050565b60008060006060848603121561372657600080fd5b833561373181613504565b925060208401359150604084013561374881613504565b809150509250925092565b6000806040838503121561376657600080fd5b50508035926020909101359150565b6000806000806080858703121561378b57600080fd5b843561379681613504565b9350602085013592506040850135915060608501356137b481613504565b939692955090935050565b6000806000606084860312156137d457600080fd5b83356137df81613504565b925060208401356137ef81613504565b929592945050506040919091013590565b60008060006060848603121561381557600080fd5b8335925060208401359150604084013561374881613504565b60006020828403121561384057600080fd5b81516136da81613504565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561388c5761388c61384b565b500390565b8035600281106138a057600080fd5b919050565b6000602082840312156138b757600080fd5b6136da82613891565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600080858511156138ff57600080fd5b8386111561390c57600080fd5b5050820193919092039150565b6000821982111561392c5761392c61384b565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561398357613983613931565b60405290565b6040516101e0810167ffffffffffffffff8111828210171561398357613983613931565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156139f4576139f4613931565b604052919050565b600067ffffffffffffffff821115613a1657613a16613931565b5060051b60200190565b60008060408385031215613a3357600080fd5b613a3c83613891565b915060208084013567ffffffffffffffff80821115613a5a57600080fd5b9085019060a08288031215613a6e57600080fd5b613a76613960565b8235613a8181613504565b8082525083830135848201526040830135604082015260608301356060820152608083013582811115613ab357600080fd5b80840193505087601f840112613ac857600080fd5b82359150613add613ad8836139fc565b6139ad565b82815260059290921b83018401918481019089841115613afc57600080fd5b938501935b83851015613b23578435613b1481613504565b82529385019390850190613b01565b608083015250949794965093945050505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015613b9457845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101613b62565b505073ffffffffffffffffffffffffffffffffffffffff969096166060850152505050608001529392505050565b60006020808385031215613bd557600080fd5b825167ffffffffffffffff811115613bec57600080fd5b8301601f81018513613bfd57600080fd5b8051613c0b613ad8826139fc565b81815260059190911b82018301908381019087831115613c2a57600080fd5b928401925b8284101561341d57835182529284019290840190613c2f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60028110613c8757613c876138c0565b9052565b613c958184613c77565b6000602060408184015260e0830173ffffffffffffffffffffffffffffffffffffffff80865116604086015282860151606086015260408601516080860152606086015160a0860152608086015160a060c0870152828151808552610100880191508583019450600092505b80831015613d2357845184168252938501936001929092019190850190613d01565b5098975050505050505050565b60005b83811015613d4b578181015183820152602001613d33565b838111156125835750506000910152565b60008151808452613d74816020860160208601613d30565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525084604083015260a06060830152613de560a0830185613d5c565b905061ffff831660808301529695505050505050565b80516138a081613504565b600060208284031215613e1857600080fd5b5051919050565b600060208284031215613e3157600080fd5b6040516020810181811067ffffffffffffffff82111715613e5457613e54613931565b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff811681146138a057600080fd5b805164ffffffffff811681146138a057600080fd5b805161ffff811681146138a057600080fd5b60006101e08284031215613ebb57600080fd5b613ec3613989565b613ecd8484613e1f565b8152613edb60208401613e61565b6020820152613eec60408401613e61565b6040820152613efd60608401613e61565b6060820152613f0e60808401613e61565b6080820152613f1f60a08401613e61565b60a0820152613f3060c08401613e81565b60c0820152613f4160e08401613e96565b60e0820152610100613f54818501613dfb565b90820152610120613f66848201613dfb565b90820152610140613f78848201613dfb565b90820152610160613f8a848201613dfb565b90820152610180613f9c848201613e61565b908201526101a0613fae848201613e61565b908201526101c0613fc0848201613e61565b908201529392505050565b600060208284031215613fdd57600080fd5b815180151581146136da57600080fd5b60808101613ffb8287613c77565b73ffffffffffffffffffffffffffffffffffffffff8516602083015283604083015282606083015295945050505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156140645761406461384b565b500290565b73ffffffffffffffffffffffffffffffffffffffff8416815260208101839052606081016006831061409d5761409d6138c0565b826040830152949350505050565b600082516140bd818460208701613d30565b9190910192915050565b6020815260006136da6020830184613d5c56fea2646970667358221220cd410000fc111763ce4e0d83f2c66dc239d592df1a1125327dab6df1a1e00f8864736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa80000000000000000000000004300000000000000000000000000000000000004
-----Decoded View---------------
Arg [0] : _lendingPool (address): 0xd2499b3c8611E36ca89A70Fda2A72C49eE19eAa8
Arg [1] : _weth (address): 0x4300000000000000000000000000000000000004
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d2499b3c8611e36ca89a70fda2a72c49ee19eaa8
Arg [1] : 0000000000000000000000004300000000000000000000000000000000000004
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$89.42
Net Worth in ETH
0.030225
Token Allocations
ETH
99.99%
POL
0.01%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| LINEA | 29.45% | $2,958.96 | 0.00889959 | $26.33 | |
| BASE | 25.90% | $2,958.96 | 0.00782732 | $23.16 | |
| ARB | 21.62% | $2,958.64 | 0.00653514 | $19.34 | |
| SCROLL | 14.92% | $2,958.96 | 0.004508 | $13.34 | |
| TAIKO | 3.97% | $2,958.96 | 0.0012 | $3.55 | |
| OP | 2.32% | $2,958.59 | 0.0007 | $2.07 | |
| ARBNOVA | 1.82% | $2,958.44 | 0.00055 | $1.63 | |
| POL | <0.01% | $0.126832 | 0.041 | $0.0052 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.