Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
There are no matching entriesUpdate your filters to view other transactions | |||||||||
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
YamatoRedeemerV5
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity 0.8.4;
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright (C) 2024 Yamato Protocol (DeFiGeek Community Japan)
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
import "./Pool.sol";
import "./YMT.sol";
import "./PriceFeedV3.sol";
import "./Dependencies/YamatoAction.sol";
import "./Dependencies/PledgeLib.sol";
import "./Dependencies/SafeMath.sol";
import "./Interfaces/IYamato.sol";
import "./Interfaces/IYamatoV4.sol";
import "./Interfaces/IFeePool.sol";
import "./Interfaces/ICurrencyOS.sol";
import "./Interfaces/IYamatoRedeemer.sol";
import "./Interfaces/IYamatoRedeemerV4.sol";
import "./Interfaces/IPriorityRegistry.sol";
import "./Interfaces/IPriorityRegistryV6.sol";
import "./Interfaces/IScoreRegistry.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "hardhat/console.sol";
/// @title Yamato Redeemer Contract
contract YamatoRedeemerV5 is IYamatoRedeemerV4, YamatoAction {
using PledgeLib for IYamato.Pledge;
using PledgeLib for uint256;
function initialize(address _yamato) public initializer {
__YamatoAction_init(_yamato);
}
function runRedeem(
IYamatoRedeemer.RunRedeemArgs memory _args
) public override onlyYamato returns (IYamatoRedeemer.RedeemedArgs memory) {
IYamatoRedeemerV4.RunRedeemVars memory vars;
IPriorityRegistryV6 _prv6 = IPriorityRegistryV6(priorityRegistry());
ICurrencyOS _currencyOS = ICurrencyOS(currencyOS());
IERC20 _cjpy = IERC20(_currencyOS.currency());
IYamato _yamato = IYamato(yamato());
vars.ethPriceInCurrency = IPriceFeedV3(priceFeed()).fetchPrice();
if (_args.isCoreRedemption) {
_args.wantToRedeemCurrencyAmount = IPool(pool())
.redemptionReserve();
require(
_args.wantToRedeemCurrencyAmount > 0,
"The redemption reserve is empty."
);
} else {
require(
_cjpy.balanceOf(_args.sender) >=
_args.wantToRedeemCurrencyAmount,
"Insufficient currency balance to redeem."
);
}
vars._GRR = _yamato.GRR();
vars._mcrPercent = uint256(_yamato.MCR());
vars._mcrPertenk = vars._mcrPercent * 100;
/*
On memory update: Get redemption candidates with calculating after-redemption state
*/
vars._nextICR = _prv6.LICR();
vars._nextICR = vars._nextICR == 0 ? 1 : vars._nextICR;
vars._nextout = _prv6.rankedQueueNextout(vars._nextICR);
vars._nextin = _prv6.rankedQueueTotalLen(vars._nextICR);
vars._maxCount = IYamatoV4(yamato()).maxRedeemableCount();
vars._bulkedPledges = new IYamato.Pledge[](vars._maxCount * 2);
vars._skippedPledges = new IYamato.Pledge[](vars._maxCount);
vars._pledgesOwner = new address[](vars._maxCount);
vars._checkpoint =
vars._mcrPercent +
IYamatoV4(yamato()).CHECKPOINT_BUFFER();
while (true) {
address _pledgeAddr = _prv6.rankedQueuePop(vars._nextICR);
if (vars._nextICR >= vars._checkpoint) {
// Note: This case conditioned as
// vars._activePledgeLength - vars._count == 0 || vars._nextICR >= vars._checkpoint
// but removed the first clause for simplicity.
// It would cause worse gas consumption in pledge-lacking cases but it's okay.
break; /* inf loop checker */
}
if (_pledgeAddr == address(0)) {
vars._nextICR++;
continue; /* That rank has been exhausted */
}
IYamato.Pledge memory _pledge = _yamato.getPledge(_pledgeAddr);
uint256 _ICRpertenk = _pledge.getICRWithPrice(
vars.ethPriceInCurrency
);
if (
vars._nextICR == vars._mcrPercent &&
_ICRpertenk == vars._mcrPertenk /* priority=realICR=MCR */
) {
vars._nextICR++;
vars._nextout = _prv6.rankedQueueNextout(vars._nextICR);
vars._nextin = _prv6.rankedQueueTotalLen(vars._nextICR);
continue; /* To avoid "just-on-MCR" pledges */
} else {
vars._toBeRedeemedFragment = _pledge.toBeRedeemed(
vars._mcrPertenk,
_ICRpertenk,
vars.ethPriceInCurrency
);
if (
vars._toBeRedeemedFragment == 0 &&
_ICRpertenk >= vars._mcrPertenk
) {
vars._skippedPledges[vars._skipCount] = _pledge;
vars._skipCount++;
continue; /* To skip until next poppables. This must be upserted below to refresh obsoleted priority. */
}
if (
vars._toBeRedeemed + vars._toBeRedeemedFragment >
_args.wantToRedeemCurrencyAmount
) {
vars._toBeRedeemedFragment =
_args.wantToRedeemCurrencyAmount -
vars
._toBeRedeemed; /* Limiting redeeming amount within the amount sender has. */
}
vars._toBeRedeemedFragmentInEth =
(vars._toBeRedeemedFragment * 1e18) /
vars.ethPriceInCurrency;
/* state update for redeemed pledge */
require(
vars._toBeRedeemedFragmentInEth <= _pledge.coll,
"redemption fragment can't be bigger than coll."
);
uint256 _dustyDiff = _pledge.coll -
vars._toBeRedeemedFragmentInEth;
uint256 _debtAfter = _pledge.debt - vars._toBeRedeemedFragment;
bool _isSweepableWithColl = (_dustyDiff > 0) &&
((_dustyDiff * vars.ethPriceInCurrency) / 1e18 <
_debtAfter);
uint256 _increasedToBeRedeemedFragment = vars
._toBeRedeemedFragment +
(_dustyDiff * vars.ethPriceInCurrency) /
1e18;
bool _hasRoundingBudget = vars._toBeRedeemed +
_increasedToBeRedeemedFragment <=
_args.wantToRedeemCurrencyAmount;
if (_isSweepableWithColl && _hasRoundingBudget) {
/* Rounding a dusty collateral */
vars._toBeRedeemedFragmentInEth += _dustyDiff;
require(
vars._toBeRedeemedFragmentInEth == _pledge.coll,
"For ICR=0% pledge, coll must be zero."
);
vars._toBeRedeemedFragment = _increasedToBeRedeemedFragment;
}
_pledge.debt -= vars._toBeRedeemedFragment;
_pledge.coll -= vars._toBeRedeemedFragmentInEth;
vars._toBeRedeemed += vars._toBeRedeemedFragment;
vars._toBeRedeemedInEth += vars._toBeRedeemedFragmentInEth;
vars._pledgesOwner[vars._count] = _pledge.owner;
vars._bulkedPledges[vars._count] = _pledge;
vars._count++;
if (vars._toBeRedeemed == _args.wantToRedeemCurrencyAmount) {
break; /* Could pile up money as sender wants. */
}
if (vars._count >= vars._maxCount) {
break; /* count reached to the target */
}
}
}
require(vars._toBeRedeemed > 0, "No pledges are redeemed.");
require(
vars._toBeRedeemed <= _args.wantToRedeemCurrencyAmount,
"Redeeming amount exceeds bearer's balance."
);
/*
Merge skipped pledges to re-redeem later
*/
for (uint256 i; i < vars._maxCount; ) {
vars._bulkedPledges[vars._maxCount + i] = vars._skippedPledges[i];
unchecked {
++i; // Note: gas saving
}
}
/*
External tx: bulkUpsert and LICR update
*/
uint256[] memory _priorities = _prv6.bulkUpsert(vars._bulkedPledges);
/*
On memory update: priority
*/
for (uint256 i; i < vars._bulkedPledges.length; ++i) {
vars._bulkedPledges[i].priority = _priorities[i];
}
/*
External tx: setPledges
*/
IYamatoV4(yamato()).setPledges(vars._bulkedPledges);
/*
External tx: setTotalColl, setTotalDebt
*/
(uint256 totalColl, uint256 totalDebt, , , , ) = IYamato(yamato())
.getStates();
IYamato(yamato()).setTotalDebt(totalDebt - vars._toBeRedeemed);
IYamato(yamato()).setTotalColl(totalColl - vars._toBeRedeemedInEth);
/*
Score checkpoint
*/
IScoreRegistry _scoreRegistry = IScoreRegistry(
IYamatoV4(yamato()).scoreRegistry()
);
_scoreRegistry.bulkCheckpoint(vars._pledgesOwner);
/*
Update score
*/
_scoreRegistry.bulkUpdateScoreLimit(
vars._bulkedPledges,
totalDebt - vars._toBeRedeemed,
priceFeed()
);
/*
Handle compensations
*/
address _redemptionBearer;
address _returningDestination;
if (_args.isCoreRedemption) {
/*
[ Core Redemption - Pool Subtotal ]
(-) Redemption Reserve (Currency)
v
v
(+) Fee Pool (ETH)
*/
_redemptionBearer = pool();
_returningDestination = feePool();
IPool(pool()).useRedemptionReserve(vars._toBeRedeemed);
} else {
/*
[ Normal Redemption - Account Subtotal ]
(-) Bearer Balance (Currency)
v
v
(+) Bearer Balance (ETH)
*/
_redemptionBearer = _args.sender;
_returningDestination = _args.sender;
}
// Burn 100%
_currencyOS.burnCurrency(_redemptionBearer, vars._toBeRedeemed);
// Pay 99% in ETH
vars._effectiveRedemptionAmountInCurrency =
(vars._toBeRedeemed * (100 - vars._GRR)) /
100;
vars._effectiveRedemptionAmount =
(vars._toBeRedeemedInEth * (100 - vars._GRR)) /
100;
IPool(pool()).sendETH(
_returningDestination,
vars._effectiveRedemptionAmount
);
/*
4. Pay 1% gas compensation in ETH
*/
vars._gasCompensationInETH =
vars._toBeRedeemedInEth -
vars._effectiveRedemptionAmount;
IPool(pool()).sendETH(_args.sender, vars._gasCompensationInETH);
return
IYamatoRedeemer.RedeemedArgs(
vars._effectiveRedemptionAmountInCurrency,
vars._effectiveRedemptionAmount,
vars._pledgesOwner,
vars.ethPriceInCurrency,
vars._gasCompensationInETH
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822ProxiableUpgradeable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeaconUpgradeable {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*
* @custom:oz-upgrades-unsafe-allow delegatecall
*/
abstract contract ERC1967UpgradeUpgradeable is Initializable {
function __ERC1967Upgrade_init() internal onlyInitializing {
}
function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
}
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(
address newImplementation,
bytes memory data,
bool forceCall
) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
_functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(
address newImplementation,
bytes memory data,
bool forceCall
) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Emitted when the beacon is upgraded.
*/
event BeaconUpgraded(address indexed beacon);
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
_functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
}
}
/**
* @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) private returns (bytes memory) {
require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Internal function that returns the initialized version. Returns `_initialized`
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Internal function that returns the initialized version. Returns `_initializing`
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeTo(address newImplementation) external virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return 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 Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlotUpgradeable {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./draft-IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/draft-EIP712.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/Counters.sol";
/**
* @dev Implementation 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.
*
* _Available since v3.4._
*/
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
using Counters for Counters.Counter;
mapping(address => Counters.Counter) private _nonces;
// solhint-disable-next-line var-name-mixedcase
bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/**
* @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
*
* It's a good idea to use the same `name` that is defined as the ERC20 token name.
*/
constructor(string memory name) EIP712(name, "1") {}
/**
* @dev See {IERC20Permit-permit}.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
_approve(owner, spender, value);
}
/**
* @dev See {IERC20Permit-nonces}.
*/
function nonces(address owner) public view virtual override returns (uint256) {
return _nonces[owner].current();
}
/**
* @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
/**
* @dev "Consume a nonce": return the current value and increment.
*
* _Available since v4.1._
*/
function _useNonce(address owner) internal virtual returns (uint256 current) {
Counters.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
}// SPDX-License-Identifier: MIT
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
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
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// 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.4;
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: MIT
pragma solidity 0.8.4;
contract BaseMath {
uint256 public constant DECIMAL_PRECISION = 1e18;
}pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "../Interfaces/IYamato.sol"; import "../PriceFeedV3.sol"; library PledgeLib { /// @notice Calculate ICR for the memory Pledge /// @dev (coll*priceInJpy)/debt, if debt==0 then return uint256-max ICR /// @param _pledge having coll and debt /// @param _feed Oracle data in decimal=18 padded uint /// @return _ICR in uint256 function getICR( IYamato.Pledge memory _pledge, address _feed ) public view returns (uint256 _ICR) { require(_feed != address(0), "Feed is null address."); IPriceFeedV3 feed = IPriceFeedV3(_feed); uint256 _ethPriceInCurrency = feed.lastGoodPrice(); // dec18 // All Yamato funcs uses fetchPrice before hand and so you can use lastGoodPrice here. uint256 _coll = _pledge.coll; // dec18 uint256 _debt = _pledge.debt; // dec18 uint256 _collInCurrency = (_coll * _ethPriceInCurrency) / 1e18; // dec18 * dec18 / dec18 = dec18 if (_coll == 0 && _debt == 0) { _ICR = 0; } else if (_coll > 0 && _debt == 0) { _ICR = 2 ** 256 - 1; } else { // Note: ICR is per-ten-k in Yamato _ICR = (10000 * _collInCurrency) / _debt; } } /// @notice Calculate ICR for the memory Pledge /// @dev It's cheaper than "getICR" /// @param _pledge having coll and debt /// @param _ethPriceInCurrency price in decimal=18 padded uint /// @return _ICR in uint256 function getICRWithPrice( IYamato.Pledge memory _pledge, uint256 _ethPriceInCurrency ) public view returns (uint256 _ICR) { uint256 _debt = _pledge.debt; // dec18 if (_debt != 0) { // Note: ICR is per-ten-k in Yamato _ICR = ((10000 * (_pledge.coll * _ethPriceInCurrency)) / 1e18) / _debt; } else { if (_pledge.coll > 0) { _ICR = 2 ** 256 - 1; } else { _ICR = 0; } } } /// @notice Copy the storage Pledge into memory /// @param _pledge having all Pledge struct params (coll, debt, isCreated, owner, priority) function toMem( IYamato.Pledge storage _pledge ) public view returns (IYamato.Pledge memory) { return IYamato.Pledge( _pledge.coll, _pledge.debt, _pledge.isCreated, _pledge.owner, _pledge.priority ); } /// @notice Clone the memory Pledge into memory /// @param _pledge having all Pledge struct params (coll, debt, isCreated, owner, priority) function clone( IYamato.Pledge memory _pledge ) public view returns (IYamato.Pledge memory) { return IYamato.Pledge( _pledge.coll, _pledge.debt, _pledge.isCreated, _pledge.owner, _pledge.priority ); } /// @notice Add debt for the memory Pledge /// @param _pledge having all Pledge struct params (coll, debt, isCreated, owner, priority) /// @param _adder is how much debt to add function addDebt( IYamato.Pledge memory _pledge, uint256 _adder ) public view returns (IYamato.Pledge memory) { return IYamato.Pledge( _pledge.coll, _pledge.debt += _adder, _pledge.isCreated, _pledge.owner, _pledge.priority ); } /// @notice Sync the storage Pledge with the memory Pledge /// @param sPledge having all Pledge struct params (coll, debt, isCreated, owner, priority) /// @param _pledge having all Pledge struct params (coll, debt, isCreated, owner, priority) function sync( IYamato.Pledge storage sPledge, IYamato.Pledge memory _pledge ) public returns (IYamato.Pledge storage) { sPledge.coll = _pledge.coll; sPledge.debt = _pledge.debt; sPledge.isCreated = _pledge.isCreated; sPledge.owner = _pledge.owner; sPledge.priority = _pledge.priority; return sPledge; } /// @notice Assign one memory Pledge to the other memory Pledge /// @param mPledge is the Pledge that _pledge assigns to, & having all Pledge struct params (coll, debt, isCreated, owner, priority) /// @param _pledge is the Pledge that assigns to mPledge, & having all Pledge struct params (coll, debt, isCreated, owner, priority) function assign( IYamato.Pledge memory mPledge, IYamato.Pledge memory _pledge ) public returns (IYamato.Pledge memory) { mPledge.coll = _pledge.coll; mPledge.debt = _pledge.debt; mPledge.isCreated = _pledge.isCreated; mPledge.owner = _pledge.owner; mPledge.priority = _pledge.priority; return mPledge; } /// @notice Overwrite the memory Pledge with 0, false, and zero-address function nil(IYamato.Pledge memory) public returns (IYamato.Pledge memory) { return IYamato.Pledge(0, 0, false, address(0), 0); } /// @param _ICRpertenk IndividualCollateralRatio per 10k /// @dev Three linear fumula there are /// @return _FRpertenk Corresponding fee rate in uint256 per-ten-kilo unit function FR(uint256 _ICRpertenk) public view returns (uint256 _FRpertenk) { require(_ICRpertenk >= 13000, "ICR too low to get fee data."); // if (11000 <= _ICRpertenk && _ICRpertenk < 13000) { // _FRpertenk = 2000 - ((_ICRpertenk - 11000) * 80) / 100; // } else if (_ICRpertenk < 15000) { _FRpertenk = 400 - ((_ICRpertenk - 13000) * 10) / 100; } else if (15000 <= _ICRpertenk && _ICRpertenk < 20000) { _FRpertenk = 200 - ((_ICRpertenk - 15000) * 2) / 100; } else if (20000 <= _ICRpertenk && _ICRpertenk < 50000) { _FRpertenk = 100 - ((_ICRpertenk - 20000) * 3) / 10 / 100; } else { _FRpertenk = 10; } } /** * @notice Calculate the max amount that can redeem from the Pledge with MCR & ICR * @param pledge is the target pledge that you would like to calculate the max amont * @param mcr = Minimum Collateral Ratio * @param icr = Individual Collateral Ratio * @dev collValuAfter/debtAfter = mcr/10000 debtAfter = debtBefore - diff collValuAfter = collValuBefore - diff 10000 * (diff - collValuBefore) = mcr * (diff - debtBefore) (mcr - 10000) * diff = mcr * debtBefore - 10000 * collValuBefore diff = (mcr * debtBefore - 10000 * collValuBefore) / (mcr - 10000) diff = (mcr - icrBefore) / (mcr - 10000) * debtBefore [ Appendix. ] Let k = (mcr - icrBefore) / (mcr - 10000) diff = k * debtBefore Given mcr = 13000, then k = (13000 - icrBefore) / 3000 = -0.00033333333icrBefore + 4.33333333333 [10000<icrBefore<13000, 0<k<1] */ function cappedRedemptionAmount( IYamato.Pledge memory pledge, uint256 mcr, uint256 icr ) public view returns (uint256) { return (pledge.debt * (mcr - icr)) / (mcr - 10000); } /** * @notice Calculate the amount of redemption that will be redeemed * @param mcr = Minimum Collateral Ratio * @param icr = Individual Collateral Ratio * @param ethPriceInCurrency is the ETH price fetched from PriceFeed */ function toBeRedeemed( IYamato.Pledge memory pledge, uint256 mcr, uint256 icr, uint256 ethPriceInCurrency ) public view returns (uint256 _result) { if (icr < 10000) { // coll-based value _result = (pledge.coll * ethPriceInCurrency) / // Note: getRedeemablesCap's under-MCR value is based on unfetched price 1e18; } else if (10000 <= icr && icr < mcr) { // icr=130%-based value _result = cappedRedemptionAmount(pledge, mcr, icr); } else { _result = 0; } } }
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* Based on OpenZeppelin's SafeMath:
* https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol
*
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "hardhat/console.sol"; import "../Interfaces/IUUPSEtherscanVerifiable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; /// @title Universal Upgradeability Proxy Standard Base Contract /// @author 0xMotoko contract UUPSBase is IUUPSEtherscanVerifiable, Initializable, UUPSUpgradeable { address public governance; address public pendingGovernance; address public tester; event NewPendingGovernance(address _sender); event UpdateGovernance(address _sender); event RevokeGovernance(address _sender); function __UUPSBase_init() internal onlyInitializing { __UUPSBase_init_unchained(); } function __UUPSBase_init_unchained() internal onlyInitializing { governance = msg.sender; tester = msg.sender; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() {} function _authorizeUpgrade(address) internal override onlyGovernance {} function getImplementation() external view override returns (address) { return _getImplementation(); } modifier onlyGovernance() { require(msg.sender == governance, "You are not the governer."); _; } modifier onlyNewGovernance() { require( msg.sender == pendingGovernance, "You are not the pending governer." ); _; } /* 2-phase commit to avoid assigning non-owned address. */ function setGovernance(address _newGoverner) external onlyGovernance { pendingGovernance = _newGoverner; emit NewPendingGovernance(_newGoverner); } function acceptGovernance() external onlyNewGovernance { governance = pendingGovernance; emit UpdateGovernance(governance); } /* To make the contract immutable. */ function revokeGovernance() external onlyGovernance { governance = address(0); emit RevokeGovernance(msg.sender); } function revokeTester() public onlyGovernance { tester = address(0); } }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./YamatoBase.sol"; import "hardhat/console.sol"; /// @title Yamato Action Base Contract /// @author 0xMotoko contract YamatoAction is YamatoBase { function __YamatoAction_init(address _yamato) internal onlyInitializing { __YamatoBase_init(_yamato); __YamatoAction_init_unchained(); } function __YamatoAction_init_unchained() internal onlyInitializing {} /* These accessors are mandatory for all actions to interact with. */ function pool() public view returns (address) { return IYamato(yamato()).pool(); } function priorityRegistry() public view returns (address) { return IYamato(yamato()).priorityRegistry(); } }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./UUPSBase.sol"; import "../Interfaces/IYamato.sol"; import "../Interfaces/ICurrencyOS.sol"; import "hardhat/console.sol"; /// @title Yamato Action and Yamato Store Base Contract /// @author 0xMotoko contract YamatoBase is UUPSBase { string internal YAMATO_SLOT_ID; function __YamatoBase_init(address _yamato) internal onlyInitializing { __UUPSBase_init(); __YamatoBase_init_unchained(_yamato); } function __YamatoBase_init_unchained( address _yamato ) internal onlyInitializing { YAMATO_SLOT_ID = "deps.Yamato"; bytes32 YAMATO_KEY = bytes32(keccak256(abi.encode(YAMATO_SLOT_ID))); assembly { sstore(YAMATO_KEY, _yamato) } } /// @dev All YamatoStores and YamatoActions except Yamato.sol are NOT needed to modify these funcs. Just write the same signature and don't fill inside. Yamato.sol must override it with correct logic. function yamato() public view virtual returns (address _yamato) { bytes32 YAMATO_KEY = bytes32(keccak256(abi.encode(YAMATO_SLOT_ID))); assembly { _yamato := sload(YAMATO_KEY) } } /// @dev All YamatoStores and YamatoActions except Yamato.sol are NOT needed to modify these funcs. Just write the same signature and don't fill inside. Yamato.sol must override it with correct logic. function currencyOS() public view virtual returns (address) { return IYamato(yamato()).currencyOS(); } /// @dev All YamatoStores and YamatoActions except Yamato.sol are NOT needed to modify these funcs. Just write the same signature and don't fill inside. Yamato.sol must override it with correct logic. function feePool() public view virtual returns (address) { return ICurrencyOS(currencyOS()).feePool(); } /// @dev All YamatoStores and YamatoActions except Yamato.sol are NOT needed to modify these funcs. Just write the same signature and don't fill inside. Yamato.sol must override it with correct logic. function priceFeed() public view virtual returns (address) { return ICurrencyOS(currencyOS()).priceFeed(); } /// @dev All YamatoStores and YamatoActions except Yamato.sol are NOT needed to modify these funcs. Just write the same signature and don't fill inside. Yamato.sol must override it with correct logic. function permitDeps(address _sender) public view virtual returns (bool) { return IYamato(yamato()).permitDeps(_sender); } modifier onlyYamato() virtual { require(permitDeps(msg.sender), "You are not Yamato contract."); _; } }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./YamatoBase.sol"; import "hardhat/console.sol"; /// @title Yamato Store Base Contract /// @author 0xMotoko contract YamatoStore is YamatoBase { function __YamatoStore_init(address _yamato) internal { __YamatoBase_init(_yamato); } }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly interface ICurrencyOS { function mintCurrency(address to, uint256 amount) external; function burnCurrency(address to, uint256 amount) external; function priceFeed() external view returns (address); function feePool() external view returns (address); function currency() external view returns (address); function ymtOS() external view returns (address); function YMT() external view returns (address); function veYMT() external view returns (address); }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly interface IFeePool { function veYMT() external view returns (address); function withdrawFromProtocol(uint256 amount) external; }
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface IPriceFeedFlexV3 {
enum Status {
chainlinkWorking
}
struct ChainlinkResponse {
uint80 roundId;
int256 answer;
uint256 timestamp;
bool success;
uint8 decimals;
int256 subAnswer;
uint8 subDecimal;
uint256 subTimestamp;
}
function getStatus() external view returns (Status);
function ethPriceAggregatorInUSD()
external
view
returns (address _ethPriceAggregatorInUSD);
function jpyPriceAggregatorInUSD()
external
view
returns (address _jpyPriceAggregatorInUSD);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface IPriceFeedV3 {
/// @notice Mutable price getter.
function fetchPrice() external returns (uint256);
/// @notice Immutable price getter.
function getPrice() external view returns (uint256);
// The last good price seen from an oracle by Chainlink
function lastGoodPrice() external view returns (uint256);
}pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./IYamato.sol"; interface IPriorityRegistry { function upsert(IYamato.Pledge memory _pledge) external returns (uint256); function remove(IYamato.Pledge memory _pledge) external; function popRedeemable() external returns (IYamato.Pledge memory); function popSweepable() external returns (IYamato.Pledge memory); function LICR() external view returns (uint256); function pledgeLength() external view returns (uint256); function getLevelIndice( uint256 _icr, uint256 _i ) external view returns (address); function nextRedeemable() external view returns (IYamato.Pledge memory); function nextSweepable() external view returns (IYamato.Pledge memory); }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./IYamato.sol"; interface IPriorityRegistryV6 { function upsert(IYamato.Pledge memory _pledge) external returns (uint256); function bulkUpsert( IYamato.Pledge[] memory _pledges ) external returns (uint256[] memory); function remove(IYamato.Pledge memory _pledge) external; function LICR() external view returns (uint256); function rankedQueueNextout(uint256 _icr) external view returns (uint256); function rankedQueueLen(uint256 _icr) external view returns (uint256); function rankedQueueTotalLen(uint256 _icr) external view returns (uint256); function rankedQueuePush(uint256 _icr, address _pledgeAddr) external; function rankedQueuePop( uint256 _icr ) external returns (address _pledgeAddr); function rankedQueueSearchAndDestroy(uint256 _icr, uint256 _i) external; }
pragma solidity 0.8.4;
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright (C) 2024 Yamato Protocol (DeFiGeek Community Japan)
*/
import "./IYamatoV4.sol";
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
interface IScoreRegistry {
function checkpoint(address addr_) external;
function bulkCheckpoint(address[] memory pledgesOwner_) external;
function updateScoreLimit(
address addr_,
uint256 debt_,
uint256 totalDebt_,
uint256 collateralRatio_
) external;
function bulkUpdateScoreLimit(
IYamato.Pledge[] memory pledges_,
uint256 totalDebt_,
address priceFeedAddress_
) external;
function userCheckpoint(address addr_) external returns (bool);
function integrateFraction(address addr_) external view returns (uint256);
}pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly interface IUUPSEtherscanVerifiable { function getImplementation() external view returns (address); }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly interface IYamato { struct Pledge { uint256 coll; uint256 debt; bool isCreated; address owner; uint256 priority; } struct FlashLockData { uint256 lockedBlockHeight; } event Deposited(address indexed sender, uint256 ethAmount); event Borrowed(address indexed sender, uint256 currencyAmount, uint256 fee); event Repaid(address indexed sender, uint256 currencyAmount); event Withdrawn(address indexed sender, uint256 ethAmount); event Redeemed( address indexed sender, uint256 currencyAmount, uint256 ethAmount, address[] pledgesOwner ); event RedeemedMeta( address indexed sender, uint256 price, bool isCoreRedemption, uint256 gasCompensationAmount ); event Swept( address indexed sender, uint256 currencyAmount, uint256 gasCompensationAmount, address[] pledgesOwner ); function permitDeps(address _sender) external view returns (bool); function getPledge(address _owner) external view returns (Pledge memory); function checkFlashLock( address _owner ) external view returns (bool _isLocked); function setFlashLock(address _owner) external; function getStates() external view returns (uint256, uint256, uint8, uint8, uint8, uint8); function priceFeed() external view returns (address); function currencyOS() external view returns (address); function pool() external view returns (address); function priorityRegistry() external view returns (address); function depositor() external view returns (address); function borrower() external view returns (address); function repayer() external view returns (address); function withdrawer() external view returns (address); function redeemer() external view returns (address); function sweeper() external view returns (address); function setPledge(address _owner, Pledge memory _p) external; function setTotalColl(uint256 _totalColl) external; function setTotalDebt(uint256 _totalDebt) external; function MCR() external view returns (uint8); function GRR() external view returns (uint8); }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./IYamato.sol"; interface IYamatoRedeemer { // To avoid stack too deep error in the functions struct RunRedeemArgs { address sender; uint256 wantToRedeemCurrencyAmount; bool isCoreRedemption; } struct RunRedeemVars { uint256 ethPriceInCurrency; uint256 redeemStart; uint256 bearerBalance; uint256 currencyAmountStart; uint256 _reminder; address[] _pledgesOwner; uint256 _loopCount; uint8 _GRR; } struct RedeemedArgs { uint256 totalRedeemedCurrencyAmount; uint256 totalRedeemedEthAmount; address[] _pledgesOwner; uint256 ethPriceInCurrency; uint256 gasCompensationInETH; } function redeemPledge( IYamato.Pledge memory sPledge, uint256 currencyAmount, uint256 ethPriceInCurrency ) external returns (IYamato.Pledge memory, uint256); function runRedeem( RunRedeemArgs memory ) external returns (RedeemedArgs memory); }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./IYamato.sol"; import "./IYamatoRedeemer.sol"; interface IYamatoRedeemerV4 { // To avoid stack too deep error in the functions struct RunRedeemVars { uint256 ethPriceInCurrency; uint256 redeemStart; uint256 bearerBalance; uint256 currencyAmountStart; uint256 _reminder; address[] _pledgesOwner; uint256 _loopCount; uint8 _GRR; uint256 _mcrPercent; uint256 _mcrPertenk; uint256 _nextICR; uint256 _nextout; uint256 _nextin; uint256 _toBeRedeemed; uint256 _toBeRedeemedInEth; uint256 _effectiveRedemptionAmountInCurrency; uint256 _effectiveRedemptionAmount; uint256 _gasCompensationInETH; uint256 _count; uint256 _toBeRedeemedFragment; uint256 _toBeRedeemedFragmentInEth; uint256 _maxCount; uint256 _skipCount; uint256 _pledgeLength; uint256 _activePledgeLength; uint256 _checkpoint; IYamato.Pledge[] _bulkedPledges; IYamato.Pledge[] _skippedPledges; } function runRedeem( IYamatoRedeemer.RunRedeemArgs memory ) external returns (IYamatoRedeemer.RedeemedArgs memory); }
pragma solidity 0.8.4;
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright (C) 2024 Yamato Protocol (DeFiGeek Community Japan)
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
import "./IYamato.sol";
interface IYamatoV4 {
function setPledges(IYamato.Pledge[] memory _pledges) external;
function collFloor() external view returns (uint256);
function maxRedeemableCount() external view returns (uint256);
function CHECKPOINT_BUFFER() external view returns (uint256);
function scoreRegistry() external view returns (address);
function getTotalDebt() external view returns (uint256);
}pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./Interfaces/IYamato.sol"; import "./Interfaces/IFeePool.sol"; import "./Interfaces/ICurrencyOS.sol"; import "./Dependencies/YamatoStore.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "hardhat/console.sol"; interface IPool { event RedemptionReserveDeposited(address, uint256, uint256); event RedemptionReserveUsed(address, uint256, uint256); event SweepReserveDeposited(address, uint256, uint256); event SweepReserveUsed(address, uint256, uint256); event ETHLocked(address, uint256, uint256); event ETHSent(address, address, uint256, uint256); event CurrencySent(address, address, uint256); function depositRedemptionReserve(uint256 amount) external; function useRedemptionReserve(uint256 amount) external; function depositSweepReserve(uint256 amount) external; function useSweepReserve(uint256 amount) external; function sendETH(address recipient, uint256 amount) external; function sendCurrency(address recipient, uint256 amount) external; function redemptionReserve() external view returns (uint256); function sweepReserve() external view returns (uint256); } contract Pool is IPool, YamatoStore, ReentrancyGuardUpgradeable { uint256 public override redemptionReserve; // Auto redemption pool a.k.a. (kinda) Stability Pool in Liquity uint256 public override sweepReserve; // Protocol Controlling Value (PCV) to remove Pledges(coll=0, debt>0) function initialize(address _yamato) public initializer { __ReentrancyGuard_init(); __YamatoStore_init(_yamato); } receive() external payable onlyYamato { emit ETHLocked(msg.sender, msg.value, address(this).balance); } function depositRedemptionReserve( uint256 amount ) public override onlyYamato { ICurrencyOS(IYamato(yamato()).currencyOS()).mintCurrency( address(this), amount ); // onlyYamato redemptionReserve += amount; emit RedemptionReserveDeposited(msg.sender, amount, redemptionReserve); } function useRedemptionReserve(uint256 amount) public override onlyYamato { redemptionReserve -= amount; emit RedemptionReserveUsed(msg.sender, amount, redemptionReserve); } function depositSweepReserve(uint256 amount) public override onlyYamato { ICurrencyOS(IYamato(yamato()).currencyOS()).mintCurrency( address(this), amount ); // onlyYamato sweepReserve += amount; emit SweepReserveDeposited(msg.sender, amount, sweepReserve); } function useSweepReserve(uint256 amount) public override onlyYamato { sweepReserve -= amount; emit SweepReserveUsed(msg.sender, amount, sweepReserve); } function sendETH( address recipient, uint256 amount ) public override nonReentrant onlyYamato { require( address(this).balance >= amount, "locked collateral must be more than sending amount." ); (bool success, ) = payable(recipient).call{value: amount}(""); require(success, "transfer failed"); emit ETHSent(msg.sender, recipient, amount, address(this).balance); } function sendCurrency( address recipient, uint256 amount ) public override onlyYamato { IERC20 _currency = IERC20(ICurrencyOS(currencyOS()).currency()); _currency.transfer(recipient, amount); emit CurrencySent(msg.sender, recipient, amount); } /// @notice Provide the data of public storage. function getStates() public view returns (uint256, uint256, uint256, uint256) { return ( redemptionReserve, sweepReserve, address(feePool()).balance, address(this).balance ); } }
pragma solidity 0.8.4; /* * SPDX-License-Identifier: GPL-3.0-or-later * Written by 0xMotoko ([email protected]) * Copyright (C) 2021 Yamato Protocol (DeFiGeek Community Japan) */ //solhint-disable max-line-length //solhint-disable no-inline-assembly import "./Interfaces/IPriceFeedV3.sol"; import "./Interfaces/IPriceFeedFlexV3.sol"; import "./Dependencies/AggregatorV3Interface.sol"; import "./Dependencies/BaseMath.sol"; import "./Dependencies/UUPSBase.sol"; /* * PriceFeed for mainnet deployment, to be connected to Chainlink's live ETH:USD aggregator reference contract * * The PriceFeed uses Chainlink as primary oracle. It contains logic for * switching oracles based on oracle failures, timeouts, and conditions for returning to the primary * Chainlink oracle. */ contract PriceFeedV3 is IPriceFeedV3, IPriceFeedFlexV3, UUPSBase, BaseMath { /* ========================= ~~~ SAFE HAVEN ~~~ ========================= */ string constant EthPriceAggregatorInUSD_SLOT_ID = "deps.EthPriceAggregatorInUSD"; string constant JpyPriceAggregatorInUSD_SLOT_ID = "deps.JpyPriceAggregatorInUSD"; // Use to convert a price answer to an 18-digit precision uint uint256 public constant TARGET_DIGITS = 18; uint8 constant ETHUSD_DIGITS = 8; uint8 constant USDJPY_DIGITS = 8; // Maximum time period allowed since Chainlink's latest round data timestamp, beyond which Chainlink is considered frozen. uint256 public constant ETHUSD_TIMEOUT = 3600; // 1 hours: 60 * 60 uint256 public constant USDJPY_TIMEOUT = 86400; // 24 hours: 60 * 60 * 24 /* ========================= ~~~ SAFE HAVEN ~~~ ========================= */ /* ========================= !!! DANGER ZONE !!! - Proxy patterns (UUPS) stores state onto ERC1967Proxy via `delegatecall` opcode. - So modifying storage slot order in the next version of implementation would cause storage layout confliction. - You can check whether your change will conflict or not by using `@openzeppelin/upgrades` - Read more => https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#modifying-your-contracts ========================= */ // The last good price seen from an oracle by Chainlink uint256 public override lastGoodPrice; uint256 public lastSeen; // The current status of the PricFeed, which determines the conditions for the next price fetch attempt Status public status; /* ========================= --- END DANGER ZONE --- ========================= */ event LastGoodPriceUpdated(uint256 _lastGoodPrice); event PriceFeedStatusChanged(Status newStatus); function initialize( address _ethPriceAggregatorInUSDAddress, address _jpyPriceAggregatorInUSDAddress ) public initializer { __UUPSBase_init(); bytes32 EthPriceAggregatorInUSD_KEY = bytes32( keccak256(abi.encode(EthPriceAggregatorInUSD_SLOT_ID)) ); bytes32 JpyPriceAggregatorInUSD_KEY = bytes32( keccak256(abi.encode(JpyPriceAggregatorInUSD_SLOT_ID)) ); assembly { sstore(EthPriceAggregatorInUSD_KEY, _ethPriceAggregatorInUSDAddress) sstore(JpyPriceAggregatorInUSD_KEY, _jpyPriceAggregatorInUSDAddress) } // Explicitly set initial system status status = Status.chainlinkWorking; //Get an initial price from Chainlink to serve as first reference for lastGoodPrice ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse(); require( !_chainlinkIsBroken(chainlinkResponse) && !_chainlinkIsFrozen(chainlinkResponse), "PriceFeed: Chainlink must be working." ); _storeChainlinkPrice(chainlinkResponse); } // --- Functions --- /// @notice ChainLink ETH-USD oracle contract function ethPriceAggregatorInUSD() public view override returns (address _ethPriceAggregatorInUSD) { bytes32 EthPriceAggregatorInUSD_KEY = bytes32( keccak256(abi.encode(EthPriceAggregatorInUSD_SLOT_ID)) ); assembly { _ethPriceAggregatorInUSD := sload(EthPriceAggregatorInUSD_KEY) } } /// @notice ChainLink JPY-USD oracle contract function jpyPriceAggregatorInUSD() public view override returns (address _jpyPriceAggregatorInUSD) { bytes32 JpyPriceAggregatorInUSD_KEY = bytes32( keccak256(abi.encode(JpyPriceAggregatorInUSD_SLOT_ID)) ); assembly { _jpyPriceAggregatorInUSD := sload(JpyPriceAggregatorInUSD_KEY) } } /// @notice Mutable price getter. function fetchPrice() external override returns (uint256) { uint256 _price = _simulatePrice(); _storePrice(_price); return _price; } /// @notice Immutable price getter. function getPrice() external view override returns (uint256) { uint256 _price = _simulatePrice(); return _price; } /// @notice Immutable status getter. function getStatus() external view override returns (Status) { _simulatePrice(); return status; } /// @dev An internal function to dry run oracle usage determination logic. Can use it for view func or write func. ChainLink is the main oracle. function _simulatePrice() internal view returns (uint256 _price) { /* The early quit by 0xMotoko (Oct 13, 2021) */ if (lastSeen == block.number) return (lastGoodPrice); // Get current and previous price data from Chainlink ChainlinkResponse memory chainlinkResponse = _getCurrentChainlinkResponse(); if (_chainlinkIsBroken(chainlinkResponse)) { revert("chainlink is broken"); } // If Chainlink is frozen if (_chainlinkIsFrozen(chainlinkResponse)) { revert("chainlink is frozen"); } _price = _scaleChainlinkPriceByDigits( uint256(chainlinkResponse.answer), chainlinkResponse.decimals ); return _price; } // --- Helper functions --- /* Chainlink is considered broken if its current or previous round data is in any way bad. We check the previous round * for two reasons: * * 1) It is necessary data for the price deviation check in case 1, * and * 2) Chainlink is the PriceFeed's preferred primary oracle - having two consecutive valid round responses adds * peace of mind when using or returning to Chainlink. */ function _chainlinkIsBroken( ChainlinkResponse memory _response ) internal view returns (bool) { // Check for response call reverted if (!_response.success) { return true; } // Check for an invalid roundId that is 0 if (_response.roundId == 0) { return true; } // Check for an invalid timeStamp that is 0, or in the future if ( _response.timestamp == 0 || _response.timestamp > block.timestamp || _response.subTimestamp > block.timestamp ) { return true; } // Check for non-positive price if (_response.answer <= 0) { return true; } return false; } function _chainlinkIsFrozen( ChainlinkResponse memory _response ) internal view returns (bool) { return block.timestamp - _response.timestamp > ETHUSD_TIMEOUT || block.timestamp - _response.subTimestamp > USDJPY_TIMEOUT; } /// @notice Internal calculator of ChainLink digits padding. function _scaleChainlinkPriceByDigits( uint256 _price, uint256 _answerDigits ) internal pure returns (uint256 price) { /* * Convert the price returned by the Chainlink oracle to an 18-digit decimal for use by Liquity. * At date of Liquity launch, Chainlink uses an 8-digit price, but we also handle the possibility of * future changes. * */ if (_answerDigits >= TARGET_DIGITS) { // Scale the returned price value down to Liquity's target precision price = _price / (10 ** (_answerDigits - TARGET_DIGITS)); } else { // Scale the returned price value up to Liquity's target precision price = _price * (10 ** (TARGET_DIGITS - _answerDigits)); } return price; } /// @notice Internal price changer. function _storePrice(uint256 _currentPrice) internal { if (lastSeen == block.number) return; lastGoodPrice = _currentPrice; lastSeen = block.number; emit LastGoodPriceUpdated(_currentPrice); } /// @notice Internal price changer with digits calc. function _storeChainlinkPrice( ChainlinkResponse memory _chainlinkResponse ) internal returns (uint256) { uint256 scaledChainlinkPrice = _scaleChainlinkPriceByDigits( uint256(_chainlinkResponse.answer), _chainlinkResponse.decimals ); _storePrice(scaledChainlinkPrice); return scaledChainlinkPrice; } // --- Oracle response wrapper functions --- /// @notice ChainLink oracle response wrapper function _getCurrentChainlinkResponse() internal view returns (ChainlinkResponse memory chainlinkResponse) { ChainlinkResponse memory ethChainlinkResponseInUSD; ChainlinkResponse memory jpyChainlinkResponseInUSD; // First, try to get current decimal precision: try AggregatorV3Interface(ethPriceAggregatorInUSD()).decimals() returns (uint8 decimals) { // If call to Chainlink succeeds, record the current decimal precision ethChainlinkResponseInUSD.decimals = decimals; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return chainlinkResponse; } try AggregatorV3Interface(jpyPriceAggregatorInUSD()).decimals() returns (uint8 decimals) { // If call to Chainlink succeeds, record the current decimal precision jpyChainlinkResponseInUSD.decimals = decimals; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return chainlinkResponse; } // Secondly, try to get latest price data: try AggregatorV3Interface(ethPriceAggregatorInUSD()).latestRoundData() returns ( uint80 roundId, int256 answer, uint256 /* startedAt */, uint256 timestamp, uint80 /* answeredInRound */ ) { // If call to Chainlink succeeds, return the response and success = true ethChainlinkResponseInUSD.roundId = roundId; ethChainlinkResponseInUSD.answer = answer; ethChainlinkResponseInUSD.timestamp = timestamp; ethChainlinkResponseInUSD.success = true; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return chainlinkResponse; } try AggregatorV3Interface(jpyPriceAggregatorInUSD()).latestRoundData() returns ( uint80 roundId, int256 answer, uint256 /* startedAt */, uint256 timestamp, uint80 /* answeredInRound */ ) { // If call to Chainlink succeeds, return the response and success = true jpyChainlinkResponseInUSD.roundId = roundId; jpyChainlinkResponseInUSD.answer = answer; jpyChainlinkResponseInUSD.timestamp = timestamp; jpyChainlinkResponseInUSD.success = true; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return chainlinkResponse; } chainlinkResponse.roundId = ethChainlinkResponseInUSD.roundId; chainlinkResponse.decimals = uint8(TARGET_DIGITS); // Note: 0xMotoko at Mar 3, 2022. dec=18 was wrong here chainlinkResponse.answer = int256( (uint256(ethChainlinkResponseInUSD.answer) * (10 ** (TARGET_DIGITS - ethChainlinkResponseInUSD.decimals + jpyChainlinkResponseInUSD.decimals))) / uint256(jpyChainlinkResponseInUSD.answer) ); chainlinkResponse.timestamp = ethChainlinkResponseInUSD.timestamp; chainlinkResponse.success = ethChainlinkResponseInUSD.success && jpyChainlinkResponseInUSD.success; chainlinkResponse.subAnswer = jpyChainlinkResponseInUSD.answer; // TODO: What if JPYUSD changes a lot since the last ETHUSD feed round? (No way...) chainlinkResponse.subDecimal = jpyChainlinkResponseInUSD.decimals; chainlinkResponse.subTimestamp = jpyChainlinkResponseInUSD.timestamp; return chainlinkResponse; } }
pragma solidity 0.8.4;
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright (C) 2024 Yamato Protocol (DeFiGeek Community Japan)
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol";
/**
* @title YMT Token
* @notice Divident. Inflatable but the rate is to be decreasing.
*/
contract YMT is ERC20Permit {
event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply);
event SetMinter(address ymtMinter);
event SetAdmin(address admin);
address public ymtMinter;
address public admin;
// General constants
uint256 constant YEAR = 365 days;
// Supply parameters
uint256 constant INITIAL_SUPPLY = 200_000_000 * 10 ** 18;
uint256 constant VESTING_SUPPLY = 250_000_000 * 10 ** 18;
uint256 constant INITIAL_RATE = (55_000_000 * 10 ** 18) / YEAR;
uint256 constant RATE_REDUCTION_TIME = YEAR;
uint256 constant RATE_REDUCTION_COEFFICIENT = 1_111_111_111_111_111_111;
uint256 constant RATE_DENOMINATOR = 10 ** 18;
uint256 constant INFLATION_DELAY = 1 days;
// Supply variables
int128 public miningEpoch;
uint256 public startEpochTime;
uint256 public rate;
uint256 startEpochSupply;
uint256 public startTime;
constructor(
address ymtVestingAddr,
address initialMintAddr
) ERC20Permit("Yamato") ERC20("Yamato", "YMT") {
_mint(initialMintAddr, INITIAL_SUPPLY);
_mint(ymtVestingAddr, VESTING_SUPPLY);
admin = msg.sender;
startEpochTime =
block.timestamp +
INFLATION_DELAY -
RATE_REDUCTION_TIME;
startTime = block.timestamp;
miningEpoch = -1;
rate = 0;
startEpochSupply = INITIAL_SUPPLY + VESTING_SUPPLY;
}
/**
* @dev Update mining rate and supply at the start of the epoch
* Any modifying mining call must also call this
*/
function _updateMiningParameters() internal {
uint256 _rate = rate;
uint256 _startEpochSupply = startEpochSupply;
startEpochTime += RATE_REDUCTION_TIME;
++miningEpoch;
if (_rate == 0 && miningEpoch < 1) {
_rate = INITIAL_RATE;
} else {
_startEpochSupply += _rate * RATE_REDUCTION_TIME;
startEpochSupply = _startEpochSupply;
_rate = (_rate * RATE_DENOMINATOR) / RATE_REDUCTION_COEFFICIENT;
}
rate = _rate;
emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply);
}
/**
* @notice Update mining rate and supply at the start of the epoch
* @dev Callable by any address, but only once per epoch
* Total supply becomes slightly larger if(this function is called late
*/
function updateMiningParameters() external {
require(
block.timestamp >= startEpochTime + RATE_REDUCTION_TIME,
"dev: too soon!"
); // dev: too soon!
_updateMiningParameters();
}
/**
* @notice Get timestamp of the current mining epoch start
* while simultaneously updating mining parameters
* @return Timestamp of the epoch
*/
function startEpochTimeWrite() external returns (uint256) {
uint256 _startEpochTime = startEpochTime;
if (block.timestamp >= _startEpochTime + RATE_REDUCTION_TIME) {
_updateMiningParameters();
return startEpochTime;
} else {
return _startEpochTime;
}
}
/**
* @notice Get timestamp of the next mining epoch start
* while simultaneously updating mining parameters
* @return Timestamp of the next epoch
*/
function futureEpochTimeWrite() external returns (uint256) {
uint256 _startEpochTime = startEpochTime;
if (block.timestamp >= _startEpochTime + RATE_REDUCTION_TIME) {
_updateMiningParameters();
return startEpochTime + RATE_REDUCTION_TIME;
} else {
return _startEpochTime + RATE_REDUCTION_TIME;
}
}
function _availableSupply() internal view returns (uint256) {
return startEpochSupply + (block.timestamp - startEpochTime) * rate;
}
// @notice Current number of tokens in existence (claimed or unclaimed)
function availableSupply() external view returns (uint256) {
return _availableSupply();
}
/**
* @notice How much supply is mintable from start timestamp till end timestamp
* @param start Start of the time interval (timestamp)
* @param end End of the time interval (timestamp)
* @return Tokens mintable from `start` till `end`
*/
function mintableInTimeframe(
uint256 start,
uint256 end
) external view returns (uint256) {
require(start <= end, "dev: start > end"); // dev: start > end
uint256 to_mint;
uint256 currentEpochTime = startEpochTime;
uint256 currentRate = rate;
// Special case if(end is in future (not yet minted) epoch
if (end > currentEpochTime + RATE_REDUCTION_TIME) {
currentEpochTime += RATE_REDUCTION_TIME;
currentRate =
(currentRate * RATE_DENOMINATOR) /
RATE_REDUCTION_COEFFICIENT;
}
require(
end <= currentEpochTime + RATE_REDUCTION_TIME,
"dev: too far in future"
); // dev: too far in future
// Curve will not work in 1000 years. Darn!
for (uint i; i < 999; ) {
if (end >= currentEpochTime) {
uint256 currentEnd = end;
if (currentEnd > currentEpochTime + RATE_REDUCTION_TIME) {
currentEnd = currentEpochTime + RATE_REDUCTION_TIME;
}
uint256 currentStart = start;
if (currentStart >= currentEpochTime + RATE_REDUCTION_TIME) {
break; // We should never get here but what if...
} else if (currentStart < currentEpochTime) {
currentStart = currentEpochTime;
}
to_mint += currentRate * (currentEnd - currentStart);
if (start >= currentEpochTime) {
break;
}
}
currentEpochTime -= RATE_REDUCTION_TIME;
currentRate =
(currentRate * RATE_REDUCTION_COEFFICIENT) /
RATE_DENOMINATOR; // double-division with rounding made rate a bit less => good
require(currentRate <= INITIAL_RATE, "This should never happen"); // This should never happen
unchecked {
++i;
}
}
return to_mint;
}
/**
* @notice Set the ymtMinter address
* @dev Only callable once, when ymtMinter has not yet been set
* @param _ymtMinter Address of the ymtMinter
*/
function setMinter(address _ymtMinter) external onlyAdmin {
require(
_ymtMinter != address(0),
"dev: can set the ymtMinter only once, at creation"
); // dev: can set the ymtMinter only once, at creation
ymtMinter = _ymtMinter;
emit SetMinter(_ymtMinter);
}
/**
* @notice Set the new admin.
* @dev After all is set up, admin only can change the token name
* @param _admin New admin address
*/
function setAdmin(address _admin) external onlyAdmin {
admin = _admin;
emit SetAdmin(_admin);
}
/**
* @notice Mint `_value` tokens and assign them to `_to`
* @dev Emits a Transfer event originating from 0x00
* @param _to The account that will receive the created tokens
* @param _value The amount that will be created
* @return bool success
*/
function mint(address _to, uint256 _value) external returns (bool) {
require(msg.sender == ymtMinter, "dev: ymtMinter only"); // dev: ymtMinter only
require(_to != address(0), "dev: zero address"); // dev: zero address
if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {
_updateMiningParameters();
}
require(
totalSupply() + _value <= _availableSupply(),
"dev: exceeds allowable mint amount"
);
_mint(_to, _value);
return true;
}
/**
* @notice Burn `_value` tokens belonging to `msg.sender`
* @dev Emits a Transfer event with a destination of 0x00
* @param _value The amount that will be burned
* @return bool success
*/
function burn(uint256 _value) external returns (bool) {
_burn(msg.sender, _value);
return true;
}
modifier onlyAdmin() {
require(admin == msg.sender, "dev: admin only");
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity >= 0.4.22 <0.9.0;
library console {
address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
let payloadStart := add(payload, 32)
let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)
}
}
function log() internal view {
_sendLogPayload(abi.encodeWithSignature("log()"));
}
function logInt(int256 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(int256)", p0));
}
function logUint(uint256 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256)", p0));
}
function logString(string memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
}
function logBool(bool p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
}
function logAddress(address p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
}
function logBytes(bytes memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes)", p0));
}
function logBytes1(bytes1 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0));
}
function logBytes2(bytes2 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0));
}
function logBytes3(bytes3 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0));
}
function logBytes4(bytes4 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0));
}
function logBytes5(bytes5 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0));
}
function logBytes6(bytes6 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0));
}
function logBytes7(bytes7 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0));
}
function logBytes8(bytes8 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0));
}
function logBytes9(bytes9 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0));
}
function logBytes10(bytes10 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0));
}
function logBytes11(bytes11 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0));
}
function logBytes12(bytes12 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0));
}
function logBytes13(bytes13 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0));
}
function logBytes14(bytes14 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0));
}
function logBytes15(bytes15 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0));
}
function logBytes16(bytes16 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0));
}
function logBytes17(bytes17 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0));
}
function logBytes18(bytes18 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0));
}
function logBytes19(bytes19 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0));
}
function logBytes20(bytes20 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0));
}
function logBytes21(bytes21 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0));
}
function logBytes22(bytes22 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0));
}
function logBytes23(bytes23 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0));
}
function logBytes24(bytes24 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0));
}
function logBytes25(bytes25 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0));
}
function logBytes26(bytes26 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0));
}
function logBytes27(bytes27 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0));
}
function logBytes28(bytes28 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0));
}
function logBytes29(bytes29 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0));
}
function logBytes30(bytes30 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0));
}
function logBytes31(bytes31 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0));
}
function logBytes32(bytes32 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0));
}
function log(uint256 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256)", p0));
}
function log(string memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
}
function log(bool p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
}
function log(address p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
}
function log(uint256 p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256)", p0, p1));
}
function log(uint256 p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string)", p0, p1));
}
function log(uint256 p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool)", p0, p1));
}
function log(uint256 p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address)", p0, p1));
}
function log(string memory p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1));
}
function log(string memory p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1));
}
function log(string memory p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1));
}
function log(string memory p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1));
}
function log(bool p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256)", p0, p1));
}
function log(bool p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1));
}
function log(bool p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1));
}
function log(bool p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1));
}
function log(address p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256)", p0, p1));
}
function log(address p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1));
}
function log(address p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1));
}
function log(address p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1));
}
function log(uint256 p0, uint256 p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256)", p0, p1, p2));
}
function log(uint256 p0, uint256 p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string)", p0, p1, p2));
}
function log(uint256 p0, uint256 p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool)", p0, p1, p2));
}
function log(uint256 p0, uint256 p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address)", p0, p1, p2));
}
function log(uint256 p0, string memory p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256)", p0, p1, p2));
}
function log(uint256 p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,string)", p0, p1, p2));
}
function log(uint256 p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool)", p0, p1, p2));
}
function log(uint256 p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,address)", p0, p1, p2));
}
function log(uint256 p0, bool p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256)", p0, p1, p2));
}
function log(uint256 p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string)", p0, p1, p2));
}
function log(uint256 p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool)", p0, p1, p2));
}
function log(uint256 p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address)", p0, p1, p2));
}
function log(uint256 p0, address p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256)", p0, p1, p2));
}
function log(uint256 p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,string)", p0, p1, p2));
}
function log(uint256 p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool)", p0, p1, p2));
}
function log(uint256 p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,address)", p0, p1, p2));
}
function log(string memory p0, uint256 p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256)", p0, p1, p2));
}
function log(string memory p0, uint256 p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,string)", p0, p1, p2));
}
function log(string memory p0, uint256 p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool)", p0, p1, p2));
}
function log(string memory p0, uint256 p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,address)", p0, p1, p2));
}
function log(string memory p0, string memory p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint256)", p0, p1, p2));
}
function log(string memory p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2));
}
function log(string memory p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2));
}
function log(string memory p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2));
}
function log(string memory p0, bool p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256)", p0, p1, p2));
}
function log(string memory p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2));
}
function log(string memory p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2));
}
function log(string memory p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2));
}
function log(string memory p0, address p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint256)", p0, p1, p2));
}
function log(string memory p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2));
}
function log(string memory p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2));
}
function log(string memory p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2));
}
function log(bool p0, uint256 p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256)", p0, p1, p2));
}
function log(bool p0, uint256 p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string)", p0, p1, p2));
}
function log(bool p0, uint256 p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool)", p0, p1, p2));
}
function log(bool p0, uint256 p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address)", p0, p1, p2));
}
function log(bool p0, string memory p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256)", p0, p1, p2));
}
function log(bool p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2));
}
function log(bool p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2));
}
function log(bool p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2));
}
function log(bool p0, bool p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256)", p0, p1, p2));
}
function log(bool p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2));
}
function log(bool p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2));
}
function log(bool p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2));
}
function log(bool p0, address p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256)", p0, p1, p2));
}
function log(bool p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2));
}
function log(bool p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2));
}
function log(bool p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2));
}
function log(address p0, uint256 p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256)", p0, p1, p2));
}
function log(address p0, uint256 p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,string)", p0, p1, p2));
}
function log(address p0, uint256 p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool)", p0, p1, p2));
}
function log(address p0, uint256 p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,address)", p0, p1, p2));
}
function log(address p0, string memory p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint256)", p0, p1, p2));
}
function log(address p0, string memory p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2));
}
function log(address p0, string memory p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2));
}
function log(address p0, string memory p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2));
}
function log(address p0, bool p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256)", p0, p1, p2));
}
function log(address p0, bool p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2));
}
function log(address p0, bool p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2));
}
function log(address p0, bool p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2));
}
function log(address p0, address p1, uint256 p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint256)", p0, p1, p2));
}
function log(address p0, address p1, string memory p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2));
}
function log(address p0, address p1, bool p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2));
}
function log(address p0, address p1, address p2) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2));
}
function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,string)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,address)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,string)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,address)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,string)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,address)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,string)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, uint256 p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,address)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,string)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,address)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,string)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,address)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,string)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,address)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,string)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,address)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,string)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,address)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,string)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,address)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,string)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,address)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,string)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,address)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,string)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,address)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,string)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,address)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,string)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,address)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,uint256)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,string)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,bool)", p0, p1, p2, p3));
}
function log(uint256 p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, uint256 p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint256)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3));
}
function log(string memory p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,uint256)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,string)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,address)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,uint256)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,string)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,address)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,uint256)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,uint256)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,string)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, uint256 p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,uint256)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint256)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint256)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint256)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,uint256)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint256)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint256)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint256)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,uint256)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint256)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint256)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint256)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3));
}
function log(bool p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,uint256)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,string)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,bool)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,address)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,uint256)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,string)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,bool)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,address)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,uint256)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,string)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,address)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,uint256)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,string)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,bool)", p0, p1, p2, p3));
}
function log(address p0, uint256 p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,uint256)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint256)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint256)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint256)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3));
}
function log(address p0, string memory p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,uint256)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint256)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint256)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint256)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3));
}
function log(address p0, bool p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint256 p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,uint256)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint256 p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint256 p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, uint256 p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint256)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, string memory p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint256)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, bool p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, uint256 p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint256)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, string memory p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, bool p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3));
}
function log(address p0, address p1, address p2, address p3) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3));
}
}{
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"metadata": {
"useLiteralContent": true
},
"libraries": {
"contracts/Dependencies/PledgeLib.sol": {
"PledgeLib": "0x25026b8e547500c57ba63596de177da0808aad07"
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"NewPendingGovernance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"RevokeGovernance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"UpdateGovernance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currencyOS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_yamato","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"}],"name":"permitDeps","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priorityRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revokeGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeTester","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"wantToRedeemCurrencyAmount","type":"uint256"},{"internalType":"bool","name":"isCoreRedemption","type":"bool"}],"internalType":"struct IYamatoRedeemer.RunRedeemArgs","name":"_args","type":"tuple"}],"name":"runRedeem","outputs":[{"components":[{"internalType":"uint256","name":"totalRedeemedCurrencyAmount","type":"uint256"},{"internalType":"uint256","name":"totalRedeemedEthAmount","type":"uint256"},{"internalType":"address[]","name":"_pledgesOwner","type":"address[]"},{"internalType":"uint256","name":"ethPriceInCurrency","type":"uint256"},{"internalType":"uint256","name":"gasCompensationInETH","type":"uint256"}],"internalType":"struct IYamatoRedeemer.RedeemedArgs","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newGoverner","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tester","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"yamato","outputs":[{"internalType":"address","name":"_yamato","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a06040523060601b60805234801561001757600080fd5b5060805160601c6138a561005260003960008181612011015281816120960152818161218d0152818161221201526122fc01526138a56000f3fe60806040526004361061015f5760003560e01c80636f2c155b116100c0578063ab033ea911610074578063b1ddc24e11610059578063b1ddc24e14610353578063c4d66de814610368578063f39c38a01461038857600080fd5b8063ab033ea91461031e578063ae2e933b1461033e57600080fd5b80638308abd4116100a55780638308abd4146102b957806384ce4709146102d9578063aaf10f421461030957600080fd5b80636f2c155b1461028f578063741bef1a146102a457600080fd5b80633659cfe61161011757806352d1902d116100fc57806352d1902d146102375780635aa6e6751461025a5780635e4f60541461027a57600080fd5b80633659cfe6146102045780634f1ef2861461022457600080fd5b806319eb292c1161014857806319eb292c146101ab5780631c35ed1a146101c0578063238efcbc146101ed57600080fd5b806316f0115b14610164578063196e072914610196575b600080fd5b34801561017057600080fd5b506101796103a8565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101a257600080fd5b50610179610427565b3480156101b757600080fd5b50610179610469565b3480156101cc57600080fd5b506101e06101db3660046132ce565b6104ab565b60405161018d9190613665565b3480156101f957600080fd5b50610202611f2f565b005b34801561021057600080fd5b5061020261021f366004613098565b612006565b6102026102323660046130d0565b612182565b34801561024357600080fd5b5061024c6122ef565b60405190815260200161018d565b34801561026657600080fd5b50606554610179906001600160a01b031681565b34801561028657600080fd5b506101796123b4565b34801561029b57600080fd5b506102026123e8565b3480156102b057600080fd5b50610179612454565b3480156102c557600080fd5b50606754610179906001600160a01b031681565b3480156102e557600080fd5b506102f96102f4366004613098565b612496565b604051901515815260200161018d565b34801561031557600080fd5b5061017961253a565b34801561032a57600080fd5b50610202610339366004613098565b61256d565b34801561034a57600080fd5b5061017961261b565b34801561035f57600080fd5b5061020261265d565b34801561037457600080fd5b50610202610383366004613098565b6126f7565b34801561039457600080fd5b50606654610179906001600160a01b031681565b60006103b26123b4565b6001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b505afa1580156103fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042291906130b4565b905090565b60006104316123b4565b6001600160a01b031663196e07296040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b60006104736123b4565b6001600160a01b03166319eb292c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b6104dd6040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b6104e633612496565b6105375760405162461bcd60e51b815260206004820152601c60248201527f596f7520617265206e6f742059616d61746f20636f6e74726163742e0000000060448201526064015b60405180910390fd5b61060e60405180610380016040528060008152602001600081526020016000815260200160008152602001600081526020016060815260200160008152602001600060ff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6000610618610427565b90506000610624610469565b90506000816001600160a01b031663e5a6b10f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069991906130b4565b905060006106a56123b4565b90506106af612454565b6001600160a01b0316630fdb11cf6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190613236565b85526040870151156107fd576107356103a8565b6001600160a01b031663c05fb7246040518163ffffffff1660e01b815260040160206040518083038186803b15801561076d57600080fd5b505afa158015610781573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a59190613236565b602088018190526107f85760405162461bcd60e51b815260206004820181905260248201527f54686520726564656d7074696f6e207265736572766520697320656d7074792e604482015260640161052e565b61090b565b602087015187516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152908416906370a082319060240160206040518083038186803b15801561085f57600080fd5b505afa158015610873573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108979190613236565b101561090b5760405162461bcd60e51b815260206004820152602860248201527f496e73756666696369656e742063757272656e63792062616c616e636520746f60448201527f2072656465656d2e000000000000000000000000000000000000000000000000606482015260840161052e565b806001600160a01b0316631c7a75456040518163ffffffff1660e01b815260040160206040518083038186803b15801561094457600080fd5b505afa158015610958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097c919061339b565b60ff1660e0860152604080517f794e572400000000000000000000000000000000000000000000000000000000815290516001600160a01b0383169163794e5724916004808301926020929190829003018186803b1580156109dd57600080fd5b505afa1580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a15919061339b565b60ff166101008601819052610a2b90606461371e565b85610120018181525050836001600160a01b031663e82566516040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6e57600080fd5b505afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa69190613236565b610140860181905215610abe57846101400151610ac1565b60015b6101408601819052604051637249fe5560e11b815260048101919091526001600160a01b0385169063e493fcaa9060240160206040518083038186803b158015610b0a57600080fd5b505afa158015610b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b429190613236565b61016086015261014085015160405163db3320b560e01b815260048101919091526001600160a01b0385169063db3320b59060240160206040518083038186803b158015610b8f57600080fd5b505afa158015610ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc79190613236565b610180860152610bd56123b4565b6001600160a01b031663be4b98206040518163ffffffff1660e01b815260040160206040518083038186803b158015610c0d57600080fd5b505afa158015610c21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c459190613236565b6102a08601819052610c5890600261371e565b67ffffffffffffffff811115610c7e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610cec57816020015b610cd96040518060a00160405280600081526020016000815260200160001515815260200160006001600160a01b03168152602001600081525090565b815260200190600190039081610c9c5790505b506103408601526102a085015167ffffffffffffffff811115610d1f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d8d57816020015b610d7a6040518060a00160405280600081526020016000815260200160001515815260200160006001600160a01b03168152602001600081525090565b815260200190600190039081610d3d5790505b506103608601526102a085015167ffffffffffffffff811115610dc057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610de9578160200160208202803683370190505b5060a0860152610df76123b4565b6001600160a01b0316633436ec806040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2f57600080fd5b505afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e679190613236565b856101000151610e7791906136e6565b6103208601525b6101408501516040517fbfd093f00000000000000000000000000000000000000000000000000000000081526000916001600160a01b0387169163bfd093f091610ece9160040190815260200190565b602060405180830381600087803b158015610ee857600080fd5b505af1158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2091906130b4565b905085610320015186610140015110610f39575061168d565b6001600160a01b038116610f62576101408601805190610f58826137de565b8152505050610e7e565b6040517f90769e0e0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152600091908416906390769e0e9060240160a06040518083038186803b158015610fc057600080fd5b505afa158015610fd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff8919061324e565b87516040517faafaa81a0000000000000000000000000000000000000000000000000000000081529192506000917325026b8e547500c57ba63596de177da0808aad079163aafaa81a916110509186916004016135b4565b60206040518083038186803b15801561106857600080fd5b505af415801561107c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a09190613236565b90508761010001518861014001511480156110bf575087610120015181145b156111eb5761014088018051906110d5826137de565b905250610140880151604051637249fe5560e11b815260048101919091526001600160a01b0388169063e493fcaa9060240160206040518083038186803b15801561111f57600080fd5b505afa158015611133573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111579190613236565b61016089015261014088015160405163db3320b560e01b815260048101919091526001600160a01b0388169063db3320b59060240160206040518083038186803b1580156111a457600080fd5b505afa1580156111b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dc9190613236565b61018089015250610e7e915050565b61012088015188516040517f8bdf1ec20000000000000000000000000000000000000000000000000000000081527325026b8e547500c57ba63596de177da0808aad0792638bdf1ec292611246928792918791600401613605565b60206040518083038186803b15801561125e57600080fd5b505af4158015611272573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112969190613236565b61026089018190521580156112b057508761012001518110155b156113085781886103600151896102c00151815181106112e057634e487b7160e01b600052603260045260246000fd5b60209081029190910101526102c088018051906112fc826137de565b81525050505050610e7e565b8960200151886102600151896101a0015161132391906136e6565b111561134557876101a001518a6020015161133e919061373d565b6102608901525b875161026089015161135f90670de0b6b3a764000061371e565b61136991906136fe565b6102808901819052825110156113e75760405162461bcd60e51b815260206004820152602e60248201527f726564656d7074696f6e20667261676d656e742063616e27742062652062696760448201527f676572207468616e20636f6c6c2e000000000000000000000000000000000000606482015260840161052e565b61028088015182516000916113fb9161373d565b905060008961026001518460200151611414919061373d565b90506000808311801561144657508a518290670de0b6b3a76400009061143a908661371e565b61144491906136fe565b105b90506000670de0b6b3a76400008c6000015185611463919061371e565b61146d91906136fe565b8c610260015161147d91906136e6565b905060008e60200151828e6101a0015161149791906136e6565b111590508280156114a55750805b1561154457848d610280018181516114bd91906136e6565b90525086516102808e01511461153b5760405162461bcd60e51b815260206004820152602560248201527f466f72204943523d302520706c656467652c20636f6c6c206d7573742062652060448201527f7a65726f2e000000000000000000000000000000000000000000000000000000606482015260840161052e565b6102608d018290525b8c61026001518760200181815161155b919061373d565b9052506102808d01518751889061157390839061373d565b9052506102608d01516101a08e01805161158e9083906136e6565b9052506102808d01516101c08e0180516115a99083906136e6565b905250606087015160a08e01516102408f0151815181106115da57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050868d61034001518e61024001518151811061162557634e487b7160e01b600052603260045260246000fd5b60209081029190910101526102408d01805190611641826137de565b90525060208f01516101a08e0151141561166257505050505050505061168d565b8c6102a001518d61024001511061168057505050505050505061168d565b5050505050505050610e7e565b6000856101a00151116116e25760405162461bcd60e51b815260206004820152601860248201527f4e6f20706c6564676573206172652072656465656d65642e0000000000000000604482015260640161052e565b8660200151856101a0015111156117615760405162461bcd60e51b815260206004820152602a60248201527f52656465656d696e6720616d6f756e742065786365656473206265617265722760448201527f732062616c616e63652e00000000000000000000000000000000000000000000606482015260840161052e565b60005b856102a001518110156117e657856103600151818151811061179657634e487b7160e01b600052603260045260246000fd5b602002602001015186610340015182886102a001516117b591906136e6565b815181106117d357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600101611764565b506103408501516040517fdbdeac530000000000000000000000000000000000000000000000000000000081526000916001600160a01b0387169163dbdeac539161183391600401613496565b600060405180830381600087803b15801561184d57600080fd5b505af1158015611861573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118899190810190613172565b905060005b86610340015151811015611908578181815181106118bc57634e487b7160e01b600052603260045260246000fd5b602002602001015187610340015182815181106118e957634e487b7160e01b600052603260045260246000fd5b602090810291909101015160800152611901816137de565b905061188e565b506119116123b4565b6001600160a01b031663aed40bdb8761034001516040518263ffffffff1660e01b81526004016119419190613496565b600060405180830381600087803b15801561195b57600080fd5b505af115801561196f573d6000803e3d6000fd5b5050505060008061197e6123b4565b6001600160a01b031663d8ab82746040518163ffffffff1660e01b815260040160c06040518083038186803b1580156119b657600080fd5b505afa1580156119ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ee9190613336565b50505050915091506119fe6123b4565b6001600160a01b031663cf5a4260896101a0015183611a1d919061373d565b6040518263ffffffff1660e01b8152600401611a3b91815260200190565b600060405180830381600087803b158015611a5557600080fd5b505af1158015611a69573d6000803e3d6000fd5b50505050611a756123b4565b6001600160a01b03166385450bf7896101c0015184611a94919061373d565b6040518263ffffffff1660e01b8152600401611ab291815260200190565b600060405180830381600087803b158015611acc57600080fd5b505af1158015611ae0573d6000803e3d6000fd5b505050506000611aee6123b4565b6001600160a01b0316633eb8104a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611b2657600080fd5b505afa158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e91906130b4565b60a08a01516040517f246cd1670000000000000000000000000000000000000000000000000000000081529192506001600160a01b0383169163246cd16791611ba991600401613483565b600060405180830381600087803b158015611bc357600080fd5b505af1158015611bd7573d6000803e3d6000fd5b50505050806001600160a01b031663061e42238a61034001518b6101a0015185611c01919061373d565b611c09612454565b6040518463ffffffff1660e01b8152600401611c27939291906134a9565b600060405180830381600087803b158015611c4157600080fd5b505af1158015611c55573d6000803e3d6000fd5b505050506000808c6040015115611ceb57611c6e6103a8565b9150611c7861261b565b9050611c826103a8565b6001600160a01b03166391fc0a3a8c6101a001516040518263ffffffff1660e01b8152600401611cb491815260200190565b600060405180830381600087803b158015611cce57600080fd5b505af1158015611ce2573d6000803e3d6000fd5b50505050611cf1565b50508a51805b6101a08b01516040517f4852a7170000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820192909252908a1690634852a71790604401600060405180830381600087803b158015611d5c57600080fd5b505af1158015611d70573d6000803e3d6000fd5b5050505060648b60e001516064611d879190613754565b60ff168c6101a00151611d9a919061371e565b611da491906136fe565b6101e08c015260e08b0151606490611dbc9082613754565b60ff168c6101c00151611dcf919061371e565b611dd991906136fe565b6102008c0152611de76103a8565b6102008c01516040516364a197f360e01b81526001600160a01b03848116600483015260248201929092529116906364a197f390604401600060405180830381600087803b158015611e3857600080fd5b505af1158015611e4c573d6000803e3d6000fd5b5050506102008c01516101c08d0151611e65925061373d565b6102208c0152611e736103a8565b8d516102208d01516040516364a197f360e01b81526001600160a01b03928316600482015260248101919091529116906364a197f390604401600060405180830381600087803b158015611ec657600080fd5b505af1158015611eda573d6000803e3d6000fd5b505050506040518060a001604052808c6101e0015181526020018c610200015181526020018c60a0015181526020018c6000015181526020018c61022001518152509b5050505050505050505050505b919050565b6066546001600160a01b03163314611faf5760405162461bcd60e51b815260206004820152602160248201527f596f7520617265206e6f74207468652070656e64696e6720676f7665726e657260448201527f2e00000000000000000000000000000000000000000000000000000000000000606482015260840161052e565b606654606580546001600160a01b0319166001600160a01b0390921691821790556040519081527f8d55d160c0009eb3d739442df0a3ca089ed64378bfac017e7ddad463f9815b87906020015b60405180910390a1565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156120945760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b606482015260840161052e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166120ef7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b03161461215a5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161052e565b61216381612818565b6040805160008082526020820190925261217f91839190612872565b50565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156122105760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b606482015260840161052e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661226b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146122d65760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161052e565b6122df82612818565b6122eb82826001612872565b5050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461238f5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161052e565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60008060686040516020016123c9919061350e565b60408051601f1981840301815291905280516020909101205492915050565b6065546001600160a01b031633146124425760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b606780546001600160a01b0319169055565b600061245e610469565b6001600160a01b031663741bef1a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b60006124a06123b4565b6040517f84ce47090000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015291909116906384ce47099060240160206040518083038186803b1580156124fc57600080fd5b505afa158015612510573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612534919061321a565b92915050565b60006104227f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6065546001600160a01b031633146125c75760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b606680546001600160a01b0319166001600160a01b0383169081179091556040519081527f90ad4c550d25bd23af61db38d1ff8671b89edaaa0bca0fc36bac5084ecc120bd9060200160405180910390a150565b6000612625610469565b6001600160a01b031663ae2e933b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b6065546001600160a01b031633146126b75760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b606580546001600160a01b03191690556040513381527f24e4875c487b4800d52ab8484eb3ad19b3485a88e0b19b6cfdac90da12ee55fd90602001611ffc565b600054610100900460ff16158080156127175750600054600160ff909116105b806127315750303b158015612731575060005460ff166001145b6127a35760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161052e565b6000805460ff1916600117905580156127c6576000805461ff0019166101001790555b6127cf82612a26565b80156122eb576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6065546001600160a01b0316331461217f5760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156128aa576128a583612aa2565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156128e357600080fd5b505afa925050508015612913575060408051601f3d908101601f1916820190925261291091810190613236565b60015b6129855760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f742055555053000000000000000000000000000000000000606482015260840161052e565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612a1a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c65555549440000000000000000000000000000000000000000000000606482015260840161052e565b506128a5838383612b60565b600054610100900460ff16612a915760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b612a9a81612b8b565b61217f612c07565b6001600160a01b0381163b612b1f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161052e565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b612b6983612c74565b600082511180612b765750805b156128a557612b858383612cb4565b50505050565b600054610100900460ff16612bf65760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b612bfe612dbf565b61217f81612e32565b600054610100900460ff16612c725760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b565b612c7d81612aa2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b612d335760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161052e565b600080846001600160a01b031684604051612d4e9190613467565b600060405180830381855af49150503d8060008114612d89576040519150601f19603f3d011682016040523d82523d6000602084013e612d8e565b606091505b5091509150612db6828260405180606001604052806027815260200161384960279139612f15565b95945050505050565b600054610100900460ff16612e2a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b612c72612f35565b600054610100900460ff16612e9d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b60408051808201909152600b8082527f646570732e59616d61746f0000000000000000000000000000000000000000006020909201918252612ee191606891612fee565b5060006068604051602001612ef6919061350e565b6040516020818303038152906040528051906020012090508181555050565b60608315612f24575081612f2e565b612f2e8383612fc4565b9392505050565b600054610100900460ff16612fa05760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b60658054336001600160a01b03199182168117909255606780549091169091179055565b815115612fd45781518083602001fd5b8060405162461bcd60e51b815260040161052e91906134db565b828054612ffa906137a3565b90600052602060002090601f01602090048101928261301c5760008555613062565b82601f1061303557805160ff1916838001178555613062565b82800160010185558215613062579182015b82811115613062578251825591602001919060010190613047565b5061306e929150613072565b5090565b5b8082111561306e5760008155600101613073565b805160ff81168114611f2a57600080fd5b6000602082840312156130a9578081fd5b8135612f2e81613825565b6000602082840312156130c5578081fd5b8151612f2e81613825565b600080604083850312156130e2578081fd5b82356130ed81613825565b915060208381013567ffffffffffffffff8082111561310a578384fd5b818601915086601f83011261311d578384fd5b81358181111561312f5761312f61380f565b613141601f8201601f191685016136b5565b91508082528784828501011115613156578485fd5b8084840185840137810190920192909252919491935090915050565b60006020808385031215613184578182fd5b825167ffffffffffffffff8082111561319b578384fd5b818501915085601f8301126131ae578384fd5b8151818111156131c0576131c061380f565b8060051b91506131d18483016136b5565b8181528481019084860184860187018a10156131eb578788fd5b8795505b8386101561320d5780518352600195909501949186019186016131ef565b5098975050505050505050565b60006020828403121561322b578081fd5b8151612f2e8161383a565b600060208284031215613247578081fd5b5051919050565b600060a0828403121561325f578081fd5b60405160a0810181811067ffffffffffffffff821117156132825761328261380f565b8060405250825181526020830151602082015260408301516132a38161383a565b604082015260608301516132b681613825565b60608201526080928301519281019290925250919050565b6000606082840312156132df578081fd5b6040516060810181811067ffffffffffffffff821117156133025761330261380f565b604052823561331081613825565b815260208381013590820152604083013561332a8161383a565b60408201529392505050565b60008060008060008060c0878903121561334e578182fd5b865195506020870151945061336560408801613087565b935061337360608801613087565b925061338160808801613087565b915061338f60a08801613087565b90509295509295509295565b6000602082840312156133ac578081fd5b612f2e82613087565b6000815180845260208085019450808401835b838110156133ed5781516001600160a01b0316875295820195908201906001016133c8565b509495945050505050565b6000815180845260208085019450808401835b838110156133ed5761345487835180518252602081015160208301526040810151151560408301526001600160a01b036060820151166060830152608081015160808301525050565b60a096909601959082019060010161340b565b60008251613479818460208701613777565b9190910192915050565b602081526000612f2e60208301846133b5565b602081526000612f2e60208301846133f8565b6060815260006134bc60608301866133f8565b90508360208301526001600160a01b0383166040830152949350505050565b60208152600082518060208401526134fa816040850160208701613777565b601f01601f19169190910160400192915050565b6000602080835281845483600182811c91508083168061352f57607f831692505b85831081141561354d57634e487b7160e01b87526022600452602487fd5b87860183815260200181801561356a576001811461357b576135a5565b60ff198616825287820196506135a5565b60008b815260209020895b8681101561359f57815484820152908501908901613586565b83019750505b50949998505050505050505050565b60c081016135f8828580518252602081015160208301526040810151151560408301526001600160a01b036060820151166060830152608081015160808301525050565b8260a08301529392505050565b610100810161364a828780518252602081015160208301526040810151151560408301526001600160a01b036060820151166060830152608081015160808301525050565b8460a08301528360c08301528260e083015295945050505050565b6020815281516020820152602082015160408201526000604083015160a0606084015261369560c08401826133b5565b905060608401516080840152608084015160a08401528091505092915050565b604051601f8201601f1916810167ffffffffffffffff811182821017156136de576136de61380f565b604052919050565b600082198211156136f9576136f96137f9565b500190565b60008261371957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613738576137386137f9565b500290565b60008282101561374f5761374f6137f9565b500390565b600060ff821660ff84168082101561376e5761376e6137f9565b90039392505050565b60005b8381101561379257818101518382015260200161377a565b83811115612b855750506000910152565b600181811c908216806137b757607f821691505b602082108114156137d857634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156137f2576137f26137f9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461217f57600080fd5b801515811461217f57600080fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ac5129e55424de7a934fe1c0cb575e45ab1fc58c38560ecaff1a9fb2d34f321764736f6c63430008040033
Deployed Bytecode
0x60806040526004361061015f5760003560e01c80636f2c155b116100c0578063ab033ea911610074578063b1ddc24e11610059578063b1ddc24e14610353578063c4d66de814610368578063f39c38a01461038857600080fd5b8063ab033ea91461031e578063ae2e933b1461033e57600080fd5b80638308abd4116100a55780638308abd4146102b957806384ce4709146102d9578063aaf10f421461030957600080fd5b80636f2c155b1461028f578063741bef1a146102a457600080fd5b80633659cfe61161011757806352d1902d116100fc57806352d1902d146102375780635aa6e6751461025a5780635e4f60541461027a57600080fd5b80633659cfe6146102045780634f1ef2861461022457600080fd5b806319eb292c1161014857806319eb292c146101ab5780631c35ed1a146101c0578063238efcbc146101ed57600080fd5b806316f0115b14610164578063196e072914610196575b600080fd5b34801561017057600080fd5b506101796103a8565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101a257600080fd5b50610179610427565b3480156101b757600080fd5b50610179610469565b3480156101cc57600080fd5b506101e06101db3660046132ce565b6104ab565b60405161018d9190613665565b3480156101f957600080fd5b50610202611f2f565b005b34801561021057600080fd5b5061020261021f366004613098565b612006565b6102026102323660046130d0565b612182565b34801561024357600080fd5b5061024c6122ef565b60405190815260200161018d565b34801561026657600080fd5b50606554610179906001600160a01b031681565b34801561028657600080fd5b506101796123b4565b34801561029b57600080fd5b506102026123e8565b3480156102b057600080fd5b50610179612454565b3480156102c557600080fd5b50606754610179906001600160a01b031681565b3480156102e557600080fd5b506102f96102f4366004613098565b612496565b604051901515815260200161018d565b34801561031557600080fd5b5061017961253a565b34801561032a57600080fd5b50610202610339366004613098565b61256d565b34801561034a57600080fd5b5061017961261b565b34801561035f57600080fd5b5061020261265d565b34801561037457600080fd5b50610202610383366004613098565b6126f7565b34801561039457600080fd5b50606654610179906001600160a01b031681565b60006103b26123b4565b6001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b505afa1580156103fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042291906130b4565b905090565b60006104316123b4565b6001600160a01b031663196e07296040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b60006104736123b4565b6001600160a01b03166319eb292c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b6104dd6040518060a0016040528060008152602001600081526020016060815260200160008152602001600081525090565b6104e633612496565b6105375760405162461bcd60e51b815260206004820152601c60248201527f596f7520617265206e6f742059616d61746f20636f6e74726163742e0000000060448201526064015b60405180910390fd5b61060e60405180610380016040528060008152602001600081526020016000815260200160008152602001600081526020016060815260200160008152602001600060ff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6000610618610427565b90506000610624610469565b90506000816001600160a01b031663e5a6b10f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069991906130b4565b905060006106a56123b4565b90506106af612454565b6001600160a01b0316630fdb11cf6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190613236565b85526040870151156107fd576107356103a8565b6001600160a01b031663c05fb7246040518163ffffffff1660e01b815260040160206040518083038186803b15801561076d57600080fd5b505afa158015610781573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a59190613236565b602088018190526107f85760405162461bcd60e51b815260206004820181905260248201527f54686520726564656d7074696f6e207265736572766520697320656d7074792e604482015260640161052e565b61090b565b602087015187516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152908416906370a082319060240160206040518083038186803b15801561085f57600080fd5b505afa158015610873573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108979190613236565b101561090b5760405162461bcd60e51b815260206004820152602860248201527f496e73756666696369656e742063757272656e63792062616c616e636520746f60448201527f2072656465656d2e000000000000000000000000000000000000000000000000606482015260840161052e565b806001600160a01b0316631c7a75456040518163ffffffff1660e01b815260040160206040518083038186803b15801561094457600080fd5b505afa158015610958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097c919061339b565b60ff1660e0860152604080517f794e572400000000000000000000000000000000000000000000000000000000815290516001600160a01b0383169163794e5724916004808301926020929190829003018186803b1580156109dd57600080fd5b505afa1580156109f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a15919061339b565b60ff166101008601819052610a2b90606461371e565b85610120018181525050836001600160a01b031663e82566516040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6e57600080fd5b505afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa69190613236565b610140860181905215610abe57846101400151610ac1565b60015b6101408601819052604051637249fe5560e11b815260048101919091526001600160a01b0385169063e493fcaa9060240160206040518083038186803b158015610b0a57600080fd5b505afa158015610b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b429190613236565b61016086015261014085015160405163db3320b560e01b815260048101919091526001600160a01b0385169063db3320b59060240160206040518083038186803b158015610b8f57600080fd5b505afa158015610ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc79190613236565b610180860152610bd56123b4565b6001600160a01b031663be4b98206040518163ffffffff1660e01b815260040160206040518083038186803b158015610c0d57600080fd5b505afa158015610c21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c459190613236565b6102a08601819052610c5890600261371e565b67ffffffffffffffff811115610c7e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610cec57816020015b610cd96040518060a00160405280600081526020016000815260200160001515815260200160006001600160a01b03168152602001600081525090565b815260200190600190039081610c9c5790505b506103408601526102a085015167ffffffffffffffff811115610d1f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d8d57816020015b610d7a6040518060a00160405280600081526020016000815260200160001515815260200160006001600160a01b03168152602001600081525090565b815260200190600190039081610d3d5790505b506103608601526102a085015167ffffffffffffffff811115610dc057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610de9578160200160208202803683370190505b5060a0860152610df76123b4565b6001600160a01b0316633436ec806040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2f57600080fd5b505afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e679190613236565b856101000151610e7791906136e6565b6103208601525b6101408501516040517fbfd093f00000000000000000000000000000000000000000000000000000000081526000916001600160a01b0387169163bfd093f091610ece9160040190815260200190565b602060405180830381600087803b158015610ee857600080fd5b505af1158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2091906130b4565b905085610320015186610140015110610f39575061168d565b6001600160a01b038116610f62576101408601805190610f58826137de565b8152505050610e7e565b6040517f90769e0e0000000000000000000000000000000000000000000000000000000081526001600160a01b038281166004830152600091908416906390769e0e9060240160a06040518083038186803b158015610fc057600080fd5b505afa158015610fd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff8919061324e565b87516040517faafaa81a0000000000000000000000000000000000000000000000000000000081529192506000917325026b8e547500c57ba63596de177da0808aad079163aafaa81a916110509186916004016135b4565b60206040518083038186803b15801561106857600080fd5b505af415801561107c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a09190613236565b90508761010001518861014001511480156110bf575087610120015181145b156111eb5761014088018051906110d5826137de565b905250610140880151604051637249fe5560e11b815260048101919091526001600160a01b0388169063e493fcaa9060240160206040518083038186803b15801561111f57600080fd5b505afa158015611133573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111579190613236565b61016089015261014088015160405163db3320b560e01b815260048101919091526001600160a01b0388169063db3320b59060240160206040518083038186803b1580156111a457600080fd5b505afa1580156111b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dc9190613236565b61018089015250610e7e915050565b61012088015188516040517f8bdf1ec20000000000000000000000000000000000000000000000000000000081527325026b8e547500c57ba63596de177da0808aad0792638bdf1ec292611246928792918791600401613605565b60206040518083038186803b15801561125e57600080fd5b505af4158015611272573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112969190613236565b61026089018190521580156112b057508761012001518110155b156113085781886103600151896102c00151815181106112e057634e487b7160e01b600052603260045260246000fd5b60209081029190910101526102c088018051906112fc826137de565b81525050505050610e7e565b8960200151886102600151896101a0015161132391906136e6565b111561134557876101a001518a6020015161133e919061373d565b6102608901525b875161026089015161135f90670de0b6b3a764000061371e565b61136991906136fe565b6102808901819052825110156113e75760405162461bcd60e51b815260206004820152602e60248201527f726564656d7074696f6e20667261676d656e742063616e27742062652062696760448201527f676572207468616e20636f6c6c2e000000000000000000000000000000000000606482015260840161052e565b61028088015182516000916113fb9161373d565b905060008961026001518460200151611414919061373d565b90506000808311801561144657508a518290670de0b6b3a76400009061143a908661371e565b61144491906136fe565b105b90506000670de0b6b3a76400008c6000015185611463919061371e565b61146d91906136fe565b8c610260015161147d91906136e6565b905060008e60200151828e6101a0015161149791906136e6565b111590508280156114a55750805b1561154457848d610280018181516114bd91906136e6565b90525086516102808e01511461153b5760405162461bcd60e51b815260206004820152602560248201527f466f72204943523d302520706c656467652c20636f6c6c206d7573742062652060448201527f7a65726f2e000000000000000000000000000000000000000000000000000000606482015260840161052e565b6102608d018290525b8c61026001518760200181815161155b919061373d565b9052506102808d01518751889061157390839061373d565b9052506102608d01516101a08e01805161158e9083906136e6565b9052506102808d01516101c08e0180516115a99083906136e6565b905250606087015160a08e01516102408f0151815181106115da57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050868d61034001518e61024001518151811061162557634e487b7160e01b600052603260045260246000fd5b60209081029190910101526102408d01805190611641826137de565b90525060208f01516101a08e0151141561166257505050505050505061168d565b8c6102a001518d61024001511061168057505050505050505061168d565b5050505050505050610e7e565b6000856101a00151116116e25760405162461bcd60e51b815260206004820152601860248201527f4e6f20706c6564676573206172652072656465656d65642e0000000000000000604482015260640161052e565b8660200151856101a0015111156117615760405162461bcd60e51b815260206004820152602a60248201527f52656465656d696e6720616d6f756e742065786365656473206265617265722760448201527f732062616c616e63652e00000000000000000000000000000000000000000000606482015260840161052e565b60005b856102a001518110156117e657856103600151818151811061179657634e487b7160e01b600052603260045260246000fd5b602002602001015186610340015182886102a001516117b591906136e6565b815181106117d357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600101611764565b506103408501516040517fdbdeac530000000000000000000000000000000000000000000000000000000081526000916001600160a01b0387169163dbdeac539161183391600401613496565b600060405180830381600087803b15801561184d57600080fd5b505af1158015611861573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118899190810190613172565b905060005b86610340015151811015611908578181815181106118bc57634e487b7160e01b600052603260045260246000fd5b602002602001015187610340015182815181106118e957634e487b7160e01b600052603260045260246000fd5b602090810291909101015160800152611901816137de565b905061188e565b506119116123b4565b6001600160a01b031663aed40bdb8761034001516040518263ffffffff1660e01b81526004016119419190613496565b600060405180830381600087803b15801561195b57600080fd5b505af115801561196f573d6000803e3d6000fd5b5050505060008061197e6123b4565b6001600160a01b031663d8ab82746040518163ffffffff1660e01b815260040160c06040518083038186803b1580156119b657600080fd5b505afa1580156119ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ee9190613336565b50505050915091506119fe6123b4565b6001600160a01b031663cf5a4260896101a0015183611a1d919061373d565b6040518263ffffffff1660e01b8152600401611a3b91815260200190565b600060405180830381600087803b158015611a5557600080fd5b505af1158015611a69573d6000803e3d6000fd5b50505050611a756123b4565b6001600160a01b03166385450bf7896101c0015184611a94919061373d565b6040518263ffffffff1660e01b8152600401611ab291815260200190565b600060405180830381600087803b158015611acc57600080fd5b505af1158015611ae0573d6000803e3d6000fd5b505050506000611aee6123b4565b6001600160a01b0316633eb8104a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611b2657600080fd5b505afa158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e91906130b4565b60a08a01516040517f246cd1670000000000000000000000000000000000000000000000000000000081529192506001600160a01b0383169163246cd16791611ba991600401613483565b600060405180830381600087803b158015611bc357600080fd5b505af1158015611bd7573d6000803e3d6000fd5b50505050806001600160a01b031663061e42238a61034001518b6101a0015185611c01919061373d565b611c09612454565b6040518463ffffffff1660e01b8152600401611c27939291906134a9565b600060405180830381600087803b158015611c4157600080fd5b505af1158015611c55573d6000803e3d6000fd5b505050506000808c6040015115611ceb57611c6e6103a8565b9150611c7861261b565b9050611c826103a8565b6001600160a01b03166391fc0a3a8c6101a001516040518263ffffffff1660e01b8152600401611cb491815260200190565b600060405180830381600087803b158015611cce57600080fd5b505af1158015611ce2573d6000803e3d6000fd5b50505050611cf1565b50508a51805b6101a08b01516040517f4852a7170000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820192909252908a1690634852a71790604401600060405180830381600087803b158015611d5c57600080fd5b505af1158015611d70573d6000803e3d6000fd5b5050505060648b60e001516064611d879190613754565b60ff168c6101a00151611d9a919061371e565b611da491906136fe565b6101e08c015260e08b0151606490611dbc9082613754565b60ff168c6101c00151611dcf919061371e565b611dd991906136fe565b6102008c0152611de76103a8565b6102008c01516040516364a197f360e01b81526001600160a01b03848116600483015260248201929092529116906364a197f390604401600060405180830381600087803b158015611e3857600080fd5b505af1158015611e4c573d6000803e3d6000fd5b5050506102008c01516101c08d0151611e65925061373d565b6102208c0152611e736103a8565b8d516102208d01516040516364a197f360e01b81526001600160a01b03928316600482015260248101919091529116906364a197f390604401600060405180830381600087803b158015611ec657600080fd5b505af1158015611eda573d6000803e3d6000fd5b505050506040518060a001604052808c6101e0015181526020018c610200015181526020018c60a0015181526020018c6000015181526020018c61022001518152509b5050505050505050505050505b919050565b6066546001600160a01b03163314611faf5760405162461bcd60e51b815260206004820152602160248201527f596f7520617265206e6f74207468652070656e64696e6720676f7665726e657260448201527f2e00000000000000000000000000000000000000000000000000000000000000606482015260840161052e565b606654606580546001600160a01b0319166001600160a01b0390921691821790556040519081527f8d55d160c0009eb3d739442df0a3ca089ed64378bfac017e7ddad463f9815b87906020015b60405180910390a1565b306001600160a01b037f000000000000000000000000d869dd57566daf8f160090fc0f3ff362f953a0191614156120945760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b606482015260840161052e565b7f000000000000000000000000d869dd57566daf8f160090fc0f3ff362f953a0196001600160a01b03166120ef7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b03161461215a5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161052e565b61216381612818565b6040805160008082526020820190925261217f91839190612872565b50565b306001600160a01b037f000000000000000000000000d869dd57566daf8f160090fc0f3ff362f953a0191614156122105760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b606482015260840161052e565b7f000000000000000000000000d869dd57566daf8f160090fc0f3ff362f953a0196001600160a01b031661226b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146122d65760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161052e565b6122df82612818565b6122eb82826001612872565b5050565b6000306001600160a01b037f000000000000000000000000d869dd57566daf8f160090fc0f3ff362f953a019161461238f5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161052e565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60008060686040516020016123c9919061350e565b60408051601f1981840301815291905280516020909101205492915050565b6065546001600160a01b031633146124425760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b606780546001600160a01b0319169055565b600061245e610469565b6001600160a01b031663741bef1a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b60006124a06123b4565b6040517f84ce47090000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015291909116906384ce47099060240160206040518083038186803b1580156124fc57600080fd5b505afa158015612510573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612534919061321a565b92915050565b60006104227f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6065546001600160a01b031633146125c75760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b606680546001600160a01b0319166001600160a01b0383169081179091556040519081527f90ad4c550d25bd23af61db38d1ff8671b89edaaa0bca0fc36bac5084ecc120bd9060200160405180910390a150565b6000612625610469565b6001600160a01b031663ae2e933b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103ea57600080fd5b6065546001600160a01b031633146126b75760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b606580546001600160a01b03191690556040513381527f24e4875c487b4800d52ab8484eb3ad19b3485a88e0b19b6cfdac90da12ee55fd90602001611ffc565b600054610100900460ff16158080156127175750600054600160ff909116105b806127315750303b158015612731575060005460ff166001145b6127a35760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161052e565b6000805460ff1916600117905580156127c6576000805461ff0019166101001790555b6127cf82612a26565b80156122eb576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6065546001600160a01b0316331461217f5760405162461bcd60e51b815260206004820152601960248201527f596f7520617265206e6f742074686520676f7665726e65722e00000000000000604482015260640161052e565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156128aa576128a583612aa2565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156128e357600080fd5b505afa925050508015612913575060408051601f3d908101601f1916820190925261291091810190613236565b60015b6129855760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f742055555053000000000000000000000000000000000000606482015260840161052e565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612a1a5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c65555549440000000000000000000000000000000000000000000000606482015260840161052e565b506128a5838383612b60565b600054610100900460ff16612a915760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b612a9a81612b8b565b61217f612c07565b6001600160a01b0381163b612b1f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161052e565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b612b6983612c74565b600082511180612b765750805b156128a557612b858383612cb4565b50505050565b600054610100900460ff16612bf65760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b612bfe612dbf565b61217f81612e32565b600054610100900460ff16612c725760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b565b612c7d81612aa2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b612d335760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161052e565b600080846001600160a01b031684604051612d4e9190613467565b600060405180830381855af49150503d8060008114612d89576040519150601f19603f3d011682016040523d82523d6000602084013e612d8e565b606091505b5091509150612db6828260405180606001604052806027815260200161384960279139612f15565b95945050505050565b600054610100900460ff16612e2a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b612c72612f35565b600054610100900460ff16612e9d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b60408051808201909152600b8082527f646570732e59616d61746f0000000000000000000000000000000000000000006020909201918252612ee191606891612fee565b5060006068604051602001612ef6919061350e565b6040516020818303038152906040528051906020012090508181555050565b60608315612f24575081612f2e565b612f2e8383612fc4565b9392505050565b600054610100900460ff16612fa05760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161052e565b60658054336001600160a01b03199182168117909255606780549091169091179055565b815115612fd45781518083602001fd5b8060405162461bcd60e51b815260040161052e91906134db565b828054612ffa906137a3565b90600052602060002090601f01602090048101928261301c5760008555613062565b82601f1061303557805160ff1916838001178555613062565b82800160010185558215613062579182015b82811115613062578251825591602001919060010190613047565b5061306e929150613072565b5090565b5b8082111561306e5760008155600101613073565b805160ff81168114611f2a57600080fd5b6000602082840312156130a9578081fd5b8135612f2e81613825565b6000602082840312156130c5578081fd5b8151612f2e81613825565b600080604083850312156130e2578081fd5b82356130ed81613825565b915060208381013567ffffffffffffffff8082111561310a578384fd5b818601915086601f83011261311d578384fd5b81358181111561312f5761312f61380f565b613141601f8201601f191685016136b5565b91508082528784828501011115613156578485fd5b8084840185840137810190920192909252919491935090915050565b60006020808385031215613184578182fd5b825167ffffffffffffffff8082111561319b578384fd5b818501915085601f8301126131ae578384fd5b8151818111156131c0576131c061380f565b8060051b91506131d18483016136b5565b8181528481019084860184860187018a10156131eb578788fd5b8795505b8386101561320d5780518352600195909501949186019186016131ef565b5098975050505050505050565b60006020828403121561322b578081fd5b8151612f2e8161383a565b600060208284031215613247578081fd5b5051919050565b600060a0828403121561325f578081fd5b60405160a0810181811067ffffffffffffffff821117156132825761328261380f565b8060405250825181526020830151602082015260408301516132a38161383a565b604082015260608301516132b681613825565b60608201526080928301519281019290925250919050565b6000606082840312156132df578081fd5b6040516060810181811067ffffffffffffffff821117156133025761330261380f565b604052823561331081613825565b815260208381013590820152604083013561332a8161383a565b60408201529392505050565b60008060008060008060c0878903121561334e578182fd5b865195506020870151945061336560408801613087565b935061337360608801613087565b925061338160808801613087565b915061338f60a08801613087565b90509295509295509295565b6000602082840312156133ac578081fd5b612f2e82613087565b6000815180845260208085019450808401835b838110156133ed5781516001600160a01b0316875295820195908201906001016133c8565b509495945050505050565b6000815180845260208085019450808401835b838110156133ed5761345487835180518252602081015160208301526040810151151560408301526001600160a01b036060820151166060830152608081015160808301525050565b60a096909601959082019060010161340b565b60008251613479818460208701613777565b9190910192915050565b602081526000612f2e60208301846133b5565b602081526000612f2e60208301846133f8565b6060815260006134bc60608301866133f8565b90508360208301526001600160a01b0383166040830152949350505050565b60208152600082518060208401526134fa816040850160208701613777565b601f01601f19169190910160400192915050565b6000602080835281845483600182811c91508083168061352f57607f831692505b85831081141561354d57634e487b7160e01b87526022600452602487fd5b87860183815260200181801561356a576001811461357b576135a5565b60ff198616825287820196506135a5565b60008b815260209020895b8681101561359f57815484820152908501908901613586565b83019750505b50949998505050505050505050565b60c081016135f8828580518252602081015160208301526040810151151560408301526001600160a01b036060820151166060830152608081015160808301525050565b8260a08301529392505050565b610100810161364a828780518252602081015160208301526040810151151560408301526001600160a01b036060820151166060830152608081015160808301525050565b8460a08301528360c08301528260e083015295945050505050565b6020815281516020820152602082015160408201526000604083015160a0606084015261369560c08401826133b5565b905060608401516080840152608084015160a08401528091505092915050565b604051601f8201601f1916810167ffffffffffffffff811182821017156136de576136de61380f565b604052919050565b600082198211156136f9576136f96137f9565b500190565b60008261371957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613738576137386137f9565b500290565b60008282101561374f5761374f6137f9565b500390565b600060ff821660ff84168082101561376e5761376e6137f9565b90039392505050565b60005b8381101561379257818101518382015260200161377a565b83811115612b855750506000910152565b600181811c908216806137b757607f821691505b602082108114156137d857634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156137f2576137f26137f9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461217f57600080fd5b801515811461217f57600080fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ac5129e55424de7a934fe1c0cb575e45ab1fc58c38560ecaff1a9fb2d34f321764736f6c63430008040033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.