Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MiddleFeeDistribution
Compiler Version
v0.8.12+commit.f00d7308
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
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 {Initializable} from "../../dependencies/openzeppelin/upgradeability/Initializable.sol";
import {OwnableUpgradeable} from "../../dependencies/openzeppelin/upgradeability/OwnableUpgradeable.sol";
import {RecoverERC20} from "../libraries/RecoverERC20.sol";
import {IMiddleFeeDistribution} from "../../interfaces/IMiddleFeeDistribution.sol";
import {IMultiFeeDistribution} from "../../interfaces/IMultiFeeDistribution.sol";
import {IMintableToken} from "../../interfaces/IMintableToken.sol";
import {IAaveOracle} from "../../interfaces/IAaveOracle.sol";
import {IAToken} from "../../interfaces/IAToken.sol";
import {IChainlinkAggregator} from "../../interfaces/IChainlinkAggregator.sol";
import {IAaveProtocolDataProvider} from "../../interfaces/IAaveProtocolDataProvider.sol";
/// @title Fee distributor inside
/// @author Radiant
contract MiddleFeeDistribution is IMiddleFeeDistribution, Initializable, OwnableUpgradeable, RecoverERC20 {
using SafeERC20 for IERC20;
/// @notice RDNT token
IMintableToken public rdntToken;
/// @notice Fee distributor contract for earnings and RDNT lockings
IMultiFeeDistribution public multiFeeDistribution;
/// @notice Reward ratio for operation expenses
uint256 public operationExpenseRatio;
uint256 public constant RATIO_DIVISOR = 10000;
uint8 public constant DECIMALS = 18;
mapping(address => bool) public isRewardToken;
/// @notice Operation Expense account
address public operationExpenses;
/// @notice Admin address
address public admin;
// AAVE Oracle address
address internal _aaveOracle;
// AAVE Protocol Data Provider address
IAaveProtocolDataProvider public aaveProtocolDataProvider;
/********************** Events ***********************/
/// @notice Emitted when reward token is forwarded
event ForwardReward(address indexed token, uint256 amount);
/// @notice Emitted when operation expenses is set
event OperationExpensesUpdated(address indexed _operationExpenses, uint256 _operationExpenseRatio);
event NewTransferAdded(address indexed asset, uint256 lpUsdValue);
event AdminUpdated(address indexed _configurator);
event RewardsUpdated(address indexed _rewardsToken);
event ProtocolDataProviderUpdated(address indexed _providerAddress);
/********************** Errors ***********************/
error ZeroAddress();
error IncompatibleToken();
error InvalidRatio();
error NotMFD();
error InsufficientPermission();
/**
* @dev Throws if called by any account other than the admin or owner.
*/
modifier onlyAdminOrOwner() {
if (admin != _msgSender() && owner() != _msgSender()) revert InsufficientPermission();
_;
}
/**
* @notice Initializer
* @param rdntToken_ RDNT address
* @param aaveOracle_ Aave oracle address
* @param multiFeeDistribution_ Multi fee distribution contract
*/
function initialize(
IMintableToken rdntToken_,
address aaveOracle_,
IMultiFeeDistribution multiFeeDistribution_,
IAaveProtocolDataProvider aaveProtocolDataProvider_
) public initializer {
if (aaveOracle_ == address(0)) revert ZeroAddress();
if (address(rdntToken_) == address(0)) revert ZeroAddress();
if (address(multiFeeDistribution_) == address(0)) revert ZeroAddress();
if (address(aaveProtocolDataProvider_) == address(0)) revert ZeroAddress();
__Ownable_init();
rdntToken = rdntToken_;
_aaveOracle = aaveOracle_;
multiFeeDistribution = multiFeeDistribution_;
aaveProtocolDataProvider = aaveProtocolDataProvider_;
admin = msg.sender;
}
/**
* @notice Set operation expenses account
* @param _operationExpenses Address to receive operation expenses
* @param _operationExpenseRatio Proportion of operation expense
*/
function setOperationExpenses(address _operationExpenses, uint256 _operationExpenseRatio) external onlyOwner {
if (_operationExpenseRatio > RATIO_DIVISOR) revert InvalidRatio();
if (_operationExpenses == address(0)) revert ZeroAddress();
operationExpenses = _operationExpenses;
operationExpenseRatio = _operationExpenseRatio;
emit OperationExpensesUpdated(_operationExpenses, _operationExpenseRatio);
}
/**
* @notice Sets pool configurator as admin.
* @param _configurator Configurator address
*/
function setAdmin(address _configurator) external onlyOwner {
if (_configurator == address(0)) revert ZeroAddress();
admin = _configurator;
emit AdminUpdated(_configurator);
}
/**
* @notice Set the Protocol Data Provider address
* @param _providerAddress The address of the protocol data provider contract
*/
function setProtocolDataProvider(IAaveProtocolDataProvider _providerAddress) external onlyOwner {
if (address(_providerAddress) == address(0)) revert ZeroAddress();
aaveProtocolDataProvider = _providerAddress;
emit ProtocolDataProviderUpdated(address(_providerAddress));
}
/**
* @notice Add a new reward token to be distributed to stakers
* @param _rewardsToken address of the reward token
*/
function addReward(address _rewardsToken) external onlyAdminOrOwner {
if (msg.sender != admin) {
try IAToken(_rewardsToken).UNDERLYING_ASSET_ADDRESS() returns (address underlying) {
(address aTokenAddress, , ) = aaveProtocolDataProvider.getReserveTokensAddresses(underlying);
if (aTokenAddress == address(0)) revert IncompatibleToken();
} catch {
// _rewardsToken is not an rToken, do nothing
}
}
multiFeeDistribution.addReward(_rewardsToken);
isRewardToken[_rewardsToken] = true;
emit RewardsUpdated(_rewardsToken);
}
/**
* @notice Remove an existing reward token
*/
function removeReward(address _rewardsToken) external onlyAdminOrOwner {
if (_rewardsToken == address(0)) revert ZeroAddress();
multiFeeDistribution.removeReward(_rewardsToken);
isRewardToken[_rewardsToken] = false;
emit RewardsUpdated(_rewardsToken);
}
/**
* @notice Run by MFD to pull pending platform revenue
* @param _rewardTokens an array of reward token addresses
*/
function forwardReward(address[] memory _rewardTokens) external {
if (msg.sender != address(multiFeeDistribution)) revert NotMFD();
uint256 length = _rewardTokens.length;
for (uint256 i = 0; i < length; ) {
address rewardToken = _rewardTokens[i];
uint256 total = IERC20(rewardToken).balanceOf(address(this));
if (operationExpenses != address(0) && operationExpenseRatio != 0) {
uint256 opExAmount = (total * operationExpenseRatio) / RATIO_DIVISOR;
if (opExAmount != 0) {
IERC20(rewardToken).safeTransfer(operationExpenses, opExAmount);
}
}
total = IERC20(rewardToken).balanceOf(address(this));
IERC20(rewardToken).safeTransfer(address(multiFeeDistribution), total);
if (rewardToken == address(rdntToken)) {
multiFeeDistribution.vestTokens(address(multiFeeDistribution), total, false);
}
emit ForwardReward(rewardToken, total);
_emitNewTransferAdded(rewardToken, total);
unchecked {
i++;
}
}
}
/**
* @notice Returns RDNT token address.
* @return RDNT token address
*/
function getRdntTokenAddress() external view returns (address) {
return address(rdntToken);
}
/**
* @notice Returns MFD address.
* @return MFD address
*/
function getMultiFeeDistributionAddress() external view returns (address) {
return address(multiFeeDistribution);
}
/**
* @notice Emit event for new asset reward
* @param asset address of transfer assset
* @param lpReward amount of rewards
*/
function _emitNewTransferAdded(address asset, uint256 lpReward) internal {
uint256 lpUsdValue;
if (asset != address(rdntToken)) {
try IAToken(asset).UNDERLYING_ASSET_ADDRESS() returns (address underlyingAddress) {
uint256 assetPrice = IAaveOracle(_aaveOracle).getAssetPrice(underlyingAddress);
address sourceOfAsset = IAaveOracle(_aaveOracle).getSourceOfAsset(underlyingAddress);
uint8 priceDecimal = IChainlinkAggregator(sourceOfAsset).decimals();
uint8 assetDecimals = IERC20Metadata(asset).decimals();
lpUsdValue = (assetPrice * lpReward * (10 ** DECIMALS)) / (10 ** priceDecimal) / (10 ** assetDecimals);
} catch {
uint256 assetPrice = IAaveOracle(_aaveOracle).getAssetPrice(asset);
address sourceOfAsset = IAaveOracle(_aaveOracle).getSourceOfAsset(asset);
uint8 priceDecimal = IChainlinkAggregator(sourceOfAsset).decimals();
uint8 assetDecimals = IERC20Metadata(asset).decimals();
lpUsdValue = (assetPrice * lpReward * (10 ** DECIMALS)) / (10 ** priceDecimal) / (10 ** assetDecimals);
}
emit NewTransferAdded(asset, lpUsdValue);
}
}
/**
* @notice Added to support recovering any ERC20 tokens inside the contract
* @param tokenAddress address of erc20 token to recover
* @param tokenAmount amount to recover
*/
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
_recoverERC20(tokenAddress, tokenAmount);
}
}// 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 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.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.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: agpl-3.0
pragma solidity 0.8.12;
import "./Initializable.sol";
contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {}
function __Context_init_unchained() internal onlyInitializing {}
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
uint256[50] private __gap;
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying an Initializable contract, as well
* as extending an Initializable contract via inheritance.
* WARNING: When used with inheritance, manual care must be taken to not invoke
* a parent initializer twice, or ensure that all initializers are idempotent,
* because this is not dealt with automatically as with constructors.
*/
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
uint256 cs;
//solium-disable-next-line
assembly {
cs := extcodesize(address())
}
return cs == 0;
}
modifier onlyInitializing() {
require(initializing, "Initializable: contract is not initializing");
_;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
import "./Initializable.sol";
import "./ContextUpgradeable.sol";
contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
interface AggregatorInterface {
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(
uint80 _roundId
)
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IScaledBalanceToken} from "./IScaledBalanceToken.sol";
import {IInitializableAToken} from "./IInitializableAToken.sol";
import {IAaveIncentivesController} from "./IAaveIncentivesController.sol";
interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @dev Emitted after the mint action
* @param from The address performing the mint
* @param value The amount being
* @param index The new liquidity index of the reserve
**/
event Mint(address indexed from, uint256 value, uint256 index);
/**
* @dev Mints `amount` aTokens to `user`
* @param user The address receiving the minted tokens
* @param amount The amount of tokens getting minted
* @param index The new liquidity index of the reserve
* @return `true` if the the previous balance of the user was 0
*/
function mint(address user, uint256 amount, uint256 index) external returns (bool);
/**
* @dev Emitted after aTokens are burned
* @param from The owner of the aTokens, getting them burned
* @param target The address that will receive the underlying
* @param value The amount being burned
* @param index The new liquidity index of the reserve
**/
event Burn(address indexed from, address indexed target, uint256 value, uint256 index);
/**
* @dev Emitted during the transfer action
* @param from The user whose tokens are being transferred
* @param to The recipient
* @param value The amount being transferred
* @param index The new liquidity index of the reserve
**/
event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);
/**
* @dev Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`
* @param user The owner of the aTokens, getting them burned
* @param receiverOfUnderlying The address that will receive the underlying
* @param amount The amount being burned
* @param index The new liquidity index of the reserve
**/
function burn(address user, address receiverOfUnderlying, uint256 amount, uint256 index) external;
/**
* @dev Mints aTokens to the reserve treasury
* @param amount The amount of tokens getting minted
* @param index The new liquidity index of the reserve
*/
function mintToTreasury(uint256 amount, uint256 index) external;
/**
* @dev 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;
/**
* @dev Transfers the underlying asset to `target`. Used by the LendingPool to transfer
* assets in borrow(), withdraw() and flashLoan()
* @param user The recipient of the underlying
* @param amount The amount getting transferred
* @return The amount transferred
**/
function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);
/**
* @dev Invoked to execute actions on the aToken side after a repayment.
* @param user The user executing the repayment
* @param amount The amount getting repaid
**/
function handleRepayment(address user, uint256 amount) external;
/**
* @dev Returns the address of the incentives controller contract
**/
function getIncentivesController() external view returns (IAaveIncentivesController);
/**
* @dev Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
**/
function UNDERLYING_ASSET_ADDRESS() external view returns (address);
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
pragma experimental ABIEncoderV2;
interface IAaveIncentivesController {
event RewardsAccrued(address indexed user, uint256 amount);
event RewardsClaimed(address indexed user, address indexed to, uint256 amount);
event RewardsClaimed(address indexed user, address indexed to, address indexed claimer, uint256 amount);
event ClaimerSet(address indexed user, address indexed claimer);
/*
* @dev Returns the configuration of the distribution for a certain asset
* @param asset The address of the reference asset of the distribution
* @return The asset index, the emission per second and the last updated timestamp
**/
function getAssetData(address asset) external view returns (uint256, uint256, uint256);
/**
* @dev Whitelists an address to claim the rewards on behalf of another address
* @param user The address of the user
* @param claimer The address of the claimer
*/
function setClaimer(address user, address claimer) external;
/**
* @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
* @param user The address of the user
* @return The claimer address
*/
function getClaimer(address user) external view returns (address);
/**
* @dev Configure assets for a certain rewards emission
* @param assets The assets to incentivize
* @param emissionsPerSecond The emission for each asset
*/
function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond) external;
/**
* @dev Called by the corresponding asset on any update that affects the rewards distribution
* @param user The address of the user
**/
function handleActionBefore(address user) external;
/**
* @dev Called by the corresponding asset on any update that affects the rewards distribution
* @param user The address of the user
* @param userBalance The balance of the user of the asset in the lending pool
* @param totalSupply The total supply of the asset in the lending pool
**/
function handleActionAfter(address user, uint256 userBalance, uint256 totalSupply) external;
/**
* @dev Returns the total of rewards of an user, already accrued + not yet accrued
* @param user The address of the user
* @return The rewards
**/
function getRewardsBalance(address[] calldata assets, address user) external view returns (uint256);
/**
* @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
* @param amount Amount of rewards to claim
* @param to Address that will be receiving the rewards
* @return Rewards claimed
**/
function claimRewards(address[] calldata assets, uint256 amount, address to) external returns (uint256);
/**
* @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must
* be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
* @param amount Amount of rewards to claim
* @param user Address to check and claim rewards
* @param to Address that will be receiving the rewards
* @return Rewards claimed
**/
function claimRewardsOnBehalf(
address[] calldata assets,
uint256 amount,
address user,
address to
) external returns (uint256);
/**
* @dev returns the unclaimed rewards of the user
* @param user the address of the user
* @return the unclaimed user rewards
*/
function getUserUnclaimedRewards(address user) external view returns (uint256);
/**
* @dev returns the unclaimed rewards of the user
* @param user the address of the user
* @param asset The asset to incentivize
* @return the user index for the asset
*/
function getUserAssetData(address user, address asset) external view returns (uint256);
/**
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
function REWARD_TOKEN() external view returns (address);
/**
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
function PRECISION() external view returns (uint8);
/**
* @dev Gets the distribution end timestamp of the emissions
*/
function DISTRIBUTION_END() external view returns (uint256);
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
/**
* @title IAaveOracle interface
* @notice Interface for the Aave oracle.
**/
interface IAaveOracle {
function BASE_CURRENCY() external view returns (address); // if usd returns 0x0, if eth returns weth address
function BASE_CURRENCY_UNIT() external view returns (uint256);
/***********
@dev returns the asset price in ETH
*/
function getAssetPrice(address asset) external view returns (uint256);
function getSourceOfAsset(address asset) external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
interface IAaveProtocolDataProvider {
struct TokenData {
string symbol;
address tokenAddress;
}
function getAllReservesTokens() external view returns (TokenData[] memory);
function getAllATokens() external view returns (TokenData[] memory);
function getReserveConfigurationData(
address asset
)
external
view
returns (
uint256 decimals,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
uint256 reserveFactor,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
bool stableBorrowRateEnabled,
bool isActive,
bool isFrozen
);
function getReserveData(
address asset
)
external
view
returns (
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVariableDebt,
uint256 liquidityRate,
uint256 variableBorrowRate,
uint256 stableBorrowRate,
uint256 averageStableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex,
uint40 lastUpdateTimestamp
);
function getUserReserveData(
address asset,
address user
)
external
view
returns (
uint256 currentATokenBalance,
uint256 currentStableDebt,
uint256 currentVariableDebt,
uint256 principalStableDebt,
uint256 scaledVariableDebt,
uint256 stableBorrowRate,
uint256 liquidityRate,
uint40 stableRateLastUpdated,
bool usageAsCollateralEnabled
);
function getReserveTokensAddresses(
address asset
) external view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress);
}// SPDX-License-Identifier: MIT
// Code from https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol
pragma solidity 0.8.12;
import "./AggregatorInterface.sol";
import "./AggregatorV3Interface.sol";
interface IChainlinkAggregator is AggregatorInterface, AggregatorV3Interface {}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import "./LockedBalance.sol";
interface IFeeDistribution {
struct RewardData {
address token;
uint256 amount;
}
function addReward(address rewardsToken) external;
function removeReward(address _rewardToken) external;
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
import {ILendingPool} from "./ILendingPool.sol";
import {IAaveIncentivesController} from "./IAaveIncentivesController.sol";
/**
* @title IInitializableAToken
* @notice Interface for the initialize function on AToken
* @author Aave
**/
interface IInitializableAToken {
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated lending 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
);
/**
* @dev Initializes the aToken
* @param pool The address of the lending pool where this aToken will be used
* @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
*/
function initialize(
ILendingPool 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.12;
pragma experimental ABIEncoderV2;
import {ILendingPoolAddressesProvider} from "./ILendingPoolAddressesProvider.sol";
import {DataTypes} from "../lending/libraries/types/DataTypes.sol";
interface ILendingPool {
/**
* @dev Emitted on deposit()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the deposit
* @param onBehalfOf The beneficiary of the deposit, receiving the aTokens
* @param amount The amount deposited
* @param referral The referral code used
**/
event Deposit(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referral
);
/**
* @dev Emitted on withdraw()
* @param reserve The address of the underlyng asset being withdrawn
* @param user The address initiating the withdrawal, owner of aTokens
* @param to 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 borrowRateMode The rate mode: 1 for Stable, 2 for Variable
* @param borrowRate The numeric rate at which the user has borrowed
* @param referral The referral code used
**/
event Borrow(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint256 borrowRateMode,
uint256 borrowRate,
uint16 indexed referral
);
/**
* @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
**/
event Repay(address indexed reserve, address indexed user, address indexed repayer, uint256 amount);
/**
* @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 rateMode The rate mode that the user wants to swap to
**/
event Swap(address indexed reserve, address indexed user, uint256 rateMode);
/**
* @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 premium The fee flash borrowed
* @param referralCode The referral code used
**/
event FlashLoan(
address indexed target,
address indexed initiator,
address indexed asset,
uint256 amount,
uint256 premium,
uint16 referralCode
);
/**
* @dev Emitted when the pause is triggered.
*/
event Paused();
/**
* @dev Emitted when the pause is lifted.
*/
event Unpaused();
/**
* @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via
* LendingPoolCollateral manager using a DELEGATECALL
* This allows to have the events in the generated ABI for LendingPool.
* @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 liiquidator
* @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. NOTE: This event is actually declared
* in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal,
* the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it
* gets added to the LendingPool ABI
* @param reserve The address of the underlying asset of the reserve
* @param liquidityRate The new liquidity rate
* @param stableBorrowRate The new stable borrow rate
* @param variableBorrowRate The new variable borrow rate
* @param liquidityIndex The new liquidity index
* @param variableBorrowIndex The new variable borrow index
**/
event ReserveDataUpdated(
address indexed reserve,
uint256 liquidityRate,
uint256 stableBorrowRate,
uint256 variableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex
);
function initialize(ILendingPoolAddressesProvider provider) external;
/**
* @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User deposits 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to deposit
* @param amount The amount to be deposited
* @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;
function depositWithAutoDLP(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
/**
* @dev 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 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);
/**
* @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
* already deposited 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 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 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 rateMode 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
* @return The final amount repaid
**/
function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) external returns (uint256);
/**
* @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa
* @param asset The address of the underlying asset borrowed
* @param rateMode The rate mode that the user wants to swap to
**/
function swapBorrowRateMode(address asset, uint256 rateMode) external;
/**
* @dev 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 deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been
* borrowed at a stable rate and depositors 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;
/**
* @dev Allows depositors to enable/disable a specific deposited asset as collateral
* @param asset The address of the underlying asset deposited
* @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise
**/
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;
/**
* @dev 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;
/**
* @dev Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration.
* For further details please visit https://developers.aave.com
* @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface
* @param assets The addresses of the assets being flash-borrowed
* @param amounts The amounts amounts being flash-borrowed
* @param modes 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 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 modes,
address onBehalfOf,
bytes calldata params,
uint16 referralCode
) external;
/**
* @dev Returns the user account data across all the reserves
* @param user The address of the user
* @return totalCollateralETH the total collateral in ETH of the user
* @return totalDebtETH the total debt in ETH of the user
* @return availableBorrowsETH the borrowing power left of the user
* @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 totalCollateralETH,
uint256 totalDebtETH,
uint256 availableBorrowsETH,
uint256 currentLiquidationThreshold,
uint256 ltv,
uint256 healthFactor
);
function initReserve(
address reserve,
address aTokenAddress,
address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external;
function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external;
function setConfiguration(address reserve, uint256 configuration) external;
/**
* @dev 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);
/**
* @dev 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);
/**
* @dev Returns the normalized income 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);
/**
* @dev Returns the normalized variable debt per unit of asset
* @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);
/**
* @dev Returns the state and configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The state of the reserve
**/
function getReserveData(address asset) external view returns (DataTypes.ReserveData memory);
function finalizeTransfer(
address asset,
address from,
address to,
uint256 amount,
uint256 balanceFromAfter,
uint256 balanceToBefore
) external;
function getReservesList() external view returns (address[] memory);
function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);
function setPause(bool val) external;
function paused() external view returns (bool);
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
/**
* @title LendingPoolAddressesProvider contract
* @dev Main registry of addresses part of or connected to the protocol, including permissioned roles
* - Acting also as factory of proxies and admin of those, so with right to change its implementations
* - Owned by the Aave Governance
* @author Aave
**/
interface ILendingPoolAddressesProvider {
event MarketIdSet(string newMarketId);
event LendingPoolUpdated(address indexed newAddress);
event ConfigurationAdminUpdated(address indexed newAddress);
event EmergencyAdminUpdated(address indexed newAddress);
event LendingPoolConfiguratorUpdated(address indexed newAddress);
event LendingPoolCollateralManagerUpdated(address indexed newAddress);
event PriceOracleUpdated(address indexed newAddress);
event LendingRateOracleUpdated(address indexed newAddress);
event ProxyCreated(bytes32 id, address indexed newAddress);
event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);
function getMarketId() external view returns (string memory);
function setMarketId(string calldata marketId) external;
function setAddress(bytes32 id, address newAddress) external;
function setAddressAsProxy(bytes32 id, address impl) external;
function getAddress(bytes32 id) external view returns (address);
function getLendingPool() external view returns (address);
function setLendingPoolImpl(address pool) external;
function getLendingPoolConfigurator() external view returns (address);
function setLendingPoolConfiguratorImpl(address configurator) external;
function getLendingPoolCollateralManager() external view returns (address);
function setLendingPoolCollateralManager(address manager) external;
function getPoolAdmin() external view returns (address);
function setPoolAdmin(address admin) external;
function getEmergencyAdmin() external view returns (address);
function setEmergencyAdmin(address admin) external;
function getPriceOracle() external view returns (address);
function setPriceOracle(address priceOracle) external;
function getLendingRateOracle() external view returns (address);
function setLendingRateOracle(address lendingRateOracle) external;
function getLiquidationFeeTo() external view returns (address);
function setLiquidationFeeTo(address liquidationFeeTo) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import "./LockedBalance.sol";
import {IFeeDistribution} from "./IMultiFeeDistribution.sol";
interface IMiddleFeeDistribution is IFeeDistribution {
function forwardReward(address[] memory _rewardTokens) external;
function getRdntTokenAddress() external view returns (address);
function getMultiFeeDistributionAddress() external view returns (address);
function operationExpenseRatio() external view returns (uint256);
function operationExpenses() external view returns (address);
function isRewardToken(address) external view returns (bool);
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IMintableToken is IERC20 {
function mint(address _receiver, uint256 _amount) external returns (bool);
function burn(uint256 _amount) external returns (bool);
function setMinter(address _minter) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import "./LockedBalance.sol";
import "./IFeeDistribution.sol";
import "./IMintableToken.sol";
interface IMultiFeeDistribution is IFeeDistribution {
function exit(bool claimRewards) external;
function stake(uint256 amount, address onBehalfOf, uint256 typeIndex) external;
function rdntToken() external view returns (IMintableToken);
function getPriceProvider() external view returns (address);
function lockInfo(address user) external view returns (LockedBalance[] memory);
function autocompoundEnabled(address user) external view returns (bool);
function defaultLockIndex(address _user) external view returns (uint256);
function autoRelockDisabled(address user) external view returns (bool);
function totalBalance(address user) external view returns (uint256);
function lockedBalance(address user) external view returns (uint256);
function lockedBalances(
address user
) external view returns (uint256, uint256, uint256, uint256, LockedBalance[] memory);
function getBalances(address _user) external view returns (Balances memory);
function zapVestingToLp(address _address) external returns (uint256);
function claimableRewards(address account) external view returns (IFeeDistribution.RewardData[] memory rewards);
function setDefaultRelockTypeIndex(uint256 _index) external;
function daoTreasury() external view returns (address);
function stakingToken() external view returns (address);
function userSlippage(address) external view returns (uint256);
function claimFromConverter(address) external;
function vestTokens(address user, uint256 amount, bool withPenalty) external;
}
interface IMFDPlus is IMultiFeeDistribution {
function getLastClaimTime(address _user) external returns (uint256);
function claimBounty(address _user, bool _execute) external returns (bool issueBaseBounty);
function claimCompound(address _user, bool _execute, uint256 _slippage) external returns (uint256 bountyAmt);
function setAutocompound(bool _newVal) external;
function setUserSlippage(uint256 slippage) external;
function toggleAutocompound() external;
function getAutocompoundEnabled(address _user) external view returns (bool);
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
interface IScaledBalanceToken {
/**
* @dev Returns the scaled balance of the user. 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);
/**
* @dev 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 balance and the scaled total supply
**/
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
/**
* @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
* @return The scaled total supply
**/
function scaledTotalSupply() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
struct LockedBalance {
uint256 amount;
uint256 unlockTime;
uint256 multiplier;
uint256 duration;
}
struct EarnedBalance {
uint256 amount;
uint256 unlockTime;
uint256 penalty;
}
struct Reward {
uint256 periodFinish;
uint256 rewardPerSecond;
uint256 lastUpdateTime;
uint256 rewardPerTokenStored;
// tracks already-added balances to handle accrued interest in aToken rewards
// for the stakingToken this value is unused and will always be 0
uint256 balance;
}
struct Balances {
uint256 total; // sum of earnings and lockings; no use when LP and RDNT is different
uint256 unlocked; // RDNT token
uint256 locked; // LP token or RDNT token
uint256 lockedWithMultiplier; // Multiplied locked amount
uint256 earned; // RDNT token
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.12;
library DataTypes {
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
//the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate;
uint40 lastUpdateTimestamp;
//tokens addresses
address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
//address of the interest rate strategy
address interestRateStrategyAddress;
//the id of the reserve. Represents the position in the list of the active reserves
uint8 id;
}
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-63: reserved
//bit 64-79: reserve factor
uint256 data;
}
struct UserConfigurationMap {
uint256 data;
}
enum InterestRateMode {
NONE,
STABLE,
VARIABLE
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/// @title RecoverERC20 contract
/// @author Radiant Devs
/// @dev All function calls are currently implemented without side effects
contract RecoverERC20 {
using SafeERC20 for IERC20;
/// @notice Emitted when ERC20 token is recovered
event Recovered(address indexed token, uint256 amount);
/**
* @notice Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders
*/
function _recoverERC20(address tokenAddress, uint256 tokenAmount) internal {
IERC20(tokenAddress).safeTransfer(msg.sender, tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
}
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 999999
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"IncompatibleToken","type":"error"},{"inputs":[],"name":"InsufficientPermission","type":"error"},{"inputs":[],"name":"InvalidRatio","type":"error"},{"inputs":[],"name":"NotMFD","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_configurator","type":"address"}],"name":"AdminUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ForwardReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"lpUsdValue","type":"uint256"}],"name":"NewTransferAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operationExpenses","type":"address"},{"indexed":false,"internalType":"uint256","name":"_operationExpenseRatio","type":"uint256"}],"name":"OperationExpensesUpdated","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":"_providerAddress","type":"address"}],"name":"ProtocolDataProviderUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"RewardsUpdated","type":"event"},{"inputs":[],"name":"DECIMALS","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATIO_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aaveProtocolDataProvider","outputs":[{"internalType":"contract IAaveProtocolDataProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_rewardTokens","type":"address[]"}],"name":"forwardReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMultiFeeDistributionAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRdntTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IMintableToken","name":"rdntToken_","type":"address"},{"internalType":"address","name":"aaveOracle_","type":"address"},{"internalType":"contract IMultiFeeDistribution","name":"multiFeeDistribution_","type":"address"},{"internalType":"contract IAaveProtocolDataProvider","name":"aaveProtocolDataProvider_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isRewardToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiFeeDistribution","outputs":[{"internalType":"contract IMultiFeeDistribution","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operationExpenseRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operationExpenses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rdntToken","outputs":[{"internalType":"contract IMintableToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"removeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_configurator","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operationExpenses","type":"address"},{"internalType":"uint256","name":"_operationExpenseRatio","type":"uint256"}],"name":"setOperationExpenses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAaveProtocolDataProvider","name":"_providerAddress","type":"address"}],"name":"setProtocolDataProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50612659806100206000396000f3fe608060405234801561001057600080fd5b50600436106101825760003560e01c80639c9b2e21116100d8578063cd57ed6c1161008c578063f2fde38b11610066578063f2fde38b14610387578063f851a4401461039a578063f8c8765e146103ba57600080fd5b8063cd57ed6c1461034d578063dd36bd0e1461036b578063e4501d291461037457600080fd5b8063ab453a59116100bd578063ab453a59146102dc578063b5fd73f8146102fa578063c8d508b01461032d57600080fd5b80639c9b2e21146102b6578063a4d5e67c146102c957600080fd5b80636a7e9f331161013a5780638980f11f116101145780638980f11f146102725780638da5cb5b1461028557806398f442bb146102a357600080fd5b80636a7e9f3314610240578063704b6c0214610257578063715018a61461026a57600080fd5b80634c6f71311161016b5780634c6f7131146101bb578063542b3cb8146102005780635f9d4d2e1461022057600080fd5b806308c51c65146101875780632e0f26251461019c575b600080fd5b61019a610195366004612128565b6103cd565b005b6101a4601281565b60405160ff90911681526020015b60405180910390f35b6097546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b2565b6098546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b609e546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b61024961271081565b6040519081526020016101b2565b61019a61026536600461220b565b610731565b61019a610873565b61019a61028036600461222f565b610900565b60655473ffffffffffffffffffffffffffffffffffffffff166101db565b61019a6102b136600461222f565b61098f565b61019a6102c436600461220b565b610b19565b61019a6102d736600461220b565b610e24565b60975473ffffffffffffffffffffffffffffffffffffffff166101db565b61031d61030836600461220b565b609a6020526000908152604090205460ff1681565b60405190151581526020016101b2565b609b546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b60985473ffffffffffffffffffffffffffffffffffffffff166101db565b61024960995481565b61019a61038236600461220b565b610fe1565b61019a61039536600461220b565b61111e565b609c546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b61019a6103c836600461225b565b61124e565b60985473ffffffffffffffffffffffffffffffffffffffff16331461041e576040517ff3320bfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160005b8181101561072c57600083828151811061043f5761043f6122b7565b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156104ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104de91906122e6565b609b5490915073ffffffffffffffffffffffffffffffffffffffff1615801590610509575060995415155b1561055c57600061271060995483610521919061232e565b61052b919061236b565b9050801561055a57609b5461055a9073ffffffffffffffffffffffffffffffffffffffff858116911683611528565b505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156105c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ea91906122e6565b6098549091506106149073ffffffffffffffffffffffffffffffffffffffff848116911683611528565b60975473ffffffffffffffffffffffffffffffffffffffff838116911614156106c8576098546040517ea4173a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820181905260248201839052600060448301529062a4173a90606401600060405180830381600087803b1580156106af57600080fd5b505af11580156106c3573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff167faa179256a8b0e52834b8e6c37fdcb2b72806c4b473622a9e844aa66cbe1a19908260405161071091815260200190565b60405180910390a261072282826115b5565b5050600101610423565b505050565b60655473ffffffffffffffffffffffffffffffffffffffff1633146107b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610804576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f54e4612788f90384e6843298d7854436f3a585b2c3831ab66abf1de63bfa6c2d90600090a250565b60655473ffffffffffffffffffffffffffffffffffffffff1633146108f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b6108fe6000611b8d565b565b60655473ffffffffffffffffffffffffffffffffffffffff163314610981576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b61098b8282611c04565b5050565b60655473ffffffffffffffffffffffffffffffffffffffff163314610a10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b612710811115610a4c576040517f648564d300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610a99576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841690811790915560998290556040518281527fba1e229a9495e21f509ea04bfdca8f222980ac1cb76333de06f6833f1e3f62d6906020015b60405180910390a25050565b609c5473ffffffffffffffffffffffffffffffffffffffff163314801590610b59575060655473ffffffffffffffffffffffffffffffffffffffff163314155b15610b90576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609c5473ffffffffffffffffffffffffffffffffffffffff163314610d27578073ffffffffffffffffffffffffffffffffffffffff1663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c34575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610c31918101906123a6565b60015b610c3d57610d27565b609e546040517fd2493b6c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152600092169063d2493b6c90602401606060405180830381865afa158015610cae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd291906123c3565b509091505073ffffffffffffffffffffffffffffffffffffffff8116610d24576040517f998d375300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505b6098546040517f9c9b2e2100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015290911690639c9b2e2190602401600060405180830381600087803b158015610d9457600080fd5b505af1158015610da8573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff82166000818152609a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055519192507f05f3326e0527f309d4015dee3bc3f36e650b53fc823bab69c99847814acfafdf91a250565b609c5473ffffffffffffffffffffffffffffffffffffffff163314801590610e64575060655473ffffffffffffffffffffffffffffffffffffffff163314155b15610e9b576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610ee8576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6098546040517fa4d5e67c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301529091169063a4d5e67c90602401600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff81166000818152609a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f05f3326e0527f309d4015dee3bc3f36e650b53fc823bab69c99847814acfafdf9190a250565b60655473ffffffffffffffffffffffffffffffffffffffff163314611062576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff81166110af576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fab1c1ea2d4e8015738584c8adccf9a8f988d99eb864bbfac9eda1e06dad405ae90600090a250565b60655473ffffffffffffffffffffffffffffffffffffffff16331461119f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff8116611242576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107ae565b61124b81611b8d565b50565b600054610100900460ff16806112635750303b155b80611271575060005460ff16155b6112fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560448201527f656e20696e697469616c697a656400000000000000000000000000000000000060648201526084016107ae565b600054610100900460ff1615801561133c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff8416611389576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85166113d6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611423576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216611470576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611478611c6d565b6097805473ffffffffffffffffffffffffffffffffffffffff8088167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255609d805487841690831617905560988054868416908316179055609e805492851692821692909217909155609c805490911633179055801561152157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261072c908490611d0c565b60975460009073ffffffffffffffffffffffffffffffffffffffff84811691161461072c578273ffffffffffffffffffffffffffffffffffffffff1663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561165f575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261165c918101906123a6565b60015b6118cf57609d546040517fb3596f0700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152600092169063b3596f0790602401602060405180830381865afa1580156116d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f891906122e6565b609d546040517f92bf2be000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152929350600092909116906392bf2be090602401602060405180830381865afa15801561176e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179291906123a6565b905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118059190612410565b905060008673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611854573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118789190612410565b905061188581600a612555565b61189083600a612555565b61189c6012600a612555565b6118a6898861232e565b6118b0919061232e565b6118ba919061236b565b6118c4919061236b565b945050505050611b38565b609d546040517fb3596f0700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152600092169063b3596f0790602401602060405180830381865afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196491906122e6565b609d546040517f92bf2be000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152929350600092909116906392bf2be090602401602060405180830381865afa1580156119da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fe91906123a6565b905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a719190612410565b905060008773ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae49190612410565b9050611af181600a612555565b611afc83600a612555565b611b086012600a612555565b611b128a8861232e565b611b1c919061232e565b611b26919061236b565b611b30919061236b565b955050505050505b8273ffffffffffffffffffffffffffffffffffffffff167fc5e1cdb94ac0a9f4f65e1a23fd59354025cffdf472eb03020ac4ba0e92d9969f82604051611b8091815260200190565b60405180910390a2505050565b6065805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611c2573ffffffffffffffffffffffffffffffffffffffff83163383611528565b8173ffffffffffffffffffffffffffffffffffffffff167f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa2882604051610b0d91815260200190565b600054610100900460ff16611d04576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107ae565b6108fe611e1b565b6000611d6e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ebb9092919063ffffffff16565b9050805160001480611d8f575080806020019051810190611d8f9190612564565b61072c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107ae565b600054610100900460ff16611eb2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107ae565b6108fe33611b8d565b6060611eca8484600085611ed2565b949350505050565b606082471015611f64576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107ae565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611f8d91906125b6565b60006040518083038185875af1925050503d8060008114611fca576040519150601f19603f3d011682016040523d82523d6000602084013e611fcf565b606091505b5091509150611fe087838387611feb565b979650505050505050565b6060831561207e5782516120775773ffffffffffffffffffffffffffffffffffffffff85163b612077576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107ae565b5081611eca565b611eca83838151156120935781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ae91906125d2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461124b57600080fd5b8035612123816120f6565b919050565b6000602080838503121561213b57600080fd5b823567ffffffffffffffff8082111561215357600080fd5b818501915085601f83011261216757600080fd5b813581811115612179576121796120c7565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156121bc576121bc6120c7565b6040529182528482019250838101850191888311156121da57600080fd5b938501935b828510156121ff576121f085612118565b845293850193928501926121df565b98975050505050505050565b60006020828403121561221d57600080fd5b8135612228816120f6565b9392505050565b6000806040838503121561224257600080fd5b823561224d816120f6565b946020939093013593505050565b6000806000806080858703121561227157600080fd5b843561227c816120f6565b9350602085013561228c816120f6565b9250604085013561229c816120f6565b915060608501356122ac816120f6565b939692955090935050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122f857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612366576123666122ff565b500290565b6000826123a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156123b857600080fd5b8151612228816120f6565b6000806000606084860312156123d857600080fd5b83516123e3816120f6565b60208501519093506123f4816120f6565b6040850151909250612405816120f6565b809150509250925092565b60006020828403121561242257600080fd5b815160ff8116811461222857600080fd5b600181815b8085111561248c57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612472576124726122ff565b8085161561247f57918102915b93841c9390800290612438565b509250929050565b6000826124a35750600161254f565b816124b05750600061254f565b81600181146124c657600281146124d0576124ec565b600191505061254f565b60ff8411156124e1576124e16122ff565b50506001821b61254f565b5060208310610133831016604e8410600b841016171561250f575081810a61254f565b6125198383612433565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561254b5761254b6122ff565b0290505b92915050565b600061222860ff841683612494565b60006020828403121561257657600080fd5b8151801515811461222857600080fd5b60005b838110156125a1578181015183820152602001612589565b838111156125b0576000848401525b50505050565b600082516125c8818460208701612586565b9190910192915050565b60208152600082518060208401526125f1816040850160208701612586565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212207b7d6694b970f5b4911c9c6b11f10590a72710422a9fe6f5e1230c68a0fb7f9864736f6c634300080c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101825760003560e01c80639c9b2e21116100d8578063cd57ed6c1161008c578063f2fde38b11610066578063f2fde38b14610387578063f851a4401461039a578063f8c8765e146103ba57600080fd5b8063cd57ed6c1461034d578063dd36bd0e1461036b578063e4501d291461037457600080fd5b8063ab453a59116100bd578063ab453a59146102dc578063b5fd73f8146102fa578063c8d508b01461032d57600080fd5b80639c9b2e21146102b6578063a4d5e67c146102c957600080fd5b80636a7e9f331161013a5780638980f11f116101145780638980f11f146102725780638da5cb5b1461028557806398f442bb146102a357600080fd5b80636a7e9f3314610240578063704b6c0214610257578063715018a61461026a57600080fd5b80634c6f71311161016b5780634c6f7131146101bb578063542b3cb8146102005780635f9d4d2e1461022057600080fd5b806308c51c65146101875780632e0f26251461019c575b600080fd5b61019a610195366004612128565b6103cd565b005b6101a4601281565b60405160ff90911681526020015b60405180910390f35b6097546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b2565b6098546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b609e546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b61024961271081565b6040519081526020016101b2565b61019a61026536600461220b565b610731565b61019a610873565b61019a61028036600461222f565b610900565b60655473ffffffffffffffffffffffffffffffffffffffff166101db565b61019a6102b136600461222f565b61098f565b61019a6102c436600461220b565b610b19565b61019a6102d736600461220b565b610e24565b60975473ffffffffffffffffffffffffffffffffffffffff166101db565b61031d61030836600461220b565b609a6020526000908152604090205460ff1681565b60405190151581526020016101b2565b609b546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b60985473ffffffffffffffffffffffffffffffffffffffff166101db565b61024960995481565b61019a61038236600461220b565b610fe1565b61019a61039536600461220b565b61111e565b609c546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b61019a6103c836600461225b565b61124e565b60985473ffffffffffffffffffffffffffffffffffffffff16331461041e576040517ff3320bfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160005b8181101561072c57600083828151811061043f5761043f6122b7565b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156104ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104de91906122e6565b609b5490915073ffffffffffffffffffffffffffffffffffffffff1615801590610509575060995415155b1561055c57600061271060995483610521919061232e565b61052b919061236b565b9050801561055a57609b5461055a9073ffffffffffffffffffffffffffffffffffffffff858116911683611528565b505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa1580156105c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ea91906122e6565b6098549091506106149073ffffffffffffffffffffffffffffffffffffffff848116911683611528565b60975473ffffffffffffffffffffffffffffffffffffffff838116911614156106c8576098546040517ea4173a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820181905260248201839052600060448301529062a4173a90606401600060405180830381600087803b1580156106af57600080fd5b505af11580156106c3573d6000803e3d6000fd5b505050505b8173ffffffffffffffffffffffffffffffffffffffff167faa179256a8b0e52834b8e6c37fdcb2b72806c4b473622a9e844aa66cbe1a19908260405161071091815260200190565b60405180910390a261072282826115b5565b5050600101610423565b505050565b60655473ffffffffffffffffffffffffffffffffffffffff1633146107b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610804576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f54e4612788f90384e6843298d7854436f3a585b2c3831ab66abf1de63bfa6c2d90600090a250565b60655473ffffffffffffffffffffffffffffffffffffffff1633146108f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b6108fe6000611b8d565b565b60655473ffffffffffffffffffffffffffffffffffffffff163314610981576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b61098b8282611c04565b5050565b60655473ffffffffffffffffffffffffffffffffffffffff163314610a10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b612710811115610a4c576040517f648564d300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610a99576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff841690811790915560998290556040518281527fba1e229a9495e21f509ea04bfdca8f222980ac1cb76333de06f6833f1e3f62d6906020015b60405180910390a25050565b609c5473ffffffffffffffffffffffffffffffffffffffff163314801590610b59575060655473ffffffffffffffffffffffffffffffffffffffff163314155b15610b90576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609c5473ffffffffffffffffffffffffffffffffffffffff163314610d27578073ffffffffffffffffffffffffffffffffffffffff1663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610c34575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610c31918101906123a6565b60015b610c3d57610d27565b609e546040517fd2493b6c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152600092169063d2493b6c90602401606060405180830381865afa158015610cae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd291906123c3565b509091505073ffffffffffffffffffffffffffffffffffffffff8116610d24576040517f998d375300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505b6098546040517f9c9b2e2100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015290911690639c9b2e2190602401600060405180830381600087803b158015610d9457600080fd5b505af1158015610da8573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff82166000818152609a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055519192507f05f3326e0527f309d4015dee3bc3f36e650b53fc823bab69c99847814acfafdf91a250565b609c5473ffffffffffffffffffffffffffffffffffffffff163314801590610e64575060655473ffffffffffffffffffffffffffffffffffffffff163314155b15610e9b576040517fdeda903000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610ee8576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6098546040517fa4d5e67c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301529091169063a4d5e67c90602401600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff81166000818152609a602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055517f05f3326e0527f309d4015dee3bc3f36e650b53fc823bab69c99847814acfafdf9190a250565b60655473ffffffffffffffffffffffffffffffffffffffff163314611062576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff81166110af576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fab1c1ea2d4e8015738584c8adccf9a8f988d99eb864bbfac9eda1e06dad405ae90600090a250565b60655473ffffffffffffffffffffffffffffffffffffffff16331461119f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107ae565b73ffffffffffffffffffffffffffffffffffffffff8116611242576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107ae565b61124b81611b8d565b50565b600054610100900460ff16806112635750303b155b80611271575060005460ff16155b6112fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560448201527f656e20696e697469616c697a656400000000000000000000000000000000000060648201526084016107ae565b600054610100900460ff1615801561133c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000166101011790555b73ffffffffffffffffffffffffffffffffffffffff8416611389576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff85166113d6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316611423576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216611470576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611478611c6d565b6097805473ffffffffffffffffffffffffffffffffffffffff8088167fffffffffffffffffffffffff000000000000000000000000000000000000000092831617909255609d805487841690831617905560988054868416908316179055609e805492851692821692909217909155609c805490911633179055801561152157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555b5050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261072c908490611d0c565b60975460009073ffffffffffffffffffffffffffffffffffffffff84811691161461072c578273ffffffffffffffffffffffffffffffffffffffff1663b16a19de6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561165f575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261165c918101906123a6565b60015b6118cf57609d546040517fb3596f0700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152600092169063b3596f0790602401602060405180830381865afa1580156116d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f891906122e6565b609d546040517f92bf2be000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152929350600092909116906392bf2be090602401602060405180830381865afa15801561176e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179291906123a6565b905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118059190612410565b905060008673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611854573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118789190612410565b905061188581600a612555565b61189083600a612555565b61189c6012600a612555565b6118a6898861232e565b6118b0919061232e565b6118ba919061236b565b6118c4919061236b565b945050505050611b38565b609d546040517fb3596f0700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152600092169063b3596f0790602401602060405180830381865afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196491906122e6565b609d546040517f92bf2be000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152929350600092909116906392bf2be090602401602060405180830381865afa1580156119da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fe91906123a6565b905060008173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a719190612410565b905060008773ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae49190612410565b9050611af181600a612555565b611afc83600a612555565b611b086012600a612555565b611b128a8861232e565b611b1c919061232e565b611b26919061236b565b611b30919061236b565b955050505050505b8273ffffffffffffffffffffffffffffffffffffffff167fc5e1cdb94ac0a9f4f65e1a23fd59354025cffdf472eb03020ac4ba0e92d9969f82604051611b8091815260200190565b60405180910390a2505050565b6065805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611c2573ffffffffffffffffffffffffffffffffffffffff83163383611528565b8173ffffffffffffffffffffffffffffffffffffffff167f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa2882604051610b0d91815260200190565b600054610100900460ff16611d04576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107ae565b6108fe611e1b565b6000611d6e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ebb9092919063ffffffff16565b9050805160001480611d8f575080806020019051810190611d8f9190612564565b61072c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107ae565b600054610100900460ff16611eb2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107ae565b6108fe33611b8d565b6060611eca8484600085611ed2565b949350505050565b606082471015611f64576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107ae565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611f8d91906125b6565b60006040518083038185875af1925050503d8060008114611fca576040519150601f19603f3d011682016040523d82523d6000602084013e611fcf565b606091505b5091509150611fe087838387611feb565b979650505050505050565b6060831561207e5782516120775773ffffffffffffffffffffffffffffffffffffffff85163b612077576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107ae565b5081611eca565b611eca83838151156120935781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ae91906125d2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461124b57600080fd5b8035612123816120f6565b919050565b6000602080838503121561213b57600080fd5b823567ffffffffffffffff8082111561215357600080fd5b818501915085601f83011261216757600080fd5b813581811115612179576121796120c7565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f830116810181811085821117156121bc576121bc6120c7565b6040529182528482019250838101850191888311156121da57600080fd5b938501935b828510156121ff576121f085612118565b845293850193928501926121df565b98975050505050505050565b60006020828403121561221d57600080fd5b8135612228816120f6565b9392505050565b6000806040838503121561224257600080fd5b823561224d816120f6565b946020939093013593505050565b6000806000806080858703121561227157600080fd5b843561227c816120f6565b9350602085013561228c816120f6565b9250604085013561229c816120f6565b915060608501356122ac816120f6565b939692955090935050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156122f857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612366576123666122ff565b500290565b6000826123a1577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156123b857600080fd5b8151612228816120f6565b6000806000606084860312156123d857600080fd5b83516123e3816120f6565b60208501519093506123f4816120f6565b6040850151909250612405816120f6565b809150509250925092565b60006020828403121561242257600080fd5b815160ff8116811461222857600080fd5b600181815b8085111561248c57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612472576124726122ff565b8085161561247f57918102915b93841c9390800290612438565b509250929050565b6000826124a35750600161254f565b816124b05750600061254f565b81600181146124c657600281146124d0576124ec565b600191505061254f565b60ff8411156124e1576124e16122ff565b50506001821b61254f565b5060208310610133831016604e8410600b841016171561250f575081810a61254f565b6125198383612433565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561254b5761254b6122ff565b0290505b92915050565b600061222860ff841683612494565b60006020828403121561257657600080fd5b8151801515811461222857600080fd5b60005b838110156125a1578181015183820152602001612589565b838111156125b0576000848401525b50505050565b600082516125c8818460208701612586565b9190910192915050565b60208152600082518060208401526125f1816040850160208701612586565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212207b7d6694b970f5b4911c9c6b11f10590a72710422a9fe6f5e1230c68a0fb7f9864736f6c634300080c0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.