Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save drinkius/9c744ba9740e80ca99b09413d026875a to your computer and use it in GitHub Desktop.
Save drinkius/9c744ba9740e80ca99b09413d026875a to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.9+commit.3e3065ac.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)
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:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, _allowances[owner][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[owner][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Spend `amount` form the allowance of `owner` toward `spender`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../security/Pausable.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
/**
* @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
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` 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 tokenId
) 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.
* - `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 tokenId
) internal virtual {}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
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
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.0;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
/// @title Base64
/// @author Brecht Devos - <brecht@loopring.org>
/// @notice Provides functions for encoding/decoding base64
library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";
function encode(bytes memory data) internal pure returns (string memory) {
if (data.length == 0) return '';
// load the table into memory
string memory table = TABLE_ENCODE;
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((data.length + 2) / 3);
// add some extra buffer at the end required for the writing
string memory result = new string(encodedLen + 32);
assembly {
// set the actual output length
mstore(result, encodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 3 bytes at a time
for {} lt(dataPtr, endPtr) {}
{
// read 3 bytes
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
// write 4 characters
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F))))
resultPtr := add(resultPtr, 1)
mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F))))
resultPtr := add(resultPtr, 1)
}
// padding with '='
switch mod(mload(data), 3)
case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
}
return result;
}
function decode(string memory _data) internal pure returns (bytes memory) {
bytes memory data = bytes(_data);
if (data.length == 0) return new bytes(0);
require(data.length % 4 == 0, "invalid base64 decoder input");
// load the table into memory
bytes memory table = TABLE_DECODE;
// every 4 characters represent 3 bytes
uint256 decodedLen = (data.length / 4) * 3;
// add some extra buffer at the end required for the writing
bytes memory result = new bytes(decodedLen + 32);
assembly {
// padding with '='
let lastBytes := mload(add(data, mload(data)))
if eq(and(lastBytes, 0xFF), 0x3d) {
decodedLen := sub(decodedLen, 1)
if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
decodedLen := sub(decodedLen, 1)
}
}
// set the actual output length
mstore(result, decodedLen)
// prepare the lookup table
let tablePtr := add(table, 1)
// input ptr
let dataPtr := data
let endPtr := add(dataPtr, mload(data))
// result ptr, jump over length
let resultPtr := add(result, 32)
// run over the input, 4 characters at a time
for {} lt(dataPtr, endPtr) {}
{
// read 4 characters
dataPtr := add(dataPtr, 4)
let input := mload(dataPtr)
// write 3 bytes
let output := add(
add(
shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
add(
shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
and(mload(add(tablePtr, and( input , 0xFF))), 0xFF)
)
)
mstore(resultPtr, shl(232, output))
resultPtr := add(resultPtr, 3)
}
}
return result;
}
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"görli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"activeBonds(uint256)": "821de0af",
"amountWithoutDiscount(uint256)": "fc2d3da9",
"bondActivePeriod()": "c8932f81",
"bondAmountOut(uint256)": "a80e4ff0",
"bondCounter()": "5831d885",
"bondLimit()": "457fcd0e",
"bondStorage()": "5a4ef6b9",
"bondToClaimPeriod()": "a3820322",
"bondType()": "94c8636f",
"bondingWindowEndTimestamp()": "a3eb5ffa",
"claim(uint256)": "379607f5",
"discountDenominator()": "f2d81c33",
"discountNominator()": "d3308f54",
"getStakingReward(uint256)": "abfe35ad",
"gton()": "d370e052",
"gtonAggregator()": "fd7f6771",
"isActiveBond(uint256)": "1e1ebf27",
"isBondingActive()": "8c387b93",
"lastBondActivation()": "1c0ca1ab",
"onERC721Received(address,address,uint256,bytes)": "150b7a02",
"owner()": "8da5cb5b",
"renounceOwnership()": "715018a6",
"setBondActivePeriod(uint256)": "c74364f4",
"setBondLimit(uint256)": "02d0d868",
"setBondToClaimPeriod(uint256)": "3d568cdb",
"setDiscountNominator(uint256)": "2f8d16eb",
"setGtonAggregator(address)": "7ec164a0",
"setTokenAggregator(address)": "263b1491",
"sgton()": "9e00e613",
"startBonding()": "5fa73e33",
"token()": "fc0c546a",
"tokenAggregator()": "c4c72337",
"totalSupply()": "18160ddd",
"transferOwnership(address)": "f2fde38b",
"transferToken(address,address)": "48ae238f"
}
},
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Claim",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "Mint",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "asset",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "allocation",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "releaseDate",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "bondType",
"type": "string"
}
],
"name": "MintData",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "startTimestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "endTimestamp",
"type": "uint256"
}
],
"name": "StartBonding",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "activeBonds",
"outputs": [
{
"internalType": "bool",
"name": "isActive",
"type": "bool"
},
{
"internalType": "uint256",
"name": "issueTimestamp",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "releaseTimestamp",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "releaseAmount",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "amountWithoutDiscount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondActivePeriod",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
}
],
"name": "bondAmountOut",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondCounter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondLimit",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondStorage",
"outputs": [
{
"internalType": "contract IBondStorage",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondToClaimPeriod",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondType",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondingWindowEndTimestamp",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "claim",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "discountDenominator",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "discountNominator",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "getStakingReward",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "gton",
"outputs": [
{
"internalType": "contract ERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "gtonAggregator",
"outputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "isActiveBond",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isBondingActive",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lastBondActivation",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "onERC721Received",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_bondActivePeriod",
"type": "uint256"
}
],
"name": "setBondActivePeriod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_bondLimit",
"type": "uint256"
}
],
"name": "setBondLimit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_bondToClaimPeriod",
"type": "uint256"
}
],
"name": "setBondToClaimPeriod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_discountN",
"type": "uint256"
}
],
"name": "setDiscountNominator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "agg",
"type": "address"
}
],
"name": "setGtonAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "agg",
"type": "address"
}
],
"name": "setTokenAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "sgton",
"outputs": [
{
"internalType": "contract Staking",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "startBonding",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [
{
"internalType": "contract ERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "tokenAggregator",
"outputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ERC20",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "transferToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Claim",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "Mint",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "asset",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "allocation",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "releaseDate",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "bondType",
"type": "string"
}
],
"name": "MintData",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "startTimestamp",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "endTimestamp",
"type": "uint256"
}
],
"name": "StartBonding",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "activeBonds",
"outputs": [
{
"internalType": "bool",
"name": "isActive",
"type": "bool"
},
{
"internalType": "uint256",
"name": "issueTimestamp",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "releaseTimestamp",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "releaseAmount",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "amountWithoutDiscount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondActivePeriod",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
}
],
"name": "bondAmountOut",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondCounter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondLimit",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondStorage",
"outputs": [
{
"internalType": "contract IBondStorage",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondToClaimPeriod",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondType",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "bondingWindowEndTimestamp",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "claim",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "discountDenominator",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "discountNominator",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "getStakingReward",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "gton",
"outputs": [
{
"internalType": "contract ERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "gtonAggregator",
"outputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "isActiveBond",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isBondingActive",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lastBondActivation",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "onERC721Received",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_bondActivePeriod",
"type": "uint256"
}
],
"name": "setBondActivePeriod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_bondLimit",
"type": "uint256"
}
],
"name": "setBondLimit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_bondToClaimPeriod",
"type": "uint256"
}
],
"name": "setBondToClaimPeriod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_discountN",
"type": "uint256"
}
],
"name": "setDiscountNominator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "agg",
"type": "address"
}
],
"name": "setGtonAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "agg",
"type": "address"
}
],
"name": "setTokenAggregator",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "sgton",
"outputs": [
{
"internalType": "contract Staking",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "startBonding",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [
{
"internalType": "contract ERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "tokenAggregator",
"outputs": [
{
"internalType": "contract AggregatorV3Interface",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract ERC20",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "transferToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {
"onERC721Received(address,address,uint256,bytes)": {
"details": "See {IERC721Receiver-onERC721Received}. Always returns `IERC721Receiver.onERC721Received.selector`."
},
"owner()": {
"details": "Returns the address of the current owner."
},
"renounceOwnership()": {
"details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner."
},
"transferOwnership(address)": {
"details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."
}
},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {
"amountWithoutDiscount(uint256)": {
"notice": "Function calculates the amount of token that represents"
},
"bondAmountOut(uint256)": {
"notice": "Function calculates the amount of gton out for current price without discount"
},
"bondingWindowEndTimestamp()": {
"notice": "View function returns timestamp when bond period vill be over"
},
"claim(uint256)": {
"notice": "Function receives the bond from user and updates users balance with sgton"
},
"getStakingReward(uint256)": {
"notice": "Function calculates amount of token to be earned with the `amount` by the bond duration time"
},
"isBondingActive()": {
"notice": "Function checks if bond period is open by checking that last block timestamp is between bondEpiration timestamp and lastBondActivation timestamp."
},
"startBonding()": {
"notice": "Function starts issue bonding period"
},
"totalSupply()": {
"notice": "Function returns total amount of bonds issued by this contract"
}
},
"version": 1
}
},
"settings": {
"compilationTarget": {
"Bonding.sol": "ABonding"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"Bonding.sol": {
"keccak256": "0xc44659d1c1055623371c25233c293e9dd5ab613862f3be28a576c6e5190a416c",
"license": "MIT",
"urls": [
"bzz-raw://5335907f305b1a3406481a0765fa6ee8f278d72da98af8e7f2dbe8d122909bd7",
"dweb:/ipfs/QmRySyZqQttPaGPvhjuPCcrAsBkoqL5pRMxwyo3UGnKyHw"
]
}
},
"version": 1
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"görli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {},
"generatedSources": [],
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"functionDebugData": {},
"generatedSources": [],
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"decimals()": "313ce567",
"description()": "7284e416",
"getRoundData(uint80)": "9a6fc8f5",
"latestRoundData()": "feaf968c",
"version()": "54fd4d50"
}
},
"abi": [
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "description",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint80",
"name": "_roundId",
"type": "uint80"
}
],
"name": "getRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.8.8+commit.dddeac2f"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "description",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint80",
"name": "_roundId",
"type": "uint80"
}
],
"name": "getRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
],
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
},
"settings": {
"compilationTarget": {
"Bonding.sol": "AggregatorV3Interface"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
},
"sources": {
"Bonding.sol": {
"keccak256": "0xc44659d1c1055623371c25233c293e9dd5ab613862f3be28a576c6e5190a416c",
"license": "MIT",
"urls": [
"bzz-raw://5335907f305b1a3406481a0765fa6ee8f278d72da98af8e7f2dbe8d122909bd7",
"dweb:/ipfs/QmRySyZqQttPaGPvhjuPCcrAsBkoqL5pRMxwyo3UGnKyHw"
]
}
},
"version": 1
}
// this line is added to create a gist. Empty file is not allowed.
{
"compiler": {
"version": "0.6.9+commit.3e3065ac"
},
"language": "Solidity",
"output": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Burn",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "increaseShares",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "totalShares",
"type": "uint256"
}
],
"name": "BuyShares",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "borrower",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "assetTo",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "baseAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "quoteAmount",
"type": "uint256"
}
],
"name": "DODOFlashLoan",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fromAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "toAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "trader",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "receiver",
"type": "address"
}
],
"name": "DODOSwap",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Mint",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "payer",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "decreaseShares",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "totalShares",
"type": "uint256"
}
],
"name": "SellShares",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "DOMAIN_SEPARATOR",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "PERMIT_TYPEHASH",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_BASE_PRICE_CUMULATIVE_LAST_",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_BASE_RESERVE_",
"outputs": [
{
"internalType": "uint112",
"name": "",
"type": "uint112"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_BASE_TOKEN_",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_BLOCK_TIMESTAMP_LAST_",
"outputs": [
{
"internalType": "uint32",
"name": "",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_IS_OPEN_TWAP_",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_I_",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_K_",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_LP_FEE_RATE_",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_MAINTAINER_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_MT_FEE_RATE_MODEL_",
"outputs": [
{
"internalType": "contract IFeeRateModel",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_QUOTE_RESERVE_",
"outputs": [
{
"internalType": "uint112",
"name": "",
"type": "uint112"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_QUOTE_TOKEN_",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_addr",
"type": "address"
}
],
"name": "addressToShortString",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "balance",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "buyShares",
"outputs": [
{
"internalType": "uint256",
"name": "shares",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "baseInput",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteInput",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "baseAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteAmount",
"type": "uint256"
},
{
"internalType": "address",
"name": "assetTo",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "flashLoan",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getBaseInput",
"outputs": [
{
"internalType": "uint256",
"name": "input",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getMidPrice",
"outputs": [
{
"internalType": "uint256",
"name": "midPrice",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getPMMState",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "i",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "K",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "B",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "Q",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "B0",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "Q0",
"type": "uint256"
},
{
"internalType": "enum PMMPricing.RState",
"name": "R",
"type": "uint8"
}
],
"internalType": "struct PMMPricing.PMMState",
"name": "state",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getPMMStateForCall",
"outputs": [
{
"internalType": "uint256",
"name": "i",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "K",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "B",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "Q",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "B0",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "Q0",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "R",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getQuoteInput",
"outputs": [
{
"internalType": "uint256",
"name": "input",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "getUserFeeRate",
"outputs": [
{
"internalType": "uint256",
"name": "lpFeeRate",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "mtFeeRate",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getVaultReserve",
"outputs": [
{
"internalType": "uint256",
"name": "baseReserve",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteReserve",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "maintainer",
"type": "address"
},
{
"internalType": "address",
"name": "baseTokenAddress",
"type": "address"
},
{
"internalType": "address",
"name": "quoteTokenAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "lpFeeRate",
"type": "uint256"
},
{
"internalType": "address",
"name": "mtFeeRateModel",
"type": "address"
},
{
"internalType": "uint256",
"name": "i",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "k",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isOpenTWAP",
"type": "bool"
}
],
"name": "init",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "nonces",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "permit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "trader",
"type": "address"
},
{
"internalType": "uint256",
"name": "payBaseAmount",
"type": "uint256"
}
],
"name": "querySellBase",
"outputs": [
{
"internalType": "uint256",
"name": "receiveQuoteAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "mtFee",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "trader",
"type": "address"
},
{
"internalType": "uint256",
"name": "payQuoteAmount",
"type": "uint256"
}
],
"name": "querySellQuote",
"outputs": [
{
"internalType": "uint256",
"name": "receiveBaseAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "mtFee",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "sellBase",
"outputs": [
{
"internalType": "uint256",
"name": "receiveQuoteAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "sellQuote",
"outputs": [
{
"internalType": "uint256",
"name": "receiveBaseAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "shareAmount",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "baseMinAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteMinAmount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
}
],
"name": "sellShares",
"outputs": [
{
"internalType": "uint256",
"name": "baseAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "sync",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}
],
"devdoc": {
"author": "DODO Breeder",
"methods": {
"allowance(address,address)": {
"details": "Function to check the amount of tokens that an owner _ALLOWED_ to a spender.",
"params": {
"owner": "address The address which owns the funds.",
"spender": "address The address which will spend the funds."
},
"returns": {
"_0": "A uint256 specifying the amount of tokens still available for the spender."
}
},
"approve(address,uint256)": {
"details": "Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.",
"params": {
"amount": "The amount of tokens to be spent.",
"spender": "The address which will spend the funds."
}
},
"balanceOf(address)": {
"details": "Gets the balance of the specified address.",
"params": {
"owner": "The address to query the the balance of."
},
"returns": {
"balance": "An uint256 representing the amount owned by the passed address."
}
},
"transfer(address,uint256)": {
"details": "transfer token for a specified address",
"params": {
"amount": "The amount to be transferred.",
"to": "The address to transfer to."
}
},
"transferFrom(address,address,uint256)": {
"details": "Transfer tokens from one address to another",
"params": {
"amount": "uint256 the amount of tokens to be transferred",
"from": "address The address which you want to send tokens from",
"to": "address The address which you want to transfer to"
}
}
},
"title": "DODO VendingMachine"
},
"userdoc": {
"methods": {},
"notice": "DODOVendingMachine initialization"
}
},
"settings": {
"compilationTarget": {
"DODO/DODOVendingMachine/impl/DVM.sol": "DVM"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
},
"sources": {
"DODO/DODOVendingMachine/impl/DVM.sol": {
"keccak256": "0xbec500ec2ba2f0500edf31e07532ac8540247acab9b425f87eaa9a2aeed3f06a",
"license": "Apache-2.0",
"urls": [
"bzz-raw://5e6f4a6696e5f5795c2e12f745e78b881fa095f53bb5eeb332d43438a8272e2a",
"dweb:/ipfs/QmeJUQVbe5eXgBBQQP2K3XU5eG7uLruXeog7F7KVAwjE5N"
]
},
"DODO/DODOVendingMachine/impl/DVMFunding.sol": {
"keccak256": "0x7d6a176fa53078348c9653ca4e51cff65f5a34c1ddb60ae707a41c714b20e782",
"license": "Apache-2.0",
"urls": [
"bzz-raw://41ed097ec59bef24c889b1864429148252287b9ec04508017d4b5a6f37dd34a1",
"dweb:/ipfs/QmXFnRqPa9Ax4Bu944wEc4TjkfTVKfME5mMbbix4AaYx9k"
]
},
"DODO/DODOVendingMachine/impl/DVMStorage.sol": {
"keccak256": "0xe3a1ec5ce0ff0663b0bade01f4a85b08ec644b339d227d90717d86666dae58d2",
"license": "Apache-2.0",
"urls": [
"bzz-raw://c4ba168cd55551d566bce6b299e663c5cb342a030b225e77213fbff22863f20f",
"dweb:/ipfs/QmQtDEongihUQLRsE4p8Zd9kyeg2oUwLeW3gEZbTRxGFnd"
]
},
"DODO/DODOVendingMachine/impl/DVMTrader.sol": {
"keccak256": "0xee6b57a0a2777914cbc409fd67d84f0c6aeae6948290139ffad7bb74a8721743",
"license": "Apache-2.0",
"urls": [
"bzz-raw://a6e5be515f4d8988517eddb914ea236bbae1571715f3bdb0901c8dee363d4c43",
"dweb:/ipfs/QmfESLD55hVRPw75jbEhZ3hCHaugfHfamcqCVoYKkRyPCh"
]
},
"DODO/DODOVendingMachine/impl/DVMVault.sol": {
"keccak256": "0xd763459a003864e777659bf7070b89417625c790c9b30976009b188c714f589a",
"license": "Apache-2.0",
"urls": [
"bzz-raw://3eb2eb007ae5bd196cc95bf7c470fb5ef841e55104f914f2c2282c8f8c477c57",
"dweb:/ipfs/QmSFZWaUE7avrvBHgokE1wUnutWtpqYpM9rayG3YnC7AmR"
]
},
"DODO/intf/IDODOCallee.sol": {
"keccak256": "0x4d3ab08101fbab7a67b84b5c8fd0bea7841628397cc326c8809d3d78e6463724",
"license": "Apache-2.0",
"urls": [
"bzz-raw://1e490558b4c14ab28be15ee216473eaccc6767e11c89dab6c818fecf776113ca",
"dweb:/ipfs/QmSjubpMwmQ1QXtSMYbUqKsW8XkS7xVikeCf2ft5fsqxSe"
]
},
"DODO/intf/IERC20.sol": {
"keccak256": "0xbe898d8250024178536a58ad1f8d6e0db1c879e43d648d06f8af0f9331f4dbb5",
"license": "MIT",
"urls": [
"bzz-raw://40e8560f8cbfd4fc33fc6ea0220fca3d4fb0953a680bd449a0177ce787279f55",
"dweb:/ipfs/QmSmRGvM1qohowvGJ7cUu5JzVnmJjw5tLgzr15HihQYKxK"
]
},
"DODO/lib/DODOMath.sol": {
"keccak256": "0xec0a12a1fdbb5b792cde30cb06bfabc78868ee856a8596aa81f9588b8eca649f",
"license": "Apache-2.0",
"urls": [
"bzz-raw://36ecf1453fd1bccf055ad9e7083fbecd0d6e40b677d18ab5c55c966e82284973",
"dweb:/ipfs/QmURjw4VuYFJknKgTghLbsNZdxXm5SFiYk2dS2RxUxG3eD"
]
},
"DODO/lib/DecimalMath.sol": {
"keccak256": "0x16aed7bd416ca3c79556abd1535c34eca84f66e9aa7d37f8c28e9cde72e9c634",
"license": "Apache-2.0",
"urls": [
"bzz-raw://cf907fa7d790786486cbbf842d8cbb94c839e0fac88cbbb543ecacdb2c48e9be",
"dweb:/ipfs/Qmd5PxC5EHNooNMoacL3CFGJNNwsTUCBeShbqAtCTUZoCx"
]
},
"DODO/lib/FeeRateModel.sol": {
"keccak256": "0x87e685ad3fdc0e23f087e7b438a579e284da6d3ff46eee0ffac40ad06956fd42",
"license": "Apache-2.0",
"urls": [
"bzz-raw://6ba1877c8df8417b30b29250aa2a8a3a51ca7364e960b9d86695cfc7daabfd8f",
"dweb:/ipfs/QmPmBkEme7FNmLtt2vEfwYekPougQdr6cdUeNmpW57LuN7"
]
},
"DODO/lib/InitializableOwnable.sol": {
"keccak256": "0x386eea470a3d5b4210e4ac231270810acdaec4bc4bd3358b9e3393b77cbbd0ca",
"license": "Apache-2.0",
"urls": [
"bzz-raw://3f9e4d1ace9ebeeb9cfcae44a57b70cbbea66fb628456fc12d77c256772f1519",
"dweb:/ipfs/QmaZ28mKecv6G8z89WoB8RqjiL2KGWHKUBNxAj72cPRA26"
]
},
"DODO/lib/PMMPricing.sol": {
"keccak256": "0x2c5d28f4ae3c02bb8b77a5258f29115982b2076147d646ccfd8150ef54805883",
"license": "Apache-2.0",
"urls": [
"bzz-raw://ef20177b7ed874339cb49a26c1971b085e5a5ffa5c5b3cdb8e2efa1b3306df1a",
"dweb:/ipfs/QmYxikoxigt7BALbCpNLrifMdXdiBMDh87zpHigXJ8rcm5"
]
},
"DODO/lib/ReentrancyGuard.sol": {
"keccak256": "0xc9c3fc946350fd72083a9d5b1327ff923533ef37b054bc7b6007562b20b0faaf",
"license": "Apache-2.0",
"urls": [
"bzz-raw://fc140417457139fb240427629673bfaf970c5d4568ad1cfe582764c6e4855bbb",
"dweb:/ipfs/Qmd7ESYe5kyM6NYiSzeFE74f1YGGPXzpdVd5qnYg2AvgH8"
]
},
"DODO/lib/SafeERC20.sol": {
"keccak256": "0xe11bb64537b764f7b0b64f817ffa0b4b278c2017474ff985428225b3f0928295",
"license": "Apache-2.0",
"urls": [
"bzz-raw://c756ca959d2326d58ed49b8a2d39100866197596ba09240e4f1bf861399a6e96",
"dweb:/ipfs/QmdgzWZNT614vRnb5zsDva91bkLpvZmCVV5d6xetqsyedR"
]
},
"DODO/lib/SafeMath.sol": {
"keccak256": "0x57d750628881687f826b54f60cbfd46c1a172433eed892bbb123f91869886af1",
"license": "Apache-2.0",
"urls": [
"bzz-raw://b40bd7946010ddae9679f36630510217dcaa9cb8643824f9edc8ef52bda95717",
"dweb:/ipfs/QmZSjpfUGyrmokZyaMc74a8h6zy2qFVECPVP8VfTvzNEFb"
]
}
},
"version": 1
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IFeeRateModel} from "../../lib/FeeRateModel.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {DVMTrader} from "./DVMTrader.sol";
import {DVMFunding} from "./DVMFunding.sol";
import {DVMVault} from "./DVMVault.sol";
/**
* @title DODO VendingMachine
* @author DODO Breeder
*
* @notice DODOVendingMachine initialization
*/
contract DVM is DVMTrader, DVMFunding {
function init(
address maintainer,
address baseTokenAddress,
address quoteTokenAddress,
uint256 lpFeeRate,
address mtFeeRateModel,
uint256 i,
uint256 k,
bool isOpenTWAP
) external {
require(!_DVM_INITIALIZED_, "DVM_INITIALIZED");
_DVM_INITIALIZED_ = true;
require(baseTokenAddress != quoteTokenAddress, "BASE_QUOTE_CAN_NOT_BE_SAME");
_BASE_TOKEN_ = IERC20(baseTokenAddress);
_QUOTE_TOKEN_ = IERC20(quoteTokenAddress);
require(i > 0 && i <= 10**36);
_I_ = i;
require(k <= 10**18);
_K_ = k;
_LP_FEE_RATE_ = lpFeeRate;
_MT_FEE_RATE_MODEL_ = IFeeRateModel(mtFeeRateModel);
_MAINTAINER_ = maintainer;
_IS_OPEN_TWAP_ = isOpenTWAP;
if(isOpenTWAP) _BLOCK_TIMESTAMP_LAST_ = uint32(block.timestamp % 2**32);
string memory connect = "_";
string memory suffix = "DLP";
name = string(abi.encodePacked(suffix, connect, addressToShortString(address(this))));
symbol = "DLP";
decimals = _BASE_TOKEN_.decimals();
// ============================== Permit ====================================
uint256 chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)
)
);
// ==========================================================================
}
function addressToShortString(address _addr) public pure returns (string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(8);
for (uint256 i = 0; i < 4; i++) {
str[i * 2] = alphabet[uint8(value[i + 12] >> 4)];
str[1 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)];
}
return string(str);
}
// ============ Version Control ============
function version() external pure returns (string memory) {
return "DVM 1.0.2";
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {DVMVault} from "./DVMVault.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {IDODOCallee} from "../../intf/IDODOCallee.sol";
contract DVMFunding is DVMVault {
// ============ Events ============
event BuyShares(address to, uint256 increaseShares, uint256 totalShares);
event SellShares(address payer, address to, uint256 decreaseShares, uint256 totalShares);
// ============ Buy & Sell Shares ============
// buy shares [round down]
function buyShares(address to)
external
preventReentrant
returns (
uint256 shares,
uint256 baseInput,
uint256 quoteInput
)
{
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
uint256 baseReserve = _BASE_RESERVE_;
uint256 quoteReserve = _QUOTE_RESERVE_;
baseInput = baseBalance.sub(baseReserve);
quoteInput = quoteBalance.sub(quoteReserve);
require(baseInput > 0, "NO_BASE_INPUT");
// Round down when withdrawing. Therefore, never be a situation occuring balance is 0 but totalsupply is not 0
// But May Happen,reserve >0 But totalSupply = 0
if (totalSupply == 0) {
// case 1. initial supply
require(baseBalance >= 10**3, "INSUFFICIENT_LIQUIDITY_MINED");
shares = baseBalance; // 以免出现balance很大但shares很小的情况
} else if (baseReserve > 0 && quoteReserve == 0) {
// case 2. supply when quote reserve is 0
shares = baseInput.mul(totalSupply).div(baseReserve);
} else if (baseReserve > 0 && quoteReserve > 0) {
// case 3. normal case
uint256 baseInputRatio = DecimalMath.divFloor(baseInput, baseReserve);
uint256 quoteInputRatio = DecimalMath.divFloor(quoteInput, quoteReserve);
uint256 mintRatio = quoteInputRatio < baseInputRatio ? quoteInputRatio : baseInputRatio;
shares = DecimalMath.mulFloor(totalSupply, mintRatio);
}
_mint(to, shares);
_setReserve(baseBalance, quoteBalance);
emit BuyShares(to, shares, _SHARES_[to]);
}
// sell shares [round down]
function sellShares(
uint256 shareAmount,
address to,
uint256 baseMinAmount,
uint256 quoteMinAmount,
bytes calldata data,
uint256 deadline
) external preventReentrant returns (uint256 baseAmount, uint256 quoteAmount) {
require(deadline >= block.timestamp, "TIME_EXPIRED");
require(shareAmount <= _SHARES_[msg.sender], "DLP_NOT_ENOUGH");
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
uint256 totalShares = totalSupply;
baseAmount = baseBalance.mul(shareAmount).div(totalShares);
quoteAmount = quoteBalance.mul(shareAmount).div(totalShares);
require(
baseAmount >= baseMinAmount && quoteAmount >= quoteMinAmount,
"WITHDRAW_NOT_ENOUGH"
);
_burn(msg.sender, shareAmount);
_transferBaseOut(to, baseAmount);
_transferQuoteOut(to, quoteAmount);
_sync();
if (data.length > 0) {
IDODOCallee(to).DVMSellShareCall(
msg.sender,
shareAmount,
baseAmount,
quoteAmount,
data
);
}
emit SellShares(msg.sender, to, shareAmount, _SHARES_[msg.sender]);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {DODOMath} from "../../lib/DODOMath.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {IFeeRateModel} from "../../lib/FeeRateModel.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {PMMPricing} from "../../lib/PMMPricing.sol";
contract DVMStorage is ReentrancyGuard {
using SafeMath for uint256;
bool public _IS_OPEN_TWAP_ = false;
bool internal _DVM_INITIALIZED_;
// ============ Core Address ============
address public _MAINTAINER_;
IERC20 public _BASE_TOKEN_;
IERC20 public _QUOTE_TOKEN_;
uint112 public _BASE_RESERVE_;
uint112 public _QUOTE_RESERVE_;
uint32 public _BLOCK_TIMESTAMP_LAST_;
uint256 public _BASE_PRICE_CUMULATIVE_LAST_;
// ============ Shares (ERC20) ============
string public symbol;
uint8 public decimals;
string public name;
uint256 public totalSupply;
mapping(address => uint256) internal _SHARES_;
mapping(address => mapping(address => uint256)) internal _ALLOWED_;
// ================= Permit ======================
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint256) public nonces;
// ============ Variables for Pricing ============
uint256 public _LP_FEE_RATE_;
IFeeRateModel public _MT_FEE_RATE_MODEL_;
uint256 public _K_;
uint256 public _I_;
// ============ Helper Functions ============
function getPMMState() public view returns (PMMPricing.PMMState memory state) {
state.i = _I_;
state.K = _K_;
state.B = _BASE_RESERVE_;
state.Q = _QUOTE_RESERVE_;
state.B0 = 0; // will be calculated in adjustedTarget
state.Q0 = 0;
state.R = PMMPricing.RState.ABOVE_ONE;
PMMPricing.adjustedTarget(state);
}
function getPMMStateForCall()
external
view
returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint256 R
)
{
PMMPricing.PMMState memory state = getPMMState();
i = state.i;
K = state.K;
B = state.B;
Q = state.Q;
B0 = state.B0;
Q0 = state.Q0;
R = uint256(state.R);
}
function getMidPrice() public view returns (uint256 midPrice) {
return PMMPricing.getMidPrice(getPMMState());
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {DVMVault} from "./DVMVault.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {DODOMath} from "../../lib/DODOMath.sol";
import {IDODOCallee} from "../../intf/IDODOCallee.sol";
import {PMMPricing} from "../../lib/PMMPricing.sol";
contract DVMTrader is DVMVault {
using SafeMath for uint256;
// ============ Events ============
event DODOSwap(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 toAmount,
address trader,
address receiver
);
event DODOFlashLoan(
address borrower,
address assetTo,
uint256 baseAmount,
uint256 quoteAmount
);
// ============ Trade Functions ============
function sellBase(address to)
external
preventReentrant
returns (uint256 receiveQuoteAmount)
{
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 baseInput = baseBalance.sub(uint256(_BASE_RESERVE_));
uint256 mtFee;
(receiveQuoteAmount, mtFee) = querySellBase(tx.origin, baseInput);
_transferQuoteOut(to, receiveQuoteAmount);
_transferQuoteOut(_MAINTAINER_, mtFee);
_setReserve(baseBalance, _QUOTE_TOKEN_.balanceOf(address(this)));
emit DODOSwap(
address(_BASE_TOKEN_),
address(_QUOTE_TOKEN_),
baseInput,
receiveQuoteAmount,
msg.sender,
to
);
}
function sellQuote(address to)
external
preventReentrant
returns (uint256 receiveBaseAmount)
{
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
uint256 quoteInput = quoteBalance.sub(uint256(_QUOTE_RESERVE_));
uint256 mtFee;
(receiveBaseAmount, mtFee) = querySellQuote(tx.origin, quoteInput);
_transferBaseOut(to, receiveBaseAmount);
_transferBaseOut(_MAINTAINER_, mtFee);
_setReserve(_BASE_TOKEN_.balanceOf(address(this)), quoteBalance);
emit DODOSwap(
address(_QUOTE_TOKEN_),
address(_BASE_TOKEN_),
quoteInput,
receiveBaseAmount,
msg.sender,
to
);
}
function flashLoan(
uint256 baseAmount,
uint256 quoteAmount,
address assetTo,
bytes calldata data
) external preventReentrant {
_transferBaseOut(assetTo, baseAmount);
_transferQuoteOut(assetTo, quoteAmount);
if (data.length > 0)
IDODOCallee(assetTo).DVMFlashLoanCall(msg.sender, baseAmount, quoteAmount, data);
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
// no input -> pure loss
require(
baseBalance >= _BASE_RESERVE_ || quoteBalance >= _QUOTE_RESERVE_,
"FLASH_LOAN_FAILED"
);
// sell quote
if (baseBalance < _BASE_RESERVE_) {
uint256 quoteInput = quoteBalance.sub(uint256(_QUOTE_RESERVE_));
(uint256 receiveBaseAmount, uint256 mtFee) = querySellQuote(tx.origin, quoteInput);
require(uint256(_BASE_RESERVE_).sub(baseBalance) <= receiveBaseAmount, "FLASH_LOAN_FAILED");
_transferBaseOut(_MAINTAINER_, mtFee);
emit DODOSwap(
address(_QUOTE_TOKEN_),
address(_BASE_TOKEN_),
quoteInput,
receiveBaseAmount,
msg.sender,
assetTo
);
}
// sell base
if (quoteBalance < _QUOTE_RESERVE_) {
uint256 baseInput = baseBalance.sub(uint256(_BASE_RESERVE_));
(uint256 receiveQuoteAmount, uint256 mtFee) = querySellBase(tx.origin, baseInput);
require(uint256(_QUOTE_RESERVE_).sub(quoteBalance) <= receiveQuoteAmount, "FLASH_LOAN_FAILED");
_transferQuoteOut(_MAINTAINER_, mtFee);
emit DODOSwap(
address(_BASE_TOKEN_),
address(_QUOTE_TOKEN_),
baseInput,
receiveQuoteAmount,
msg.sender,
assetTo
);
}
_sync();
emit DODOFlashLoan(msg.sender, assetTo, baseAmount, quoteAmount);
}
// ============ Query Functions ============
function querySellBase(address trader, uint256 payBaseAmount)
public
view
returns (uint256 receiveQuoteAmount, uint256 mtFee)
{
(receiveQuoteAmount, ) = PMMPricing.sellBaseToken(getPMMState(), payBaseAmount);
uint256 lpFeeRate = _LP_FEE_RATE_;
uint256 mtFeeRate = _MT_FEE_RATE_MODEL_.getFeeRate(trader);
mtFee = DecimalMath.mulFloor(receiveQuoteAmount, mtFeeRate);
receiveQuoteAmount = receiveQuoteAmount
.sub(DecimalMath.mulFloor(receiveQuoteAmount, lpFeeRate))
.sub(mtFee);
}
function querySellQuote(address trader, uint256 payQuoteAmount)
public
view
returns (uint256 receiveBaseAmount, uint256 mtFee)
{
(receiveBaseAmount, ) = PMMPricing.sellQuoteToken(getPMMState(), payQuoteAmount);
uint256 lpFeeRate = _LP_FEE_RATE_;
uint256 mtFeeRate = _MT_FEE_RATE_MODEL_.getFeeRate(trader);
mtFee = DecimalMath.mulFloor(receiveBaseAmount, mtFeeRate);
receiveBaseAmount = receiveBaseAmount
.sub(DecimalMath.mulFloor(receiveBaseAmount, lpFeeRate))
.sub(mtFee);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IERC20} from "../../intf/IERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {DVMStorage} from "./DVMStorage.sol";
contract DVMVault is DVMStorage {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Events ============
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Mint(address indexed user, uint256 value);
event Burn(address indexed user, uint256 value);
// ============ View Functions ============
function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve) {
baseReserve = _BASE_RESERVE_;
quoteReserve = _QUOTE_RESERVE_;
}
function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate) {
lpFeeRate = _LP_FEE_RATE_;
mtFeeRate = _MT_FEE_RATE_MODEL_.getFeeRate(user);
}
// ============ Asset In ============
function getBaseInput() public view returns (uint256 input) {
return _BASE_TOKEN_.balanceOf(address(this)).sub(uint256(_BASE_RESERVE_));
}
function getQuoteInput() public view returns (uint256 input) {
return _QUOTE_TOKEN_.balanceOf(address(this)).sub(uint256(_QUOTE_RESERVE_));
}
// ============ TWAP UPDATE ===========
function _twapUpdate() internal {
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - _BLOCK_TIMESTAMP_LAST_;
if (timeElapsed > 0 && _BASE_RESERVE_ != 0 && _QUOTE_RESERVE_ != 0) {
_BASE_PRICE_CUMULATIVE_LAST_ += getMidPrice() * timeElapsed;
}
_BLOCK_TIMESTAMP_LAST_ = blockTimestamp;
}
// ============ Set States ============
function _setReserve(uint256 baseReserve, uint256 quoteReserve) internal {
require(baseReserve <= uint112(-1) && quoteReserve <= uint112(-1), "OVERFLOW");
_BASE_RESERVE_ = uint112(baseReserve);
_QUOTE_RESERVE_ = uint112(quoteReserve);
if(_IS_OPEN_TWAP_) _twapUpdate();
}
function _sync() internal {
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
require(baseBalance <= uint112(-1) && quoteBalance <= uint112(-1), "OVERFLOW");
if (baseBalance != _BASE_RESERVE_) {
_BASE_RESERVE_ = uint112(baseBalance);
}
if (quoteBalance != _QUOTE_RESERVE_) {
_QUOTE_RESERVE_ = uint112(quoteBalance);
}
if(_IS_OPEN_TWAP_) _twapUpdate();
}
function sync() external preventReentrant {
_sync();
}
// ============ Asset Out ============
function _transferBaseOut(address to, uint256 amount) internal {
if (amount > 0) {
_BASE_TOKEN_.safeTransfer(to, amount);
}
}
function _transferQuoteOut(address to, uint256 amount) internal {
if (amount > 0) {
_QUOTE_TOKEN_.safeTransfer(to, amount);
}
}
// ============ Shares (ERC20) ============
/**
* @dev transfer token for a specified address
* @param to The address to transfer to.
* @param amount The amount to be transferred.
*/
function transfer(address to, uint256 amount) public returns (bool) {
require(amount <= _SHARES_[msg.sender], "BALANCE_NOT_ENOUGH");
_SHARES_[msg.sender] = _SHARES_[msg.sender].sub(amount);
_SHARES_[to] = _SHARES_[to].add(amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the the balance of.
* @return balance An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) external view returns (uint256 balance) {
return _SHARES_[owner];
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param amount uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 amount
) public returns (bool) {
require(amount <= _SHARES_[from], "BALANCE_NOT_ENOUGH");
require(amount <= _ALLOWED_[from][msg.sender], "ALLOWANCE_NOT_ENOUGH");
_SHARES_[from] = _SHARES_[from].sub(amount);
_SHARES_[to] = _SHARES_[to].add(amount);
_ALLOWED_[from][msg.sender] = _ALLOWED_[from][msg.sender].sub(amount);
emit Transfer(from, to, amount);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param spender The address which will spend the funds.
* @param amount The amount of tokens to be spent.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
_ALLOWED_[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Function to check the amount of tokens that an owner _ALLOWED_ to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _ALLOWED_[owner][spender];
}
function _mint(address user, uint256 value) internal {
require(value > 1000, "MINT_INVALID");
_SHARES_[user] = _SHARES_[user].add(value);
totalSupply = totalSupply.add(value);
emit Mint(user, value);
emit Transfer(address(0), user, value);
}
function _burn(address user, uint256 value) internal {
_SHARES_[user] = _SHARES_[user].sub(value);
totalSupply = totalSupply.sub(value);
emit Burn(user, value);
emit Transfer(user, address(0), value);
}
// ============================ Permit ======================================
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(deadline >= block.timestamp, "DODO_DVM_LP: EXPIRED");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(
abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)
)
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(
recoveredAddress != address(0) && recoveredAddress == owner,
"DODO_DVM_LP: INVALID_SIGNATURE"
);
_approve(owner, spender, value);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDVM {
function init(
address maintainer,
address baseTokenAddress,
address quoteTokenAddress,
uint256 lpFeeRate,
address mtFeeRateModel,
uint256 i,
uint256 k,
bool isOpenTWAP
) external;
function _BASE_TOKEN_() external returns (address);
function _QUOTE_TOKEN_() external returns (address);
function _MT_FEE_RATE_MODEL_() external returns (address);
function getVaultReserve() external returns (uint256 baseReserve, uint256 quoteReserve);
function sellBase(address to) external returns (uint256);
function sellQuote(address to) external returns (uint256);
function buyShares(address to) external returns (uint256,uint256,uint256);
function addressToShortString(address _addr) external pure returns (string memory);
function getMidPrice() external view returns (uint256 midPrice);
function sellShares(
uint256 shareAmount,
address to,
uint256 baseMinAmount,
uint256 quoteMinAmount,
bytes calldata data,
uint256 deadline
) external returns (uint256 baseAmount, uint256 quoteAmount);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {ICP} from "../CrowdPooling/intf/ICP.sol";
import {SafeMath} from "../lib/SafeMath.sol";
import {IERC20} from "../intf/IERC20.sol";
import {DecimalMath} from "../lib/DecimalMath.sol";
/**
* @title CrowdPoolingFacotry
* @author DODO Breeder
*
* @notice Create And Register CP Pools
*/
contract CrowdPoolingFactory is InitializableOwnable {
using SafeMath for uint256;
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DVM_FACTORY_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public immutable _DEFAULT_PERMISSION_MANAGER_;
address public _CP_TEMPLATE_;
address public _DEFAULT_MAINTAINER_;
// ============ Settings =============
uint256 public _CAP_RATIO_ = 50;
uint256 public _FREEZE_DURATION_ = 30 days;
uint256 public _CALM_DURATION_ = 0;
uint256 public _VEST_DURATION_ = 0;
uint256 public _K_ = 0;
uint256 public _CLIFF_RATE_ = 10**18;
// ============ Registry ============
// base -> quote -> CP address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> CP address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ modifiers ===========
modifier valueCheck(
address cpAddress,
address baseToken,
uint256[] memory timeLine,
uint256[] memory valueList)
{
require(timeLine[2] == _CALM_DURATION_, "CP_FACTORY : PHASE_CALM_DURATION_INVALID");
require(timeLine[4] == _VEST_DURATION_, "CP_FACTORY : VEST_DURATION_INVALID");
require(valueList[1] == _K_, "CP_FACTORY : K_INVALID");
require(valueList[3] == _CLIFF_RATE_, "CP_FACTORY : CLIFF_RATE_INVALID");
uint256 baseTokenBalance = IERC20(baseToken).balanceOf(cpAddress);
require(valueList[0].mul(100) <= baseTokenBalance.mul(valueList[2]).div(10**18).mul(_CAP_RATIO_),"CP_FACTORY : QUOTE_CAP_INVALID");
require(timeLine[3]>= _FREEZE_DURATION_, "CP_FACTORY : FREEZE_DURATION_INVALID");
_;
}
// ============ Events ============
event NewCP(
address baseToken,
address quoteToken,
address creator,
address cp
);
constructor(
address cloneFactory,
address cpTemplate,
address dvmFactory,
address defaultMaintainer,
address defaultMtFeeRateModel,
address defaultPermissionManager
) public {
_CLONE_FACTORY_ = cloneFactory;
_CP_TEMPLATE_ = cpTemplate;
_DVM_FACTORY_ = dvmFactory;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
_DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager;
}
// ============ Functions ============
function createCrowdPooling() external returns (address newCrowdPooling) {
newCrowdPooling = ICloneFactory(_CLONE_FACTORY_).clone(_CP_TEMPLATE_);
}
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external valueCheck(cpAddress,baseToken,timeLine,valueList) {
{
address[] memory addressList = new address[](7);
addressList[0] = creator;
addressList[1] = _DEFAULT_MAINTAINER_;
addressList[2] = baseToken;
addressList[3] = quoteToken;
addressList[4] = _DEFAULT_PERMISSION_MANAGER_;
addressList[5] = _DEFAULT_MT_FEE_RATE_MODEL_;
addressList[6] = _DVM_FACTORY_;
ICP(cpAddress).init(
addressList,
timeLine,
valueList,
isOpenTWAP
);
}
_REGISTRY_[baseToken][quoteToken].push(cpAddress);
_USER_REGISTRY_[creator].push(cpAddress);
emit NewCP(baseToken, quoteToken, creator, cpAddress);
}
// ============ View Functions ============
function getCrowdPooling(address baseToken, address quoteToken)
external
view
returns (address[] memory pools)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getCrowdPoolingBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Pools, address[] memory baseToken1Pools)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getCrowdPoolingByUser(address user)
external
view
returns (address[] memory pools)
{
return _USER_REGISTRY_[user];
}
// ============ Owner Functions ============
function updateCPTemplate(address _newCPTemplate) external onlyOwner {
_CP_TEMPLATE_ = _newCPTemplate;
}
function updateDefaultMaintainer(address _newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = _newMaintainer;
}
function setCapRatio(uint256 _newCapRatio) public onlyOwner {
require(_newCapRatio > 0 && _newCapRatio <= 100, "CP_FACTORY : INVALID");
_CAP_RATIO_ = _newCapRatio;
}
function setFreezeDuration(uint256 _newFreeDuration) public onlyOwner {
_FREEZE_DURATION_ = _newFreeDuration;
}
function setCalmDuration(uint256 _newCalmDuration) public onlyOwner {
_CALM_DURATION_ = _newCalmDuration;
}
function setVestDuration(uint256 _newVestDuration) public onlyOwner {
_VEST_DURATION_ = _newVestDuration;
}
function setK(uint256 _newK) public onlyOwner {
require(_newK <= 10**18, "CP_FACTORY : INVALID");
_K_ = _newK;
}
function setCliffRate(uint256 _newCliffRate) public onlyOwner {
require(_newCliffRate <= 10**18, "CP_FACTORY : INVALID");
_CLIFF_RATE_ = _newCliffRate;
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
interface IMineV2 {
function init(address owner, address token) external;
function addRewardToken(
address rewardToken,
uint256 rewardPerBlock,
uint256 startBlock,
uint256 endBlock
) external;
function transferOwnership(address newOwner) external;
}
/**
* @title DODOMineV2 Factory
* @author DODO Breeder
*
* @notice Create And Register DODOMineV2 Contracts
*/
contract DODOMineV2Factory is InitializableOwnable {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public _DEFAULT_MAINTAINER_;
address public _MINEV2_TEMPLATE_;
// mine -> stakeToken
mapping(address => address) public _MINE_REGISTRY_;
// stakeToken -> mine
mapping(address => address) public _STAKE_REGISTRY_;
// ============ Events ============
event NewMineV2(address mine, address stakeToken);
event RemoveMineV2(address mine, address stakeToken);
constructor(
address cloneFactory,
address mineTemplate,
address defaultMaintainer
) public {
_CLONE_FACTORY_ = cloneFactory;
_MINEV2_TEMPLATE_ = mineTemplate;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
}
// ============ Functions ============
function createDODOMineV2(
address stakeToken,
address[] memory rewardTokens,
uint256[] memory rewardPerBlock,
uint256[] memory startBlock,
uint256[] memory endBlock
) external onlyOwner returns (address newMineV2) {
require(rewardTokens.length > 0, "REWARD_EMPTY");
require(rewardTokens.length == rewardPerBlock.length, "REWARD_PARAM_NOT_MATCH");
require(startBlock.length == rewardPerBlock.length, "REWARD_PARAM_NOT_MATCH");
require(endBlock.length == rewardPerBlock.length, "REWARD_PARAM_NOT_MATCH");
newMineV2 = ICloneFactory(_CLONE_FACTORY_).clone(_MINEV2_TEMPLATE_);
IMineV2(newMineV2).init(address(this), stakeToken);
for(uint i = 0; i<rewardTokens.length; i++) {
IMineV2(newMineV2).addRewardToken(
rewardTokens[i],
rewardPerBlock[i],
startBlock[i],
endBlock[i]
);
}
IMineV2(newMineV2).transferOwnership(_DEFAULT_MAINTAINER_);
_MINE_REGISTRY_[newMineV2] = stakeToken;
_STAKE_REGISTRY_[stakeToken] = newMineV2;
emit NewMineV2(newMineV2, stakeToken);
}
// ============ Admin Operation Functions ============
function updateMineV2Template(address _newMineV2Template) external onlyOwner {
_MINEV2_TEMPLATE_ = _newMineV2Template;
}
function updateDefaultMaintainer(address _newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = _newMaintainer;
}
function addByAdmin(
address mine,
address stakeToken
) external onlyOwner {
_MINE_REGISTRY_[mine] = stakeToken;
_STAKE_REGISTRY_[stakeToken] = mine;
emit NewMineV2(mine, stakeToken);
}
function removeByAdmin(
address mine,
address stakeToken
) external onlyOwner {
_MINE_REGISTRY_[mine] = address(0);
_STAKE_REGISTRY_[stakeToken] = address(0);
emit RemoveMineV2(mine, stakeToken);
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {ERC721URIStorage} from "../external/ERC721/ERC721URIStorage.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
contract DODONFT is ERC721URIStorage, InitializableOwnable {
uint256 public _CUR_TOKENID_;
// ============ Event =============
event DODONFTMint(address creator, uint256 tokenId);
event DODONFTBurn(uint256 tokenId);
function init(
address owner,
string memory name,
string memory symbol
) public {
initOwner(owner);
_name = name;
_symbol = symbol;
}
function mint(string calldata uri) external {
_safeMint(msg.sender, _CUR_TOKENID_);
_setTokenURI(_CUR_TOKENID_, uri);
emit DODONFTMint(msg.sender, _CUR_TOKENID_);
_CUR_TOKENID_ = _CUR_TOKENID_ + 1;
}
function burn(uint256 tokenId) external onlyOwner {
require(tokenId < _CUR_TOKENID_, "TOKENID_INVALID");
_burn(tokenId);
emit DODONFTBurn(tokenId);
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {ERC1155} from "../external/ERC1155/ERC1155.sol";
import {Strings} from "../external/utils/Strings.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
contract DODONFT1155 is ERC1155, InitializableOwnable {
using Strings for uint256;
uint256 public _CUR_TOKENID_;
string internal _baseUri = "";
mapping (uint256 => string) private _tokenURIs;
// ============ Event =============
event DODONFTMint(address creator, uint256 tokenId, uint256 amount);
event DODONFTBurn(address account, uint256 tokenId, uint256 amount);
function mint(string calldata uri, uint256 amount) external {
_mint(msg.sender, _CUR_TOKENID_, amount, "");
_setTokenURI(_CUR_TOKENID_, uri);
emit DODONFTMint(msg.sender, _CUR_TOKENID_, amount);
_CUR_TOKENID_ = _CUR_TOKENID_ + 1;
}
function burn(address account, uint256 tokenId, uint256 amount) external onlyOwner {
require(tokenId < _CUR_TOKENID_, "TOKENID_INVALID");
_burn(account, tokenId, amount);
emit DODONFTBurn(account, tokenId, amount);
}
function uri(uint256 tokenId) public view override returns (string memory) {
string memory _tokenURI = _tokenURIs[tokenId];
string memory base = _baseUri;
if (bytes(base).length == 0) {
return _tokenURI;
}
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
return super.uri(tokenId);
}
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
_tokenURIs[tokenId] = _tokenURI;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {IFeeRateModel} from "../lib/FeeRateModel.sol";
import {IDPP} from "../DODOPrivatePool/intf/IDPP.sol";
import {IDPPAdmin} from "../DODOPrivatePool/intf/IDPPAdmin.sol";
/**
* @title DODO PrivatePool Factory
* @author DODO Breeder
*
* @notice Create And Register DPP Pools
*/
contract DPPFactory is InitializableOwnable {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public immutable _DODO_APPROVE_PROXY_;
address public _DEFAULT_MAINTAINER_;
address public _DPP_TEMPLATE_;
address public _DPP_ADMIN_TEMPLATE_;
mapping (address => bool) public isAdminListed;
// ============ Registry ============
// base -> quote -> DPP address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> DPP address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ Events ============
event NewDPP(
address baseToken,
address quoteToken,
address creator,
address dpp
);
event RemoveDPP(address dpp);
event addAdmin(address admin);
event removeAdmin(address admin);
constructor(
address cloneFactory,
address dppTemplate,
address dppAdminTemplate,
address defaultMaintainer,
address defaultMtFeeRateModel,
address dodoApproveProxy
) public {
_CLONE_FACTORY_ = cloneFactory;
_DPP_TEMPLATE_ = dppTemplate;
_DPP_ADMIN_TEMPLATE_ = dppAdminTemplate;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
// ============ Functions ============
function createDODOPrivatePool() external returns (address newPrivatePool) {
newPrivatePool = ICloneFactory(_CLONE_FACTORY_).clone(_DPP_TEMPLATE_);
}
function initDODOPrivatePool(
address dppAddress,
address creator,
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 k,
uint256 i,
bool isOpenTwap
) external {
require(isAdminListed[msg.sender], "ACCESS_DENIED");
{
address _dppAddress = dppAddress;
address adminModel = _createDPPAdminModel(
creator,
_dppAddress,
creator,
_DODO_APPROVE_PROXY_
);
IDPP(_dppAddress).init(
adminModel,
_DEFAULT_MAINTAINER_,
baseToken,
quoteToken,
lpFeeRate,
_DEFAULT_MT_FEE_RATE_MODEL_,
k,
i,
isOpenTwap
);
}
_REGISTRY_[baseToken][quoteToken].push(dppAddress);
_USER_REGISTRY_[creator].push(dppAddress);
emit NewDPP(baseToken, quoteToken, creator, dppAddress);
}
function _createDPPAdminModel(
address owner,
address dpp,
address operator,
address dodoApproveProxy
) internal returns (address adminModel) {
adminModel = ICloneFactory(_CLONE_FACTORY_).clone(_DPP_ADMIN_TEMPLATE_);
IDPPAdmin(adminModel).init(owner, dpp, operator, dodoApproveProxy);
}
// ============ Admin Operation Functions ============
function updateAdminTemplate(address _newDPPAdminTemplate) external onlyOwner {
_DPP_ADMIN_TEMPLATE_ = _newDPPAdminTemplate;
}
function updateDefaultMaintainer(address _newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = _newMaintainer;
}
function updateDppTemplate(address _newDPPTemplate) external onlyOwner {
_DPP_TEMPLATE_ = _newDPPTemplate;
}
function addAdminList (address contractAddr) external onlyOwner {
isAdminListed[contractAddr] = true;
emit addAdmin(contractAddr);
}
function removeAdminList (address contractAddr) external onlyOwner {
isAdminListed[contractAddr] = false;
emit removeAdmin(contractAddr);
}
function addPoolByAdmin(
address creator,
address baseToken,
address quoteToken,
address pool
) external onlyOwner {
_REGISTRY_[baseToken][quoteToken].push(pool);
_USER_REGISTRY_[creator].push(pool);
emit NewDPP(baseToken, quoteToken, creator, pool);
}
function batchAddPoolByAdmin(
address[] memory creators,
address[] memory baseTokens,
address[] memory quoteTokens,
address[] memory pools
) external onlyOwner {
require(creators.length == baseTokens.length,"PARAMS_INVALID");
require(creators.length == quoteTokens.length,"PARAMS_INVALID");
require(creators.length == pools.length,"PARAMS_INVALID");
for(uint256 i = 0; i < creators.length; i++) {
address creator = creators[i];
address baseToken = baseTokens[i];
address quoteToken = quoteTokens[i];
address pool = pools[i];
_REGISTRY_[baseToken][quoteToken].push(pool);
_USER_REGISTRY_[creator].push(pool);
emit NewDPP(baseToken, quoteToken, creator, pool);
}
}
function removePoolByAdmin(
address creator,
address baseToken,
address quoteToken,
address pool
) external onlyOwner {
address[] memory registryList = _REGISTRY_[baseToken][quoteToken];
for (uint256 i = 0; i < registryList.length; i++) {
if (registryList[i] == pool) {
registryList[i] = registryList[registryList.length - 1];
break;
}
}
_REGISTRY_[baseToken][quoteToken] = registryList;
_REGISTRY_[baseToken][quoteToken].pop();
address[] memory userRegistryList = _USER_REGISTRY_[creator];
for (uint256 i = 0; i < userRegistryList.length; i++) {
if (userRegistryList[i] == pool) {
userRegistryList[i] = userRegistryList[userRegistryList.length - 1];
break;
}
}
_USER_REGISTRY_[creator] = userRegistryList;
_USER_REGISTRY_[creator].pop();
emit RemoveDPP(pool);
}
// ============ View Functions ============
function getDODOPool(address baseToken, address quoteToken)
external
view
returns (address[] memory pools)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getDODOPoolBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Pool, address[] memory baseToken1Pool)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getDODOPoolByUser(address user)
external
view
returns (address[] memory pools)
{
return _USER_REGISTRY_[user];
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {IDSP} from "../DODOStablePool/intf/IDSP.sol";
interface IDSPFactory {
function createDODOStablePool(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newStablePool);
}
/**
* @title DODO StablePool Factory
* @author DODO Breeder
*
* @notice Create And Register DSP Pools
*/
contract DSPFactory is InitializableOwnable {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public _DEFAULT_MAINTAINER_;
address public _DSP_TEMPLATE_;
// ============ Registry ============
// base -> quote -> DSP address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> DSP address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ Events ============
event NewDSP(address baseToken, address quoteToken, address creator, address DSP);
event RemoveDSP(address DSP);
// ============ Functions ============
constructor(
address cloneFactory,
address DSPTemplate,
address defaultMaintainer,
address defaultMtFeeRateModel
) public {
_CLONE_FACTORY_ = cloneFactory;
_DSP_TEMPLATE_ = DSPTemplate;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
}
function createDODOStablePool(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newStablePool) {
newStablePool = ICloneFactory(_CLONE_FACTORY_).clone(_DSP_TEMPLATE_);
{
IDSP(newStablePool).init(
_DEFAULT_MAINTAINER_,
baseToken,
quoteToken,
lpFeeRate,
_DEFAULT_MT_FEE_RATE_MODEL_,
i,
k,
isOpenTWAP
);
}
_REGISTRY_[baseToken][quoteToken].push(newStablePool);
_USER_REGISTRY_[tx.origin].push(newStablePool);
emit NewDSP(baseToken, quoteToken, tx.origin, newStablePool);
}
// ============ Admin Operation Functions ============
function updateDSPTemplate(address _newDSPTemplate) external onlyOwner {
_DSP_TEMPLATE_ = _newDSPTemplate;
}
function updateDefaultMaintainer(address _newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = _newMaintainer;
}
function addPoolByAdmin(
address creator,
address baseToken,
address quoteToken,
address pool
) external onlyOwner {
_REGISTRY_[baseToken][quoteToken].push(pool);
_USER_REGISTRY_[creator].push(pool);
emit NewDSP(baseToken, quoteToken, creator, pool);
}
function removePoolByAdmin(
address creator,
address baseToken,
address quoteToken,
address pool
) external onlyOwner {
address[] memory registryList = _REGISTRY_[baseToken][quoteToken];
for (uint256 i = 0; i < registryList.length; i++) {
if (registryList[i] == pool) {
registryList[i] = registryList[registryList.length - 1];
break;
}
}
_REGISTRY_[baseToken][quoteToken] = registryList;
_REGISTRY_[baseToken][quoteToken].pop();
address[] memory userRegistryList = _USER_REGISTRY_[creator];
for (uint256 i = 0; i < userRegistryList.length; i++) {
if (userRegistryList[i] == pool) {
userRegistryList[i] = userRegistryList[userRegistryList.length - 1];
break;
}
}
_USER_REGISTRY_[creator] = userRegistryList;
_USER_REGISTRY_[creator].pop();
emit RemoveDSP(pool);
}
// ============ View Functions ============
function getDODOPool(address baseToken, address quoteToken)
external
view
returns (address[] memory machines)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getDODOPoolBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Machines, address[] memory baseToken1Machines)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getDODOPoolByUser(address user) external view returns (address[] memory machines) {
return _USER_REGISTRY_[user];
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {IDVM} from "../DODOVendingMachine/intf/IDVM.sol";
interface IDVMFactory {
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine);
}
/**
* @title DODO VendingMachine Factory
* @author DODO Breeder
*
* @notice Create And Register DVM Pools
*/
contract DVMFactory is InitializableOwnable {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public _DEFAULT_MAINTAINER_;
address public _DVM_TEMPLATE_;
// ============ Registry ============
// base -> quote -> DVM address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> DVM address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ Events ============
event NewDVM(
address baseToken,
address quoteToken,
address creator,
address dvm
);
event RemoveDVM(address dvm);
// ============ Functions ============
constructor(
address cloneFactory,
address dvmTemplate,
address defaultMaintainer,
address defaultMtFeeRateModel
) public {
_CLONE_FACTORY_ = cloneFactory;
_DVM_TEMPLATE_ = dvmTemplate;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
}
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine) {
newVendingMachine = ICloneFactory(_CLONE_FACTORY_).clone(_DVM_TEMPLATE_);
{
IDVM(newVendingMachine).init(
_DEFAULT_MAINTAINER_,
baseToken,
quoteToken,
lpFeeRate,
_DEFAULT_MT_FEE_RATE_MODEL_,
i,
k,
isOpenTWAP
);
}
_REGISTRY_[baseToken][quoteToken].push(newVendingMachine);
_USER_REGISTRY_[tx.origin].push(newVendingMachine);
emit NewDVM(baseToken, quoteToken, tx.origin, newVendingMachine);
}
// ============ Admin Operation Functions ============
function updateDvmTemplate(address _newDVMTemplate) external onlyOwner {
_DVM_TEMPLATE_ = _newDVMTemplate;
}
function updateDefaultMaintainer(address _newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = _newMaintainer;
}
function addPoolByAdmin(
address creator,
address baseToken,
address quoteToken,
address pool
) external onlyOwner {
_REGISTRY_[baseToken][quoteToken].push(pool);
_USER_REGISTRY_[creator].push(pool);
emit NewDVM(baseToken, quoteToken, creator, pool);
}
function removePoolByAdmin(
address creator,
address baseToken,
address quoteToken,
address pool
) external onlyOwner {
address[] memory registryList = _REGISTRY_[baseToken][quoteToken];
for (uint256 i = 0; i < registryList.length; i++) {
if (registryList[i] == pool) {
registryList[i] = registryList[registryList.length - 1];
break;
}
}
_REGISTRY_[baseToken][quoteToken] = registryList;
_REGISTRY_[baseToken][quoteToken].pop();
address[] memory userRegistryList = _USER_REGISTRY_[creator];
for (uint256 i = 0; i < userRegistryList.length; i++) {
if (userRegistryList[i] == pool) {
userRegistryList[i] = userRegistryList[userRegistryList.length - 1];
break;
}
}
_USER_REGISTRY_[creator] = userRegistryList;
_USER_REGISTRY_[creator].pop();
emit RemoveDVM(pool);
}
// ============ View Functions ============
function getDODOPool(address baseToken, address quoteToken)
external
view
returns (address[] memory machines)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getDODOPoolBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Machines, address[] memory baseToken1Machines)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getDODOPoolByUser(address user)
external
view
returns (address[] memory machines)
{
return _USER_REGISTRY_[user];
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {InitializableERC20} from "../external/ERC20/InitializableERC20.sol";
import {InitializableMintableERC20} from "../external/ERC20/InitializableMintableERC20.sol";
/**
* @title DODO ERC20Factory
* @author DODO Breeder
*
* @notice Help user to create erc20 token
*/
contract ERC20Factory {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _ERC20_TEMPLATE_;
address public immutable _MINTABLE_ERC20_TEMPLATE_;
// ============ Events ============
event NewERC20(address erc20, address creator, bool isMintable);
// ============ Registry ============
// creator -> token address list
mapping(address => address[]) public _USER_STD_REGISTRY_;
// ============ Functions ============
constructor(
address cloneFactory,
address erc20Template,
address mintableErc20Template
) public {
_CLONE_FACTORY_ = cloneFactory;
_ERC20_TEMPLATE_ = erc20Template;
_MINTABLE_ERC20_TEMPLATE_ = mintableErc20Template;
}
function createStdERC20(
uint256 totalSupply,
string memory name,
string memory symbol,
uint8 decimals
) external returns (address newERC20) {
newERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC20_TEMPLATE_);
InitializableERC20(newERC20).init(msg.sender, totalSupply, name, symbol, decimals);
_USER_STD_REGISTRY_[msg.sender].push(newERC20);
emit NewERC20(newERC20, msg.sender, false);
}
function createMintableERC20(
uint256 initSupply,
string memory name,
string memory symbol,
uint8 decimals
) external returns (address newMintableERC20) {
newMintableERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_MINTABLE_ERC20_TEMPLATE_);
InitializableMintableERC20(newMintableERC20).init(
msg.sender,
initSupply,
name,
symbol,
decimals
);
emit NewERC20(newMintableERC20, msg.sender, true);
}
function getTokenByUser(address user)
external
view
returns (address[] memory tokens)
{
return _USER_STD_REGISTRY_[user];
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IStdERC20 {
function init(
address _creator,
uint256 _totalSupply,
string memory _name,
string memory _symbol,
uint8 _decimals
) external;
}
interface ICustomERC20 {
function init(
address _creator,
uint256 _initSupply,
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _tradeBurnRatio,
uint256 _tradeFeeRatio,
address _team,
bool _isMintable
) external;
}
/**
* @title DODO ERC20V2Factory
* @author DODO Breeder
*
* @notice Help user to create erc20 token
*/
contract ERC20V2Factory is InitializableOwnable {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public _ERC20_TEMPLATE_;
address public _CUSTOM_ERC20_TEMPLATE_;
uint256 public _CREATE_FEE_;
// ============ Events ============
// 0 Std 1 TradeBurn or TradeFee 2 Mintable
event NewERC20(address erc20, address creator, uint256 erc20Type);
event ChangeCreateFee(uint256 newFee);
event Withdraw(address account, uint256 amount);
event ChangeStdTemplate(address newStdTemplate);
event ChangeCustomTemplate(address newCustomTemplate);
// ============ Registry ============
// creator -> token address list
mapping(address => address[]) public _USER_STD_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_REGISTRY_;
// ============ Functions ============
fallback() external payable {}
receive() external payable {}
constructor(
address cloneFactory,
address erc20Template,
address customErc20Template
) public {
_CLONE_FACTORY_ = cloneFactory;
_ERC20_TEMPLATE_ = erc20Template;
_CUSTOM_ERC20_TEMPLATE_ = customErc20Template;
}
function createStdERC20(
uint256 totalSupply,
string memory name,
string memory symbol,
uint8 decimals
) external payable returns (address newERC20) {
require(msg.value >= _CREATE_FEE_, "CREATE_FEE_NOT_ENOUGH");
newERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC20_TEMPLATE_);
IStdERC20(newERC20).init(msg.sender, totalSupply, name, symbol, decimals);
_USER_STD_REGISTRY_[msg.sender].push(newERC20);
emit NewERC20(newERC20, msg.sender, 0);
}
function createCustomERC20(
uint256 initSupply,
string memory name,
string memory symbol,
uint8 decimals,
uint256 tradeBurnRatio,
uint256 tradeFeeRatio,
address teamAccount,
bool isMintable
) external payable returns (address newCustomERC20) {
require(msg.value >= _CREATE_FEE_, "CREATE_FEE_NOT_ENOUGH");
newCustomERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_CUSTOM_ERC20_TEMPLATE_);
ICustomERC20(newCustomERC20).init(
msg.sender,
initSupply,
name,
symbol,
decimals,
tradeBurnRatio,
tradeFeeRatio,
teamAccount,
isMintable
);
_USER_CUSTOM_REGISTRY_[msg.sender].push(newCustomERC20);
if(isMintable)
emit NewERC20(newCustomERC20, msg.sender, 2);
else
emit NewERC20(newCustomERC20, msg.sender, 1);
}
// ============ View ============
function getTokenByUser(address user)
external
view
returns (address[] memory stds,address[] memory customs)
{
return (_USER_STD_REGISTRY_[user], _USER_CUSTOM_REGISTRY_[user]);
}
// ============ Ownable =============
function changeCreateFee(uint256 newFee) external onlyOwner {
_CREATE_FEE_ = newFee;
emit ChangeCreateFee(newFee);
}
function withdraw() external onlyOwner {
uint256 amount = address(this).balance;
msg.sender.transfer(amount);
emit Withdraw(msg.sender, amount);
}
function updateStdTemplate(address newStdTemplate) external onlyOwner {
_ERC20_TEMPLATE_ = newStdTemplate;
emit ChangeStdTemplate(newStdTemplate);
}
function updateCustomTemplate(address newCustomTemplate) external onlyOwner {
_CUSTOM_ERC20_TEMPLATE_ = newCustomTemplate;
emit ChangeCustomTemplate(newCustomTemplate);
}
}
/*
Copyright 2022 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IStdERC20 {
function init(
address _creator,
uint256 _totalSupply,
string memory _name,
string memory _symbol,
uint8 _decimals
) external;
}
interface ICustomERC20 {
function init(
address _creator,
uint256 _initSupply,
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _tradeBurnRatio,
uint256 _tradeFeeRatio,
address _team
) external;
}
/**
* @title DODO ERC20V2Factory
* @author DODO Breeder
*
* @notice Help user to create erc20 token
*/
contract ERC20V3Factory is InitializableOwnable {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public _ERC20_TEMPLATE_;
address public _CUSTOM_ERC20_TEMPLATE_;
address public _CUSTOM_MINTABLE_ERC20_TEMPLATE_;
uint256 public _CREATE_FEE_;
// ============ Events ============
// 0 Std 1 TradeBurn or TradeFee 2 Mintable
event NewERC20(address erc20, address creator, uint256 erc20Type);
event ChangeCreateFee(uint256 newFee);
event Withdraw(address account, uint256 amount);
event ChangeStdTemplate(address newStdTemplate);
event ChangeCustomTemplate(address newCustomTemplate);
event ChangeCustomMintableTemplate(address newCustomMintableTemplate);
// ============ Registry ============
// creator -> token address list
mapping(address => address[]) public _USER_STD_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_MINTABLE_REGISTRY_;
// ============ Functions ============
fallback() external payable {}
receive() external payable {}
constructor(
address cloneFactory,
address erc20Template,
address customErc20Template,
address customMintableErc20Template,
uint256 createFee
) public {
_CLONE_FACTORY_ = cloneFactory;
_ERC20_TEMPLATE_ = erc20Template;
_CUSTOM_ERC20_TEMPLATE_ = customErc20Template;
_CUSTOM_MINTABLE_ERC20_TEMPLATE_ = customMintableErc20Template;
_CREATE_FEE_ = createFee;
}
function createStdERC20(
uint256 totalSupply,
string memory name,
string memory symbol,
uint8 decimals
) external payable returns (address newERC20) {
require(msg.value >= _CREATE_FEE_, "CREATE_FEE_NOT_ENOUGH");
newERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC20_TEMPLATE_);
IStdERC20(newERC20).init(msg.sender, totalSupply, name, symbol, decimals);
_USER_STD_REGISTRY_[msg.sender].push(newERC20);
emit NewERC20(newERC20, msg.sender, 0);
}
function createCustomERC20(
uint256 totalSupply,
string memory name,
string memory symbol,
uint8 decimals,
uint256 tradeBurnRatio,
uint256 tradeFeeRatio,
address teamAccount
) external payable returns (address newCustomERC20) {
require(msg.value >= _CREATE_FEE_, "CREATE_FEE_NOT_ENOUGH");
newCustomERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_CUSTOM_ERC20_TEMPLATE_);
ICustomERC20(newCustomERC20).init(
msg.sender,
totalSupply,
name,
symbol,
decimals,
tradeBurnRatio,
tradeFeeRatio,
teamAccount
);
_USER_CUSTOM_REGISTRY_[msg.sender].push(newCustomERC20);
emit NewERC20(newCustomERC20, msg.sender, 1);
}
function createCustomMintableERC20(
uint256 initSupply,
string memory name,
string memory symbol,
uint8 decimals,
uint256 tradeBurnRatio,
uint256 tradeFeeRatio,
address teamAccount
) external payable returns (address newCustomMintableERC20) {
require(msg.value >= _CREATE_FEE_, "CREATE_FEE_NOT_ENOUGH");
newCustomMintableERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_CUSTOM_MINTABLE_ERC20_TEMPLATE_);
ICustomERC20(newCustomMintableERC20).init(
msg.sender,
initSupply,
name,
symbol,
decimals,
tradeBurnRatio,
tradeFeeRatio,
teamAccount
);
_USER_CUSTOM_MINTABLE_REGISTRY_[msg.sender].push(newCustomMintableERC20);
emit NewERC20(newCustomMintableERC20, msg.sender, 2);
}
// ============ View ============
function getTokenByUser(address user)
external
view
returns (address[] memory stds,address[] memory customs,address[] memory mintables)
{
return (_USER_STD_REGISTRY_[user], _USER_CUSTOM_REGISTRY_[user], _USER_CUSTOM_MINTABLE_REGISTRY_[user]);
}
// ============ Ownable =============
function changeCreateFee(uint256 newFee) external onlyOwner {
_CREATE_FEE_ = newFee;
emit ChangeCreateFee(newFee);
}
function withdraw() external onlyOwner {
uint256 amount = address(this).balance;
msg.sender.transfer(amount);
emit Withdraw(msg.sender, amount);
}
function updateStdTemplate(address newStdTemplate) external onlyOwner {
_ERC20_TEMPLATE_ = newStdTemplate;
emit ChangeStdTemplate(newStdTemplate);
}
function updateCustomTemplate(address newCustomTemplate) external onlyOwner {
_CUSTOM_ERC20_TEMPLATE_ = newCustomTemplate;
emit ChangeCustomTemplate(newCustomTemplate);
}
function updateCustomMintableTemplate(address newCustomMintableTemplate) external onlyOwner {
_CUSTOM_MINTABLE_ERC20_TEMPLATE_ = newCustomMintableTemplate;
emit ChangeCustomMintableTemplate(newCustomMintableTemplate);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {InitializableERC721} from "../external/ERC721/InitializableERC721.sol";
import {InitializableERC1155} from "../external/ERC1155/InitializableERC1155.sol";
/**
* @title DODO NFTTokenFactory
* @author DODO Breeder
*
* @notice Help user to create erc721 && erc1155 token
*/
contract NFTTokenFactory {
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _ERC721_TEMPLATE_;
address public immutable _ERC1155_TEMPLATE_;
// ============ Events ============
event NewERC721(address erc721, address creator);
event NewERC1155(address erc1155, address creator);
// ============ Registry ============
mapping(address => address[]) public _USER_ERC721_REGISTRY_;
mapping(address => address[]) public _USER_ERC1155_REGISTRY_;
// ============ Functions ============
constructor(
address cloneFactory,
address erc721Template,
address erc1155Tempalte
) public {
_CLONE_FACTORY_ = cloneFactory;
_ERC721_TEMPLATE_ = erc721Template;
_ERC1155_TEMPLATE_ = erc1155Tempalte;
}
function createERC721(
string memory uri
) external returns (address newERC721) {
newERC721 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC721_TEMPLATE_);
InitializableERC721(newERC721).init(msg.sender, "DODONFT", "DODONFT", uri);
_USER_ERC721_REGISTRY_[msg.sender].push(newERC721);
emit NewERC721(newERC721, msg.sender);
}
function createERC1155(
uint256 amount,
string memory uri
) external returns (address newERC1155) {
newERC1155 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC1155_TEMPLATE_);
InitializableERC1155(newERC1155).init(msg.sender, amount, uri);
_USER_ERC1155_REGISTRY_[msg.sender].push(newERC1155);
emit NewERC1155(newERC1155, msg.sender);
}
function getERC721TokenByUser(address user)
external
view
returns (address[] memory tokens)
{
return _USER_ERC721_REGISTRY_[user];
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
interface IDODOMineV3Registry {
function addMineV3(
address mine,
bool isLpToken,
address stakeToken
) external;
}
/**
* @title DODOMineV3 Registry
* @author DODO Breeder
*
* @notice Register DODOMineV3 Pools
*/
contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry {
mapping (address => bool) public isAdminListed;
// ============ Registry ============
// minePool -> stakeToken
mapping(address => address) public _MINE_REGISTRY_;
// lpToken -> minePool
mapping(address => address[]) public _LP_REGISTRY_;
// singleToken -> minePool
mapping(address => address[]) public _SINGLE_REGISTRY_;
// ============ Events ============
event NewMineV3(address mine, address stakeToken, bool isLpToken);
event RemoveMineV3(address mine, address stakeToken);
event addAdmin(address admin);
event removeAdmin(address admin);
function addMineV3(
address mine,
bool isLpToken,
address stakeToken
) override external {
require(isAdminListed[msg.sender], "ACCESS_DENIED");
_MINE_REGISTRY_[mine] = stakeToken;
if(isLpToken) {
_LP_REGISTRY_[stakeToken].push(mine);
}else {
_SINGLE_REGISTRY_[stakeToken].push(mine);
}
emit NewMineV3(mine, stakeToken, isLpToken);
}
// ============ Admin Operation Functions ============
function removeMineV3(
address mine,
bool isLpToken,
address stakeToken
) external onlyOwner {
_MINE_REGISTRY_[mine] = address(0);
if(isLpToken) {
uint256 len = _LP_REGISTRY_[stakeToken].length;
for (uint256 i = 0; i < len; i++) {
if (mine == _LP_REGISTRY_[stakeToken][i]) {
if(i != len - 1) {
_LP_REGISTRY_[stakeToken][i] = _LP_REGISTRY_[stakeToken][len - 1];
}
_LP_REGISTRY_[stakeToken].pop();
break;
}
}
}else {
uint256 len = _SINGLE_REGISTRY_[stakeToken].length;
for (uint256 i = 0; i < len; i++) {
if (mine == _SINGLE_REGISTRY_[stakeToken][i]) {
if(i != len - 1) {
_SINGLE_REGISTRY_[stakeToken][i] = _SINGLE_REGISTRY_[stakeToken][len - 1];
}
_SINGLE_REGISTRY_[stakeToken].pop();
break;
}
}
}
emit RemoveMineV3(mine, stakeToken);
}
function addAdminList (address contractAddr) external onlyOwner {
isAdminListed[contractAddr] = true;
emit addAdmin(contractAddr);
}
function removeAdminList (address contractAddr) external onlyOwner {
isAdminListed[contractAddr] = false;
emit removeAdmin(contractAddr);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {IDVM} from "../../DODOVendingMachine/intf/IDVM.sol";
import {IFragment} from "../../GeneralizedFragment/intf/IFragment.sol";
interface IDODONFTRegistry {
function addRegistry(
address vault,
address fragment,
address quoteToken,
address dvm
) external;
function removeRegistry(address fragment) external;
}
/**
* @title DODONFT Registry
* @author DODO Breeder
*
* @notice Register DODONFT Pools
*/
contract DODONFTRegistry is InitializableOwnable, IDODONFTRegistry {
mapping (address => bool) public isAdminListed;
// ============ Registry ============
// Vault -> Frag
mapping(address => address) public _VAULT_FRAG_REGISTRY_;
// base -> quote -> DVM address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// ============ Events ============
event NewRegistry(
address vault,
address fragment,
address dvm
);
event RemoveRegistry(address fragment);
// ============ Admin Operation Functions ============
function addRegistry(
address vault,
address fragment,
address quoteToken,
address dvm
) override external {
require(isAdminListed[msg.sender], "ACCESS_DENIED");
_VAULT_FRAG_REGISTRY_[vault] = fragment;
_REGISTRY_[fragment][quoteToken].push(dvm);
emit NewRegistry(vault, fragment, dvm);
}
function removeRegistry(address fragment) override external {
require(isAdminListed[msg.sender], "ACCESS_DENIED");
address vault = IFragment(fragment)._COLLATERAL_VAULT_();
address dvm = IFragment(fragment)._DVM_();
_VAULT_FRAG_REGISTRY_[vault] = address(0);
address quoteToken = IDVM(dvm)._QUOTE_TOKEN_();
address[] memory registryList = _REGISTRY_[fragment][quoteToken];
for (uint256 i = 0; i < registryList.length; i++) {
if (registryList[i] == dvm) {
if(i != registryList.length - 1) {
_REGISTRY_[fragment][quoteToken][i] = _REGISTRY_[fragment][quoteToken][registryList.length - 1];
}
_REGISTRY_[fragment][quoteToken].pop();
break;
}
}
emit RemoveRegistry(fragment);
}
function addAdminList (address contractAddr) external onlyOwner {
isAdminListed[contractAddr] = true;
}
function removeAdminList (address contractAddr) external onlyOwner {
isAdminListed[contractAddr] = false;
}
function getDODOPool(address baseToken, address quoteToken)
external
view
returns (address[] memory pools)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getDODOPoolBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Pool, address[] memory baseToken1Pool)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {ICP} from "../CrowdPooling/intf/ICP.sol";
import {SafeMath} from "../lib/SafeMath.sol";
import {IERC20} from "../intf/IERC20.sol";
import {DecimalMath} from "../lib/DecimalMath.sol";
/**
* @title UpCrowdPoolingFacotry
* @author DODO Breeder
*
* @notice Create And Register vary price CP Pools
*/
contract UpCrowdPoolingFactory is InitializableOwnable {
using SafeMath for uint256;
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DVM_FACTORY_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public immutable _DEFAULT_PERMISSION_MANAGER_;
address public _DEFAULT_MAINTAINER_;
address public _CP_TEMPLATE_;
// ============ Settings =============
uint256 public _FREEZE_DURATION_ = 30 days;
uint256 public _CALM_DURATION_ = 600;
uint256 public _VEST_DURATION_ = 0;
uint256 public _CLIFF_RATE_ = 10**18;
// ============ Registry ============
// base -> quote -> CP address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> CP address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ modifiers ===========
modifier valueCheck(
address cpAddress,
address baseToken,
uint256[] memory timeLine,
uint256[] memory valueList)
{
require(timeLine[2] <= _CALM_DURATION_, "CP_FACTORY : PHASE_CALM_DURATION_INVALID");
require(timeLine[4] == _VEST_DURATION_, "CP_FACTORY : VEST_DURATION_INVALID");
require(valueList[3] == _CLIFF_RATE_, "CP_FACTORY : CLIFF_RATE_INVALID");
require(timeLine[3] >= _FREEZE_DURATION_, "CP_FACTORY : FREEZE_DURATION_INVALID");
_;
}
// ============ Events ============
event NewCP(
address baseToken,
address quoteToken,
address creator,
address cp
);
constructor(
address cloneFactory,
address cpTemplate,
address dvmFactory,
address defaultMaintainer,
address defaultMtFeeRateModel,
address defaultPermissionManager
) public {
_CLONE_FACTORY_ = cloneFactory;
_CP_TEMPLATE_ = cpTemplate;
_DVM_FACTORY_ = dvmFactory;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
_DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager;
}
// ============ Functions ============
function createCrowdPooling() external returns (address newCrowdPooling) {
newCrowdPooling = ICloneFactory(_CLONE_FACTORY_).clone(_CP_TEMPLATE_);
}
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external valueCheck(cpAddress,baseToken,timeLine,valueList) {
{
address[] memory addressList = new address[](7);
addressList[0] = creator;
addressList[1] = _DEFAULT_MAINTAINER_;
addressList[2] = baseToken;
addressList[3] = quoteToken;
addressList[4] = _DEFAULT_PERMISSION_MANAGER_;
addressList[5] = _DEFAULT_MT_FEE_RATE_MODEL_;
addressList[6] = _DVM_FACTORY_;
if(valueList[0] == 0) valueList[0] = uint112(-1);
ICP(cpAddress).init(
addressList,
timeLine,
valueList,
isOpenTWAP
);
}
_REGISTRY_[baseToken][quoteToken].push(cpAddress);
_USER_REGISTRY_[creator].push(cpAddress);
emit NewCP(baseToken, quoteToken, creator, cpAddress);
}
// ============ View Functions ============
function getCrowdPooling(address baseToken, address quoteToken)
external
view
returns (address[] memory pools)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getCrowdPoolingBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Pools, address[] memory baseToken1Pools)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getCrowdPoolingByUser(address user)
external
view
returns (address[] memory pools)
{
return _USER_REGISTRY_[user];
}
// ============ Owner Functions ============
function updateCPTemplate(address _newCPTemplate) external onlyOwner {
_CP_TEMPLATE_ = _newCPTemplate;
}
function updateDefaultMaintainer(address _newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = _newMaintainer;
}
function setFreezeDuration(uint256 _newFreeDuration) public onlyOwner {
_FREEZE_DURATION_ = _newFreeDuration;
}
function setCalmDuration(uint256 _newCalmDuration) public onlyOwner {
_CALM_DURATION_ = _newCalmDuration;
}
function setVestDuration(uint256 _newVestDuration) public onlyOwner {
_VEST_DURATION_ = _newVestDuration;
}
function setCliffRate(uint256 _newCliffRate) public onlyOwner {
require(_newCliffRate <= 10**18, "CP_FACTORY : INVALID");
_CLIFF_RATE_ = _newCliffRate;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IDODOApprove {
function claimTokens(address token,address who,address dest,uint256 amount) external;
function getDODOProxy() external view returns (address);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IDODOApproveProxy {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimTokens(address token,address who,address dest,uint256 amount) external;
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOCallee {
function DVMSellShareCall(
address sender,
uint256 burnShareAmount,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function DVMFlashLoanCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function DPPFlashLoanCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function DSPFlashLoanCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function CPCancelCall(
address sender,
uint256 amount,
bytes calldata data
) external;
function CPClaimBidCall(
address sender,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata data
) external;
function NFTRedeemCall(
address payable assetTo,
uint256 quoteAmount,
bytes calldata
) external;
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IDODONFTApprove {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimERC721(address nftContract, address who, address dest, uint256 tokenId) external;
function claimERC1155(address nftContract, address who, address dest, uint256 tokenId, uint256 amount) external;
function claimERC1155Batch(address nftContract, address who, address dest, uint256[] memory tokenIds, uint256[] memory amounts) external;
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "./IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(
address indexed operator,
address indexed from,
address indexed to,
uint256 id,
uint256 value
);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "./IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "./IERC165.sol";
/**
* _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
To accept the transfer, this must return
`bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
(i.e. 0xf23a6e61, or its own function selector).
@param operator The address which initiated the transfer (i.e. msg.sender)
@param from The address which previously owned the token
@param id The ID of the token being transferred
@param value The amount of tokens being transferred
@param data Additional data with no specified format
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
@dev Handles the receipt of a multiple ERC1155 token types. This function
is called at the end of a `safeBatchTransferFrom` after the balances have
been updated. To accept the transfer(s), this must return
`bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
(i.e. 0xbc197c81, or its own function selector).
@param operator The address which initiated the batch transfer (i.e. msg.sender)
@param from The address which previously owned the token
@param ids An array containing ids of each token being transferred (order and length must match values array)
@param values An array containing amounts of each token being transferred (order and length must match ids array)
@param data Additional data with no specified format
@return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @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);
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "./IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "./IERC165.sol";
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/solc-0.6/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IFeeDistributor {
function init(
address baseToken,
address quoteToken,
address stakeToken
) external;
function stake(address to) external;
function _STAKE_TOKEN_() external view returns(address);
function _STAKE_VAULT_() external view returns(address);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IOracle {
function getPrice() external view returns (uint256);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IWETH {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface ICloneFactory {
function clone(address prototype) external returns (address proxy);
}
// introduction of proxy mode design: https://docs.openzeppelin.com/upgrades/2.8/
// minimum implementation of transparent proxy: https://eips.ethereum.org/EIPS/eip-1167
contract CloneFactory is ICloneFactory {
function clone(address prototype) external override returns (address proxy) {
bytes20 targetBytes = bytes20(prototype);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
proxy := create(0, clone, 0x37)
}
return proxy;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IConstFeeRateModel {
function init(uint256 feeRate) external;
function getFeeRate(address) external view returns (uint256);
}
contract ConstFeeRateModel {
uint256 public _FEE_RATE_;
function init(uint256 feeRate) external {
_FEE_RATE_ = feeRate;
}
function getFeeRate(address) external view returns (uint256) {
return _FEE_RATE_;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {SafeMath} from "./SafeMath.sol";
/**
* @title DecimalMath
* @author DODO Breeder
*
* @notice Functions for fixed point number with 18 decimals
*/
library DecimalMath {
using SafeMath for uint256;
uint256 internal constant ONE = 10**18;
uint256 internal constant ONE2 = 10**36;
function mulFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d) / (10**18);
}
function mulCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d).divCeil(10**18);
}
function divFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(10**18).div(d);
}
function divCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(10**18).divCeil(d);
}
function reciprocalFloor(uint256 target) internal pure returns (uint256) {
return uint256(10**36).div(target);
}
function reciprocalCeil(uint256 target) internal pure returns (uint256) {
return uint256(10**36).divCeil(target);
}
function powFloor(uint256 target, uint256 e) internal pure returns (uint256) {
if (e == 0) {
return 10 ** 18;
} else if (e == 1) {
return target;
} else {
uint p = powFloor(target, e.div(2));
p = p.mul(p) / (10**18);
if (e % 2 == 1) {
p = p.mul(target) / (10**18);
}
return p;
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {SafeMath} from "./SafeMath.sol";
import {DecimalMath} from "./DecimalMath.sol";
/**
* @title DODOMath
* @author DODO Breeder
*
* @notice Functions for complex calculating. Including ONE Integration and TWO Quadratic solutions
*/
library DODOMath {
using SafeMath for uint256;
/*
Integrate dodo curve from V1 to V2
require V0>=V1>=V2>0
res = (1-k)i(V1-V2)+ikV0*V0(1/V2-1/V1)
let V1-V2=delta
res = i*delta*(1-k+k(V0^2/V1/V2))
i is the price of V-res trading pair
support k=1 & k=0 case
[round down]
*/
function _GeneralIntegrate(
uint256 V0,
uint256 V1,
uint256 V2,
uint256 i,
uint256 k
) internal pure returns (uint256) {
require(V0 > 0, "TARGET_IS_ZERO");
uint256 fairAmount = i.mul(V1.sub(V2)); // i*delta
if (k == 0) {
return fairAmount.div(DecimalMath.ONE);
}
uint256 V0V0V1V2 = DecimalMath.divFloor(V0.mul(V0).div(V1), V2);
uint256 penalty = DecimalMath.mulFloor(k, V0V0V1V2); // k(V0^2/V1/V2)
return DecimalMath.ONE.sub(k).add(penalty).mul(fairAmount).div(DecimalMath.ONE2);
}
/*
Follow the integration function above
i*deltaB = (Q2-Q1)*(1-k+kQ0^2/Q1/Q2)
Assume Q2=Q0, Given Q1 and deltaB, solve Q0
i is the price of delta-V trading pair
give out target of V
support k=1 & k=0 case
[round down]
*/
function _SolveQuadraticFunctionForTarget(
uint256 V1,
uint256 delta,
uint256 i,
uint256 k
) internal pure returns (uint256) {
// if (V1 == 0) {
// return 0;
// }
if (k == 0) {
return V1.add(DecimalMath.mulFloor(i, delta));
}
// V0 = V1*(1+(sqrt-1)/2k)
// sqrt = √(1+4kidelta/V1)
// premium = 1+(sqrt-1)/2k
// uint256 sqrt = (4 * k).mul(i).mul(delta).div(V1).add(DecimalMath.ONE2).sqrt();
uint256 sqrt;
uint256 ki = (4 * k).mul(i);
if (ki == 0) {
sqrt = DecimalMath.ONE;
} else if ((ki * delta) / ki == delta) {
sqrt = (ki * delta).div(V1).add(DecimalMath.ONE2).sqrt();
} else {
sqrt = ki.div(V1).mul(delta).add(DecimalMath.ONE2).sqrt();
}
uint256 premium =
DecimalMath.divFloor(sqrt.sub(DecimalMath.ONE), k * 2).add(DecimalMath.ONE);
// V0 is greater than or equal to V1 according to the solution
return DecimalMath.mulFloor(V1, premium);
}
/*
Follow the integration expression above, we have:
i*deltaB = (Q2-Q1)*(1-k+kQ0^2/Q1/Q2)
Given Q1 and deltaB, solve Q2
This is a quadratic function and the standard version is
aQ2^2 + bQ2 + c = 0, where
a=1-k
-b=(1-k)Q1-kQ0^2/Q1+i*deltaB
c=-kQ0^2
and Q2=(-b+sqrt(b^2+4(1-k)kQ0^2))/2(1-k)
note: another root is negative, abondan
if deltaBSig=true, then Q2>Q1, user sell Q and receive B
if deltaBSig=false, then Q2<Q1, user sell B and receive Q
return |Q1-Q2|
as we only support sell amount as delta, the deltaB is always negative
the input ideltaB is actually -ideltaB in the equation
i is the price of delta-V trading pair
support k=1 & k=0 case
[round down]
*/
function _SolveQuadraticFunctionForTrade(
uint256 V0,
uint256 V1,
uint256 delta,
uint256 i,
uint256 k
) internal pure returns (uint256) {
require(V0 > 0, "TARGET_IS_ZERO");
if (delta == 0) {
return 0;
}
if (k == 0) {
return DecimalMath.mulFloor(i, delta) > V1 ? V1 : DecimalMath.mulFloor(i, delta);
}
if (k == DecimalMath.ONE) {
// if k==1
// Q2=Q1/(1+ideltaBQ1/Q0/Q0)
// temp = ideltaBQ1/Q0/Q0
// Q2 = Q1/(1+temp)
// Q1-Q2 = Q1*(1-1/(1+temp)) = Q1*(temp/(1+temp))
// uint256 temp = i.mul(delta).mul(V1).div(V0.mul(V0));
uint256 temp;
uint256 idelta = i.mul(delta);
if (idelta == 0) {
temp = 0;
} else if ((idelta * V1) / idelta == V1) {
temp = (idelta * V1).div(V0.mul(V0));
} else {
temp = delta.mul(V1).div(V0).mul(i).div(V0);
}
return V1.mul(temp).div(temp.add(DecimalMath.ONE));
}
// calculate -b value and sig
// b = kQ0^2/Q1-i*deltaB-(1-k)Q1
// part1 = (1-k)Q1 >=0
// part2 = kQ0^2/Q1-i*deltaB >=0
// bAbs = abs(part1-part2)
// if part1>part2 => b is negative => bSig is false
// if part2>part1 => b is positive => bSig is true
uint256 part2 = k.mul(V0).div(V1).mul(V0).add(i.mul(delta)); // kQ0^2/Q1-i*deltaB
uint256 bAbs = DecimalMath.ONE.sub(k).mul(V1); // (1-k)Q1
bool bSig;
if (bAbs >= part2) {
bAbs = bAbs - part2;
bSig = false;
} else {
bAbs = part2 - bAbs;
bSig = true;
}
bAbs = bAbs.div(DecimalMath.ONE);
// calculate sqrt
uint256 squareRoot =
DecimalMath.mulFloor(
DecimalMath.ONE.sub(k).mul(4),
DecimalMath.mulFloor(k, V0).mul(V0)
); // 4(1-k)kQ0^2
squareRoot = bAbs.mul(bAbs).add(squareRoot).sqrt(); // sqrt(b*b+4(1-k)kQ0*Q0)
// final res
uint256 denominator = DecimalMath.ONE.sub(k).mul(2); // 2(1-k)
uint256 numerator;
if (bSig) {
numerator = squareRoot.sub(bAbs);
} else {
numerator = bAbs.add(squareRoot);
}
uint256 V2 = DecimalMath.divCeil(numerator, denominator);
if (V2 > V1) {
return 0;
} else {
return V1 - V2;
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IExternalValue {
function init(address owner, uint256 value) external;
function set(uint256 value) external;
function get() external view returns (uint256);
}
contract ExternalValue is InitializableOwnable {
uint256 public _VALUE_;
function init(address owner, uint256 value) external {
initOwner(owner);
_VALUE_ = value;
}
function set(uint256 value) external onlyOwner {
_VALUE_ = value;
}
function get() external view returns (uint256) {
return _VALUE_;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IFeeRateImpl {
function getFeeRate(address pool, address trader) external view returns (uint256);
}
interface IFeeRateModel {
function getFeeRate(address trader) external view returns (uint256);
}
contract FeeRateModel is InitializableOwnable {
address public feeRateImpl;
function setFeeProxy(address _feeRateImpl) public onlyOwner {
feeRateImpl = _feeRateImpl;
}
function getFeeRate(address trader) external view returns (uint256) {
if(feeRateImpl == address(0))
return 0;
return IFeeRateImpl(feeRateImpl).getFeeRate(msg.sender,trader);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract Ownable {
address public _OWNER_;
address public _NEW_OWNER_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
constructor() internal {
_OWNER_ = msg.sender;
emit OwnershipTransferred(address(0), _OWNER_);
}
function transferOwnership(address newOwner) external virtual onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() external {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "./InitializableOwnable.sol";
interface IPermissionManager {
function initOwner(address) external;
function isAllowed(address) external view returns (bool);
}
contract PermissionManager is InitializableOwnable {
bool public _WHITELIST_MODE_ON_;
mapping(address => bool) internal _whitelist_;
mapping(address => bool) internal _blacklist_;
function isAllowed(address account) external view returns (bool) {
if (_WHITELIST_MODE_ON_) {
return _whitelist_[account];
} else {
return !_blacklist_[account];
}
}
function openBlacklistMode() external onlyOwner {
_WHITELIST_MODE_ON_ = false;
}
function openWhitelistMode() external onlyOwner {
_WHITELIST_MODE_ON_ = true;
}
function addToWhitelist(address account) external onlyOwner {
_whitelist_[account] = true;
}
function removeFromWhitelist(address account) external onlyOwner {
_whitelist_[account] = false;
}
function addToBlacklist(address account) external onlyOwner {
_blacklist_[account] = true;
}
function removeFromBlacklist(address account) external onlyOwner {
_blacklist_[account] = false;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {SafeMath} from "../lib/SafeMath.sol";
import {DecimalMath} from "../lib/DecimalMath.sol";
import {DODOMath} from "../lib/DODOMath.sol";
/**
* @title Pricing
* @author DODO Breeder
*
* @notice DODO Pricing model
*/
library PMMPricing {
using SafeMath for uint256;
enum RState {ONE, ABOVE_ONE, BELOW_ONE}
struct PMMState {
uint256 i;
uint256 K;
uint256 B;
uint256 Q;
uint256 B0;
uint256 Q0;
RState R;
}
// ============ buy & sell ============
function sellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (uint256 receiveQuoteAmount, RState newR)
{
if (state.R == RState.ONE) {
// case 1: R=1
// R falls below one
receiveQuoteAmount = _ROneSellBaseToken(state, payBaseAmount);
newR = RState.BELOW_ONE;
} else if (state.R == RState.ABOVE_ONE) {
uint256 backToOnePayBase = state.B0.sub(state.B);
uint256 backToOneReceiveQuote = state.Q.sub(state.Q0);
// case 2: R>1
// complex case, R status depends on trading amount
if (payBaseAmount < backToOnePayBase) {
// case 2.1: R status do not change
receiveQuoteAmount = _RAboveSellBaseToken(state, payBaseAmount);
newR = RState.ABOVE_ONE;
if (receiveQuoteAmount > backToOneReceiveQuote) {
// [Important corner case!] may enter this branch when some precision problem happens. And consequently contribute to negative spare quote amount
// to make sure spare quote>=0, mannually set receiveQuote=backToOneReceiveQuote
receiveQuoteAmount = backToOneReceiveQuote;
}
} else if (payBaseAmount == backToOnePayBase) {
// case 2.2: R status changes to ONE
receiveQuoteAmount = backToOneReceiveQuote;
newR = RState.ONE;
} else {
// case 2.3: R status changes to BELOW_ONE
receiveQuoteAmount = backToOneReceiveQuote.add(
_ROneSellBaseToken(state, payBaseAmount.sub(backToOnePayBase))
);
newR = RState.BELOW_ONE;
}
} else {
// state.R == RState.BELOW_ONE
// case 3: R<1
receiveQuoteAmount = _RBelowSellBaseToken(state, payBaseAmount);
newR = RState.BELOW_ONE;
}
}
function sellQuoteToken(PMMState memory state, uint256 payQuoteAmount)
internal
pure
returns (uint256 receiveBaseAmount, RState newR)
{
if (state.R == RState.ONE) {
receiveBaseAmount = _ROneSellQuoteToken(state, payQuoteAmount);
newR = RState.ABOVE_ONE;
} else if (state.R == RState.ABOVE_ONE) {
receiveBaseAmount = _RAboveSellQuoteToken(state, payQuoteAmount);
newR = RState.ABOVE_ONE;
} else {
uint256 backToOnePayQuote = state.Q0.sub(state.Q);
uint256 backToOneReceiveBase = state.B.sub(state.B0);
if (payQuoteAmount < backToOnePayQuote) {
receiveBaseAmount = _RBelowSellQuoteToken(state, payQuoteAmount);
newR = RState.BELOW_ONE;
if (receiveBaseAmount > backToOneReceiveBase) {
receiveBaseAmount = backToOneReceiveBase;
}
} else if (payQuoteAmount == backToOnePayQuote) {
receiveBaseAmount = backToOneReceiveBase;
newR = RState.ONE;
} else {
receiveBaseAmount = backToOneReceiveBase.add(
_ROneSellQuoteToken(state, payQuoteAmount.sub(backToOnePayQuote))
);
newR = RState.ABOVE_ONE;
}
}
}
// ============ R = 1 cases ============
function _ROneSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
{
// in theory Q2 <= targetQuoteTokenAmount
// however when amount is close to 0, precision problems may cause Q2 > targetQuoteTokenAmount
return
DODOMath._SolveQuadraticFunctionForTrade(
state.Q0,
state.Q0,
payBaseAmount,
state.i,
state.K
);
}
function _ROneSellQuoteToken(PMMState memory state, uint256 payQuoteAmount)
internal
pure
returns (
uint256 // receiveBaseToken
)
{
return
DODOMath._SolveQuadraticFunctionForTrade(
state.B0,
state.B0,
payQuoteAmount,
DecimalMath.reciprocalFloor(state.i),
state.K
);
}
// ============ R < 1 cases ============
function _RBelowSellQuoteToken(PMMState memory state, uint256 payQuoteAmount)
internal
pure
returns (
uint256 // receiveBaseToken
)
{
return
DODOMath._GeneralIntegrate(
state.Q0,
state.Q.add(payQuoteAmount),
state.Q,
DecimalMath.reciprocalFloor(state.i),
state.K
);
}
function _RBelowSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
{
return
DODOMath._SolveQuadraticFunctionForTrade(
state.Q0,
state.Q,
payBaseAmount,
state.i,
state.K
);
}
// ============ R > 1 cases ============
function _RAboveSellBaseToken(PMMState memory state, uint256 payBaseAmount)
internal
pure
returns (
uint256 // receiveQuoteToken
)
{
return
DODOMath._GeneralIntegrate(
state.B0,
state.B.add(payBaseAmount),
state.B,
state.i,
state.K
);
}
function _RAboveSellQuoteToken(PMMState memory state, uint256 payQuoteAmount)
internal
pure
returns (
uint256 // receiveBaseToken
)
{
return
DODOMath._SolveQuadraticFunctionForTrade(
state.B0,
state.B,
payQuoteAmount,
DecimalMath.reciprocalFloor(state.i),
state.K
);
}
// ============ Helper functions ============
function adjustedTarget(PMMState memory state) internal pure {
if (state.R == RState.BELOW_ONE) {
state.Q0 = DODOMath._SolveQuadraticFunctionForTarget(
state.Q,
state.B.sub(state.B0),
state.i,
state.K
);
} else if (state.R == RState.ABOVE_ONE) {
state.B0 = DODOMath._SolveQuadraticFunctionForTarget(
state.B,
state.Q.sub(state.Q0),
DecimalMath.reciprocalFloor(state.i),
state.K
);
}
}
function getMidPrice(PMMState memory state) internal pure returns (uint256) {
if (state.R == RState.BELOW_ONE) {
uint256 R = DecimalMath.divFloor(state.Q0.mul(state.Q0).div(state.Q), state.Q);
R = DecimalMath.ONE.sub(state.K).add(DecimalMath.mulFloor(state.K, R));
return DecimalMath.divFloor(state.i, R);
} else {
uint256 R = DecimalMath.divFloor(state.B0.mul(state.B0).div(state.B), state.B);
R = DecimalMath.ONE.sub(state.K).add(DecimalMath.mulFloor(state.K, R));
return DecimalMath.mulFloor(state.i, R);
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IRandomGenerator {
function random(uint256 seed) external view returns (uint256);
}
interface IDODOMidPrice {
function getMidPrice() external view returns (uint256 midPrice);
}
contract RandomGenerator is IRandomGenerator{
address[] public pools;
constructor(address[] memory _pools) public {
for (uint256 i = 0; i < _pools.length; i++) {
pools.push(_pools[i]);
}
}
function random(uint256 seed) external override view returns (uint256) {
uint256 priceSum;
for (uint256 i = 0; i < pools.length; i++) {
priceSum += IDODOMidPrice(pools[i]).getMidPrice();
}
return uint256(keccak256(abi.encodePacked(blockhash(block.number-1), priceSum, seed)));
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title ReentrancyGuard
* @author DODO Breeder
*
* @notice Protect functions from Reentrancy Attack
*/
contract ReentrancyGuard {
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
// zero-state of _ENTERED_ is false
bool private _ENTERED_;
modifier preventReentrant() {
require(!_ENTERED_, "REENTRANT");
_ENTERED_ = true;
_;
_ENTERED_ = false;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
This is a simplified version of OpenZepplin's SafeERC20 library
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IERC20} from "../intf/IERC20.sol";
import {SafeMath} from "./SafeMath.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
import {ICurve} from "../intf/ICurve.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {UniversalERC20} from "../lib/UniversalERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
// for two tokens; to adapter like dodo V1
contract CurveAdapter is IDODOAdapter {
using SafeMath for uint;
using UniversalERC20 for IERC20;
function _curveSwap(address to, address pool, bytes memory moreInfo) internal {
(bool noLending, address fromToken, address toToken, int128 i, int128 j) = abi.decode(moreInfo, (bool, address, address, int128, int128));
uint256 sellAmount = IERC20(fromToken).balanceOf(address(this));
// approve
IERC20(fromToken).universalApproveMax(pool, sellAmount);
// swap
if(noLending) {
ICurve(pool).exchange(i, j, sellAmount, 0);
} else {
ICurve(pool).exchange_underlying(i, j, sellAmount, 0);
}
if(to != address(this)) {
SafeERC20.safeTransfer(IERC20(toToken), to, IERC20(toToken).balanceOf(address(this)));
}
}
function sellBase(address to, address pool, bytes memory moreInfo) external override {
_curveSwap(to, pool, moreInfo);
}
function sellQuote(address to, address pool, bytes memory moreInfo) external override {
_curveSwap(to, pool, moreInfo);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IERC20} from "../../intf/IERC20.sol";
import {IDODOV1} from "../intf/IDODOV1.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {IDODOSellHelper} from "../helper/DODOSellHelper.sol";
import {UniversalERC20} from "../lib/UniversalERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
contract DODOV1Adapter is IDODOAdapter {
using SafeMath for uint256;
using UniversalERC20 for IERC20;
address public immutable _DODO_SELL_HELPER_;
constructor(address dodoSellHelper) public {
_DODO_SELL_HELPER_ = dodoSellHelper;
}
function sellBase(address to, address pool, bytes memory) external override {
address curBase = IDODOV1(pool)._BASE_TOKEN_();
uint256 curAmountIn = IERC20(curBase).tokenBalanceOf(address(this));
IERC20(curBase).universalApproveMax(pool, curAmountIn);
IDODOV1(pool).sellBaseToken(curAmountIn, 0, "");
if(to != address(this)) {
address curQuote = IDODOV1(pool)._QUOTE_TOKEN_();
SafeERC20.safeTransfer(IERC20(curQuote), to, IERC20(curQuote).tokenBalanceOf(address(this)));
}
}
function sellQuote(address to, address pool, bytes memory) external override {
address curQuote = IDODOV1(pool)._QUOTE_TOKEN_();
uint256 curAmountIn = IERC20(curQuote).tokenBalanceOf(address(this));
IERC20(curQuote).universalApproveMax(pool, curAmountIn);
uint256 canBuyBaseAmount = IDODOSellHelper(_DODO_SELL_HELPER_).querySellQuoteToken(
pool,
curAmountIn
);
IDODOV1(pool).buyBaseToken(canBuyBaseAmount, curAmountIn, "");
if(to != address(this)) {
address curBase = IDODOV1(pool)._BASE_TOKEN_();
SafeERC20.safeTransfer(IERC20(curBase), to, canBuyBaseAmount);
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOV2} from "../intf/IDODOV2.sol";
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
contract DODOV2Adapter is IDODOAdapter {
function sellBase(address to, address pool, bytes memory) external override {
IDODOV2(pool).sellBase(to);
}
function sellQuote(address to, address pool, bytes memory) external override {
IDODOV2(pool).sellQuote(to);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IGambit} from "../intf/IGambit.sol";
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
contract GambitAdapter is IDODOAdapter {
function _gambitSwap(address to, address pool, bytes memory moreInfo) internal {
(address tokenIn, address tokenOut) = abi.decode(moreInfo, (address, address));
IGambit(pool).swap(tokenIn, tokenOut, to);
}
function sellBase(address to, address pool, bytes memory moreInfo) external override {
_gambitSwap(to, pool, moreInfo);
}
function sellQuote(address to, address pool, bytes memory moreInfo) external override {
_gambitSwap(to, pool, moreInfo);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
import {IUni} from "../intf/IUni.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
contract UniAdapter is IDODOAdapter {
using SafeMath for uint;
//fromToken == token0
function sellBase(address to, address pool, bytes memory) external override {
address baseToken = IUni(pool).token0();
(uint reserveIn, uint reserveOut,) = IUni(pool).getReserves();
require(reserveIn > 0 && reserveOut > 0, 'UniAdapter: INSUFFICIENT_LIQUIDITY');
uint balance0 = IERC20(baseToken).balanceOf(pool);
uint sellBaseAmount = balance0 - reserveIn;
uint sellBaseAmountWithFee = sellBaseAmount.mul(997);
uint numerator = sellBaseAmountWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(sellBaseAmountWithFee);
uint receiveQuoteAmount = numerator / denominator;
IUni(pool).swap(0, receiveQuoteAmount, to, new bytes(0));
}
//fromToken == token1
function sellQuote(address to, address pool, bytes memory) external override {
address quoteToken = IUni(pool).token1();
(uint reserveOut, uint reserveIn,) = IUni(pool).getReserves();
require(reserveIn > 0 && reserveOut > 0, 'UniAdapter: INSUFFICIENT_LIQUIDITY');
uint balance1 = IERC20(quoteToken).balanceOf(pool);
uint sellQuoteAmount = balance1 - reserveIn;
uint sellQuoteAmountWithFee = sellQuoteAmount.mul(997);
uint numerator = sellQuoteAmountWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(sellQuoteAmountWithFee);
uint receiveBaseAmount = numerator / denominator;
IUni(pool).swap(receiveBaseAmount, 0, to, new bytes(0));
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
import {IUniswapV3SwapCallback} from "../intf/IUniswapV3SwapCallback.sol";
import {IUniV3} from "../intf/IUniV3.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {UniversalERC20} from "../lib/UniversalERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {TickMath} from '../../external/uniswap/TickMath.sol';
import {IWETH} from "../../intf/IWETH.sol";
// to adapter like dodo V1
contract UniV3Adapter is IDODOAdapter, IUniswapV3SwapCallback {
using SafeMath for uint;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
constructor (
address payable weth
) public {
_WETH_ = weth;
}
function _uniV3Swap(address to, address pool, uint160 sqrtX96, bytes memory data) internal {
(address fromToken, address toToken, uint24 fee) = abi.decode(data, (address, address, uint24));
uint256 sellAmount = IERC20(fromToken).balanceOf(address(this));
bool zeroForOne = fromToken < toToken;
// transfer
//IERC20(fromToken).transfer(pool, sellAmount);
// swap
IUniV3(pool).swap(
to,
zeroForOne,
int256(sellAmount),
sqrtX96 == 0
? (zeroForOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1)
: sqrtX96,
data
);
}
function sellBase(address to, address pool, bytes memory moreInfo) external override {
(uint160 sqrtX96, bytes memory data) = abi.decode(moreInfo, (uint160, bytes));
_uniV3Swap(to, pool, sqrtX96, data);
}
function sellQuote(address to, address pool, bytes memory moreInfo) external override {
(uint160 sqrtX96, bytes memory data) = abi.decode(moreInfo, (uint160, bytes));
_uniV3Swap(to, pool, sqrtX96, data);
}
// for uniV3 callback
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata _data
) external override {
require(amount0Delta > 0 || amount1Delta > 0); // swaps entirely within 0-liquidity regions are not supported
(address tokenIn, address tokenOut, uint24 fee) = abi.decode(_data, (address, address, uint24));
(bool isExactInput, uint256 amountToPay) =
amount0Delta > 0
? (tokenIn < tokenOut, uint256(amount0Delta))
: (tokenOut < tokenIn, uint256(amount1Delta));
if (isExactInput) {
pay(tokenIn, address(this), msg.sender, amountToPay);
} else {
tokenIn = tokenOut; // swap in/out because exact output swaps are reversed
pay(tokenIn, address(this), msg.sender, amountToPay);
}
}
/// @param token The token to pay
/// @param payer The entity that must pay
/// @param recipient The entity that will receive payment
/// @param value The amount to pay
function pay(
address token,
address payer,
address recipient,
uint256 value
) internal {
if (token == _WETH_ && address(this).balance >= value) {
// pay with WETH9
IWETH(_WETH_).deposit{value: value}(); // wrap only what is needed to pay
IWETH(_WETH_).transfer(recipient, value);
} else if (payer == address(this)) {
// pay with tokens already in the contract (for the exact input multihop case)
SafeERC20.safeTransfer(IERC20(token), recipient, value);
} else {
// pull payment
SafeERC20.safeTransferFrom(IERC20(token), payer, recipient, value);
}
}
}
// this line is added to create a gist. Empty file is not allowed.
{
"compiler": {
"version": "0.6.9+commit.3e3065ac"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "dvmFactory",
"type": "address"
},
{
"internalType": "address payable",
"name": "weth",
"type": "address"
},
{
"internalType": "address",
"name": "dodoApproveProxy",
"type": "address"
},
{
"internalType": "address",
"name": "dodoSellHelper",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fromAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"name": "OrderHistory",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferPrepared",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [],
"name": "_DODO_APPROVE_PROXY_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_DODO_SELL_HELPER_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_DVM_FACTORY_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_NEW_OWNER_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_OWNER_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_WETH_",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "dvmAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "baseInAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteInAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "baseMinAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteMinAmount",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "flag",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "addDVMLiquidity",
"outputs": [
{
"internalType": "uint256",
"name": "shares",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "baseAdjustedInAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteAdjustedInAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pair",
"type": "address"
},
{
"internalType": "uint256",
"name": "baseAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "baseMinShares",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteMinShares",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "flag",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "addLiquidityToV1",
"outputs": [
{
"internalType": "uint256",
"name": "baseShares",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteShares",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "contractAddr",
"type": "address"
}
],
"name": "addWhiteList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "cpAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "quoteAmount",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "flag",
"type": "uint8"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "bid",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "claimOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "baseToken",
"type": "address"
},
{
"internalType": "address",
"name": "quoteToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "baseInAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "quoteInAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "lpFeeRate",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "i",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "k",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isOpenTWAP",
"type": "bool"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "createDODOVendingMachine",
"outputs": [
{
"internalType": "address",
"name": "newVendingMachine",
"type": "address"
},
{
"internalType": "uint256",
"name": "shares",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "fromTokenAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minReturnAmount",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "dodoPairs",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "directions",
"type": "uint256"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "dodoSwapV1",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "minReturnAmount",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "dodoPairs",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "directions",
"type": "uint256"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "dodoSwapV2ETHToToken",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "fromTokenAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minReturnAmount",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "dodoPairs",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "directions",
"type": "uint256"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "dodoSwapV2TokenToETH",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "fromTokenAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minReturnAmount",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "dodoPairs",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "directions",
"type": "uint256"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "dodoSwapV2TokenToToken",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"internalType": "address",
"name": "toToken",
"type": "address"
},
{
"internalType": "address",
"name": "approveTarget",
"type": "address"
},
{
"internalType": "address",
"name": "swapTarget",
"type": "address"
},
{
"internalType": "uint256",
"name": "fromTokenAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minReturnAmount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callDataConcat",
"type": "bytes"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
},
{
"internalType": "uint256",
"name": "deadLine",
"type": "uint256"
}
],
"name": "externalSwap",
"outputs": [
{
"internalType": "uint256",
"name": "returnAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "initOwner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "isWhiteListed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "contractAddr",
"type": "address"
}
],
"name": "removeWhiteList",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"devdoc": {
"author": "DODO Breeder",
"methods": {},
"title": "DODOV2Proxy02"
},
"userdoc": {
"methods": {},
"notice": "Entrance of trading in DODO platform"
}
},
"settings": {
"compilationTarget": {
"DODO/SmartRoute/DODOV2Proxy02.sol": "DODOV2Proxy02"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
},
"sources": {
"DODO/SmartRoute/DODOApproveProxy.sol": {
"keccak256": "0xe34c917b899ecef9335a851ba8f5fc0f6b7af6d389fc454a1c2236c0b45e7098",
"license": "Apache-2.0",
"urls": [
"bzz-raw://37c71f21288ac18063f736fd918c8f6795954d08817954a58282e203d6fbc727",
"dweb:/ipfs/QmfBBUdYtvT2DB26FTv13iJQgnLt3V9rFazpBppq24BENB"
]
},
"DODO/SmartRoute/DODOV2Proxy02.sol": {
"keccak256": "0xb7a5717bbdb16df610a5626799c07e34c1e61c6ed6e0760a578b1b364325f7ab",
"license": "Apache-2.0",
"urls": [
"bzz-raw://a3b5d49600ac956fbb87656292b87b9eabef8637c3924999fecb63c717df20eb",
"dweb:/ipfs/QmXrLeom8kCUQBF8RUNgGdENrxNqNTr9TsHvKGsaw7LGvY"
]
},
"DODO/SmartRoute/helper/DODOSellHelper.sol": {
"keccak256": "0x7b1ee9fd63f45eee508b47f90d2399165bdd7fbdfc67084379445a6e9fc1d1d2",
"license": "Apache-2.0",
"urls": [
"bzz-raw://015227189252b39d4503c4d05f2d9dbd103eced3a1cb010a080f98cda67c6e61",
"dweb:/ipfs/QmUNwmu5fcY4hB9AhQBAqmMK22yjHDZDdzpiuMrP49dPNQ"
]
},
"DODO/SmartRoute/intf/IDODOAdapter.sol": {
"keccak256": "0xd9298dcd28cd6be58546807ee0d8eaabfac37a2808a79a1db1daad17fa2d9997",
"license": "Apache-2.0",
"urls": [
"bzz-raw://b48fc577930b9cfc0a28b65e33c64fd4b45d9f7d732601ca323b710d00f06e20",
"dweb:/ipfs/QmUCGVmbxGJXVuECBkAgXg8JztYnN6FZPWtvLvc7RoQC1X"
]
},
"DODO/SmartRoute/intf/IDODOV1.sol": {
"keccak256": "0x1a5d0b3741f22bca50c2155b67dd578eb08adc06449f38ab30a3c722a475c5a9",
"license": "Apache-2.0",
"urls": [
"bzz-raw://5be1ad2297acb1e449c29c693a865b086a25dfedc9e7e2c72ca1d8e831543e3c",
"dweb:/ipfs/QmTB2vXa7HLCeMAoCrBs8yUYs7TG7ktaEgrp87G5Cg85rT"
]
},
"DODO/SmartRoute/intf/IDODOV2.sol": {
"keccak256": "0xf16b21ca2a2bc6cdb411499b90c66fd0798ce9571fb30ecf848242235ae7325b",
"license": "Apache-2.0",
"urls": [
"bzz-raw://c0ec9635cb58a2165c20a8217bad70bcd5afd7fcd867d93b14bca255be577454",
"dweb:/ipfs/QmfWVHawtREQeT9cHEznxkJojNsgEr3XzgKj6pABcXFw3D"
]
},
"DODO/SmartRoute/intf/IDODOV2Proxy01.sol": {
"keccak256": "0xd10fc2f23dd4b8bb5203cf04a5bd05c50dccefd244aa2eb8d37c6fd244470b56",
"license": "Apache-2.0",
"urls": [
"bzz-raw://02dff15e1d9697fc8c322984d13ce36b6356862094a4a21be8ef978677cada3d",
"dweb:/ipfs/QmXZQvetKMaxy8T2xKxMnYoSNxod22cGJ5PR69i4t6RUKj"
]
},
"DODO/SmartRoute/intf/IUni.sol": {
"keccak256": "0x39fd556dbf5a0f072696b3559b1ea4e43ca34c631ceb4d12dd27281711066710",
"license": "Apache-2.0",
"urls": [
"bzz-raw://4897c8ff610063a835099d7a96624aa5a6d4ae9445929e5074bdd8c72f4edf49",
"dweb:/ipfs/QmSVbmYhsdpnEspow8LwqkweYM9f4FSWAM9eRtXQ4iFZAe"
]
},
"DODO/SmartRoute/lib/UniversalERC20.sol": {
"keccak256": "0x474cc637f3e9438bb59b0c3337300762ccbcbd2f4c169a29e7b52493904a5e99",
"license": "Apache-2.0",
"urls": [
"bzz-raw://01f47ffe83c76b73adc17d21ff583dd5fb06ab63e621b425011a1cb79757e10a",
"dweb:/ipfs/QmSzLRtPP6p67tUcSb27zwVDvGSY8d557pWUVTrWYrSwdQ"
]
},
"DODO/intf/IDODOApprove.sol": {
"keccak256": "0xedd84e36352ae4e43e39bb00d624146a982e5ff84cea3f1e9a179d32db94bff7",
"license": "Apache-2.0",
"urls": [
"bzz-raw://e6144861ddb00fa55e606324b831c612934998d9ca8288159b892153ee09e415",
"dweb:/ipfs/QmeW9V69rFxuKcS3nbLtymeDLXV2QXUuzMq7UupzS4SqVp"
]
},
"DODO/intf/IERC20.sol": {
"keccak256": "0xbe898d8250024178536a58ad1f8d6e0db1c879e43d648d06f8af0f9331f4dbb5",
"license": "MIT",
"urls": [
"bzz-raw://40e8560f8cbfd4fc33fc6ea0220fca3d4fb0953a680bd449a0177ce787279f55",
"dweb:/ipfs/QmSmRGvM1qohowvGJ7cUu5JzVnmJjw5tLgzr15HihQYKxK"
]
},
"DODO/intf/IWETH.sol": {
"keccak256": "0x477940fe56d5823b603218a07d843eb013524a5b44e2784bf38b8374c22dd4ab",
"license": "Apache-2.0",
"urls": [
"bzz-raw://c9111ef0a330bb0353c5232742867bb18259dd19edd6fb58c83046c007f4dae4",
"dweb:/ipfs/QmWE34g93fLw5sjMfNxRKP4NU6gdjmyd4A2HNVH9DrkdKp"
]
},
"DODO/lib/DecimalMath.sol": {
"keccak256": "0x16aed7bd416ca3c79556abd1535c34eca84f66e9aa7d37f8c28e9cde72e9c634",
"license": "Apache-2.0",
"urls": [
"bzz-raw://cf907fa7d790786486cbbf842d8cbb94c839e0fac88cbbb543ecacdb2c48e9be",
"dweb:/ipfs/Qmd5PxC5EHNooNMoacL3CFGJNNwsTUCBeShbqAtCTUZoCx"
]
},
"DODO/lib/InitializableOwnable.sol": {
"keccak256": "0x386eea470a3d5b4210e4ac231270810acdaec4bc4bd3358b9e3393b77cbbd0ca",
"license": "Apache-2.0",
"urls": [
"bzz-raw://3f9e4d1ace9ebeeb9cfcae44a57b70cbbea66fb628456fc12d77c256772f1519",
"dweb:/ipfs/QmaZ28mKecv6G8z89WoB8RqjiL2KGWHKUBNxAj72cPRA26"
]
},
"DODO/lib/ReentrancyGuard.sol": {
"keccak256": "0xc9c3fc946350fd72083a9d5b1327ff923533ef37b054bc7b6007562b20b0faaf",
"license": "Apache-2.0",
"urls": [
"bzz-raw://fc140417457139fb240427629673bfaf970c5d4568ad1cfe582764c6e4855bbb",
"dweb:/ipfs/Qmd7ESYe5kyM6NYiSzeFE74f1YGGPXzpdVd5qnYg2AvgH8"
]
},
"DODO/lib/SafeERC20.sol": {
"keccak256": "0xe11bb64537b764f7b0b64f817ffa0b4b278c2017474ff985428225b3f0928295",
"license": "Apache-2.0",
"urls": [
"bzz-raw://c756ca959d2326d58ed49b8a2d39100866197596ba09240e4f1bf861399a6e96",
"dweb:/ipfs/QmdgzWZNT614vRnb5zsDva91bkLpvZmCVV5d6xetqsyedR"
]
},
"DODO/lib/SafeMath.sol": {
"keccak256": "0x57d750628881687f826b54f60cbfd46c1a172433eed892bbb123f91869886af1",
"license": "Apache-2.0",
"urls": [
"bzz-raw://b40bd7946010ddae9679f36630510217dcaa9cb8643824f9edc8ef52bda95717",
"dweb:/ipfs/QmZSjpfUGyrmokZyaMc74a8h6zy2qFVECPVP8VfTvzNEFb"
]
}
},
"version": 1
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IERC20} from "../intf/IERC20.sol";
import {SafeERC20} from "../lib/SafeERC20.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
/**
* @title DODOApprove
* @author DODO Breeder
*
* @notice Handle authorizations in DODO platform
*/
contract DODOApprove is InitializableOwnable {
using SafeERC20 for IERC20;
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
uint256 private constant _TIMELOCK_EMERGENCY_DURATION_ = 24 hours;
uint256 public _TIMELOCK_;
address public _PENDING_DODO_PROXY_;
address public _DODO_PROXY_;
// ============ Events ============
event SetDODOProxy(address indexed oldProxy, address indexed newProxy);
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"SetProxy is timelocked"
);
_;
}
function init(address owner, address initProxyAddress) external {
initOwner(owner);
_DODO_PROXY_ = initProxyAddress;
}
function unlockSetProxy(address newDodoProxy) public onlyOwner {
if(_DODO_PROXY_ == address(0))
_TIMELOCK_ = block.timestamp + _TIMELOCK_EMERGENCY_DURATION_;
else
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_DODO_PROXY_ = newDodoProxy;
}
function lockSetProxy() public onlyOwner {
_PENDING_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function setDODOProxy() external onlyOwner notLocked() {
emit SetDODOProxy(_DODO_PROXY_, _PENDING_DODO_PROXY_);
_DODO_PROXY_ = _PENDING_DODO_PROXY_;
lockSetProxy();
}
function claimTokens(
address token,
address who,
address dest,
uint256 amount
) external {
require(msg.sender == _DODO_PROXY_, "DODOApprove:Access restricted");
if (amount > 0) {
IERC20(token).safeTransferFrom(who, dest, amount);
}
}
function getDODOProxy() public view returns (address) {
return _DODO_PROXY_;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOApprove} from "../intf/IDODOApprove.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IDODOApproveProxy {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimTokens(address token,address who,address dest,uint256 amount) external;
}
/**
* @title DODOApproveProxy
* @author DODO Breeder
*
* @notice Allow different version dodoproxy to claim from DODOApprove
*/
contract DODOApproveProxy is InitializableOwnable {
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
mapping (address => bool) public _IS_ALLOWED_PROXY_;
uint256 public _TIMELOCK_;
address public _PENDING_ADD_DODO_PROXY_;
address public immutable _DODO_APPROVE_;
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"SetProxy is timelocked"
);
_;
}
constructor(address dodoApporve) public {
_DODO_APPROVE_ = dodoApporve;
}
function init(address owner, address[] memory proxies) external {
initOwner(owner);
for(uint i = 0; i < proxies.length; i++)
_IS_ALLOWED_PROXY_[proxies[i]] = true;
}
function unlockAddProxy(address newDodoProxy) public onlyOwner {
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_ADD_DODO_PROXY_ = newDodoProxy;
}
function lockAddProxy() public onlyOwner {
_PENDING_ADD_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function addDODOProxy() external onlyOwner notLocked() {
_IS_ALLOWED_PROXY_[_PENDING_ADD_DODO_PROXY_] = true;
lockAddProxy();
}
function removeDODOProxy (address oldDodoProxy) public onlyOwner {
_IS_ALLOWED_PROXY_[oldDodoProxy] = false;
}
function claimTokens(
address token,
address who,
address dest,
uint256 amount
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODOApproveProxy:Access restricted");
IDODOApprove(_DODO_APPROVE_).claimTokens(
token,
who,
dest,
amount
);
}
function isAllowedProxy(address _proxy) external view returns (bool) {
return _IS_ALLOWED_PROXY_[_proxy];
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IERC721} from "../intf/IERC721.sol";
import {IERC1155} from "../intf/IERC1155.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
/**
* @title DODONFTApprove
* @author DODO Breeder
*
* @notice Handle NFT authorizations in DODO platform
*/
contract DODONFTApprove is InitializableOwnable {
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
mapping (address => bool) public _IS_ALLOWED_PROXY_;
uint256 public _TIMELOCK_;
address public _PENDING_ADD_DODO_PROXY_;
// ============ Events ============
event AddDODOProxy(address dodoProxy);
event RemoveDODOProxy(address oldProxy);
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"AddProxy is timelocked"
);
_;
}
function init(address owner, address[] memory proxies) external {
initOwner(owner);
for(uint i = 0; i < proxies.length; i++)
_IS_ALLOWED_PROXY_[proxies[i]] = true;
}
function unlockAddProxy(address newDodoProxy) external onlyOwner {
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_ADD_DODO_PROXY_ = newDodoProxy;
}
function lockAddProxy() public onlyOwner {
_PENDING_ADD_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function addDODOProxy() external onlyOwner notLocked() {
_IS_ALLOWED_PROXY_[_PENDING_ADD_DODO_PROXY_] = true;
lockAddProxy();
emit AddDODOProxy(_PENDING_ADD_DODO_PROXY_);
}
function removeDODOProxy (address oldDodoProxy) external onlyOwner {
_IS_ALLOWED_PROXY_[oldDodoProxy] = false;
emit RemoveDODOProxy(oldDodoProxy);
}
function claimERC721(
address nftContract,
address who,
address dest,
uint256 tokenId
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODONFTApprove:Access restricted");
IERC721(nftContract).safeTransferFrom(who, dest, tokenId);
}
function claimERC1155(
address nftContract,
address who,
address dest,
uint256 tokenId,
uint256 amount
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODONFTApprove:Access restricted");
IERC1155(nftContract).safeTransferFrom(who, dest, tokenId, amount, "");
}
function claimERC1155Batch(
address nftContract,
address who,
address dest,
uint256[] memory tokenIds,
uint256[] memory amounts
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODONFTApprove:Access restricted");
IERC1155(nftContract).safeBatchTransferFrom(who, dest, tokenIds, amounts, "");
}
function isAllowedProxy(address _proxy) external view returns (bool) {
return _IS_ALLOWED_PROXY_[_proxy];
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOV2Proxy01} from "./intf/IDODOV2Proxy01.sol";
import {IDODOV2} from "./intf/IDODOV2.sol";
import {IDODOV1} from "./intf/IDODOV1.sol";
import {IDODOApproveProxy} from "./DODOApproveProxy.sol";
import {IDODOSellHelper} from "./helper/DODOSellHelper.sol";
import {IERC20} from "../intf/IERC20.sol";
import {IWETH} from "../intf/IWETH.sol";
import {IUni} from "./intf/IUni.sol";
import {SafeMath} from "../lib/SafeMath.sol";
import {UniversalERC20} from "./lib/UniversalERC20.sol";
import {SafeERC20} from "../lib/SafeERC20.sol";
import {DecimalMath} from "../lib/DecimalMath.sol";
import {ReentrancyGuard} from "../lib/ReentrancyGuard.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {IDODOAdapter} from "./intf/IDODOAdapter.sol";
/**
* @title DODOV2Proxy02
* @author DODO Breeder
*
* @notice Entrance of trading in DODO platform
*/
contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable {
using SafeMath for uint256;
using UniversalERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _DODO_SELL_HELPER_;
address public immutable _DVM_FACTORY_;
mapping (address => bool) public isWhiteListed;
// ============ Events ============
event OrderHistory(
address fromToken,
address toToken,
address sender,
uint256 fromAmount,
uint256 returnAmount
);
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODOV2Proxy02: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address dvmFactory,
address payable weth,
address dodoApproveProxy,
address dodoSellHelper
) public {
_DVM_FACTORY_ = dvmFactory;
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DODO_SELL_HELPER_ = dodoSellHelper;
}
function addWhiteList (address contractAddr) public onlyOwner {
isWhiteListed[contractAddr] = true;
}
function removeWhiteList (address contractAddr) public onlyOwner {
isWhiteListed[contractAddr] = false;
}
// ============ DVM Functions (create & add liquidity) ============
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP,
uint256 deadLine
)
external
override
payable
preventReentrant
judgeExpired(deadLine)
returns (address newVendingMachine, uint256 shares)
{
{
address _baseToken = baseToken == _ETH_ADDRESS_ ? _WETH_ : baseToken;
address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
newVendingMachine = IDODOV2(_DVM_FACTORY_).createDODOVendingMachine(
_baseToken,
_quoteToken,
lpFeeRate,
i,
k,
isOpenTWAP
);
}
{
address _baseToken = baseToken;
address _quoteToken = quoteToken;
_deposit(
msg.sender,
newVendingMachine,
_baseToken,
baseInAmount,
_baseToken == _ETH_ADDRESS_
);
_deposit(
msg.sender,
newVendingMachine,
_quoteToken,
quoteInAmount,
_quoteToken == _ETH_ADDRESS_
);
}
(shares, , ) = IDODOV2(newVendingMachine).buyShares(msg.sender);
}
function addDVMLiquidity(
address dvmAddress,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 baseMinAmount,
uint256 quoteMinAmount,
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH
uint256 deadLine
)
external
override
payable
preventReentrant
judgeExpired(deadLine)
returns (
uint256 shares,
uint256 baseAdjustedInAmount,
uint256 quoteAdjustedInAmount
)
{
address _dvm = dvmAddress;
(baseAdjustedInAmount, quoteAdjustedInAmount) = _addDVMLiquidity(
_dvm,
baseInAmount,
quoteInAmount
);
require(
baseAdjustedInAmount >= baseMinAmount && quoteAdjustedInAmount >= quoteMinAmount,
"DODOV2Proxy02: deposit amount is not enough"
);
_deposit(msg.sender, _dvm, IDODOV2(_dvm)._BASE_TOKEN_(), baseAdjustedInAmount, flag == 1);
_deposit(msg.sender, _dvm, IDODOV2(_dvm)._QUOTE_TOKEN_(), quoteAdjustedInAmount, flag == 2);
(shares, , ) = IDODOV2(_dvm).buyShares(msg.sender);
// refund dust eth
if (flag == 1 && msg.value > baseAdjustedInAmount) msg.sender.transfer(msg.value - baseAdjustedInAmount);
if (flag == 2 && msg.value > quoteAdjustedInAmount) msg.sender.transfer(msg.value - quoteAdjustedInAmount);
}
function _addDVMLiquidity(
address dvmAddress,
uint256 baseInAmount,
uint256 quoteInAmount
) internal view returns (uint256 baseAdjustedInAmount, uint256 quoteAdjustedInAmount) {
(uint256 baseReserve, uint256 quoteReserve) = IDODOV2(dvmAddress).getVaultReserve();
if (quoteReserve == 0 && baseReserve == 0) {
baseAdjustedInAmount = baseInAmount;
quoteAdjustedInAmount = quoteInAmount;
}
if (quoteReserve == 0 && baseReserve > 0) {
baseAdjustedInAmount = baseInAmount;
quoteAdjustedInAmount = 0;
}
if (quoteReserve > 0 && baseReserve > 0) {
uint256 baseIncreaseRatio = DecimalMath.divFloor(baseInAmount, baseReserve);
uint256 quoteIncreaseRatio = DecimalMath.divFloor(quoteInAmount, quoteReserve);
if (baseIncreaseRatio <= quoteIncreaseRatio) {
baseAdjustedInAmount = baseInAmount;
quoteAdjustedInAmount = DecimalMath.mulFloor(quoteReserve, baseIncreaseRatio);
} else {
quoteAdjustedInAmount = quoteInAmount;
baseAdjustedInAmount = DecimalMath.mulFloor(baseReserve, quoteIncreaseRatio);
}
}
}
// ============ Swap ============
function dodoSwapV2ETHToToken(
address toToken,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool,
uint256 deadLine
)
external
override
payable
judgeExpired(deadLine)
returns (uint256 returnAmount)
{
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
IWETH(_WETH_).deposit{value: msg.value}();
IWETH(_WETH_).transfer(dodoPairs[0], msg.value);
for (uint256 i = 0; i < dodoPairs.length; i++) {
if (i == dodoPairs.length - 1) {
if (directions & 1 == 0) {
IDODOV2(dodoPairs[i]).sellBase(msg.sender);
} else {
IDODOV2(dodoPairs[i]).sellQuote(msg.sender);
}
} else {
if (directions & 1 == 0) {
IDODOV2(dodoPairs[i]).sellBase(dodoPairs[i + 1]);
} else {
IDODOV2(dodoPairs[i]).sellQuote(dodoPairs[i + 1]);
}
}
directions = directions >> 1;
}
returnAmount = IERC20(toToken).balanceOf(msg.sender).sub(originToTokenBalance);
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
emit OrderHistory(
_ETH_ADDRESS_,
toToken,
msg.sender,
msg.value,
returnAmount
);
}
function dodoSwapV2TokenToETH(
address fromToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool,
uint256 deadLine
)
external
override
judgeExpired(deadLine)
returns (uint256 returnAmount)
{
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(fromToken, msg.sender, dodoPairs[0], fromTokenAmount);
for (uint256 i = 0; i < dodoPairs.length; i++) {
if (i == dodoPairs.length - 1) {
if (directions & 1 == 0) {
IDODOV2(dodoPairs[i]).sellBase(address(this));
} else {
IDODOV2(dodoPairs[i]).sellQuote(address(this));
}
} else {
if (directions & 1 == 0) {
IDODOV2(dodoPairs[i]).sellBase(dodoPairs[i + 1]);
} else {
IDODOV2(dodoPairs[i]).sellQuote(dodoPairs[i + 1]);
}
}
directions = directions >> 1;
}
returnAmount = IWETH(_WETH_).balanceOf(address(this));
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
IWETH(_WETH_).withdraw(returnAmount);
msg.sender.transfer(returnAmount);
emit OrderHistory(
fromToken,
_ETH_ADDRESS_,
msg.sender,
fromTokenAmount,
returnAmount
);
}
function dodoSwapV2TokenToToken(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool,
uint256 deadLine
)
external
override
judgeExpired(deadLine)
returns (uint256 returnAmount)
{
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
uint256 originToTokenBalance = IERC20(toToken).balanceOf(msg.sender);
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(fromToken, msg.sender, dodoPairs[0], fromTokenAmount);
for (uint256 i = 0; i < dodoPairs.length; i++) {
if (i == dodoPairs.length - 1) {
if (directions & 1 == 0) {
IDODOV2(dodoPairs[i]).sellBase(msg.sender);
} else {
IDODOV2(dodoPairs[i]).sellQuote(msg.sender);
}
} else {
if (directions& 1 == 0) {
IDODOV2(dodoPairs[i]).sellBase(dodoPairs[i + 1]);
} else {
IDODOV2(dodoPairs[i]).sellQuote(dodoPairs[i + 1]);
}
}
directions = directions >> 1;
}
returnAmount = IERC20(toToken).balanceOf(msg.sender).sub(originToTokenBalance);
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
emit OrderHistory(
fromToken,
toToken,
msg.sender,
fromTokenAmount,
returnAmount
);
}
function externalSwap(
address fromToken,
address toToken,
address approveTarget,
address swapTarget,
uint256 fromTokenAmount,
uint256 minReturnAmount,
bytes memory callDataConcat,
bool,
uint256 deadLine
)
external
override
payable
judgeExpired(deadLine)
returns (uint256 returnAmount)
{
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
uint256 toTokenOriginBalance = IERC20(toToken).universalBalanceOf(msg.sender);
if (fromToken != _ETH_ADDRESS_) {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(
fromToken,
msg.sender,
address(this),
fromTokenAmount
);
IERC20(fromToken).universalApproveMax(approveTarget, fromTokenAmount);
}
require(isWhiteListed[swapTarget], "DODOV2Proxy02: Not Whitelist Contract");
(bool success, ) = swapTarget.call{value: fromToken == _ETH_ADDRESS_ ? msg.value : 0}(callDataConcat);
require(success, "DODOV2Proxy02: External Swap execution Failed");
IERC20(toToken).universalTransfer(
msg.sender,
IERC20(toToken).universalBalanceOf(address(this))
);
returnAmount = IERC20(toToken).universalBalanceOf(msg.sender).sub(toTokenOriginBalance);
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
emit OrderHistory(
fromToken,
toToken,
msg.sender,
fromTokenAmount,
returnAmount
);
}
function dodoSwapV1(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool,
uint256 deadLine
)
external
override
payable
judgeExpired(deadLine)
returns (uint256 returnAmount)
{
require(dodoPairs.length > 0, "DODOV2Proxy02: PAIRS_EMPTY");
require(minReturnAmount > 0, "DODOV2Proxy02: RETURN_AMOUNT_ZERO");
address _fromToken = fromToken;
address _toToken = toToken;
_deposit(msg.sender, address(this), _fromToken, fromTokenAmount, _fromToken == _ETH_ADDRESS_);
for (uint256 i = 0; i < dodoPairs.length; i++) {
address curDodoPair = dodoPairs[i];
if (directions & 1 == 0) {
address curDodoBase = IDODOV1(curDodoPair)._BASE_TOKEN_();
uint256 curAmountIn = IERC20(curDodoBase).balanceOf(address(this));
IERC20(curDodoBase).universalApproveMax(curDodoPair, curAmountIn);
IDODOV1(curDodoPair).sellBaseToken(curAmountIn, 0, "");
} else {
address curDodoQuote = IDODOV1(curDodoPair)._QUOTE_TOKEN_();
uint256 curAmountIn = IERC20(curDodoQuote).balanceOf(address(this));
IERC20(curDodoQuote).universalApproveMax(curDodoPair, curAmountIn);
uint256 canBuyBaseAmount = IDODOSellHelper(_DODO_SELL_HELPER_).querySellQuoteToken(
curDodoPair,
curAmountIn
);
IDODOV1(curDodoPair).buyBaseToken(canBuyBaseAmount, curAmountIn, "");
}
directions = directions >> 1;
}
if (_toToken == _ETH_ADDRESS_) {
returnAmount = IWETH(_WETH_).balanceOf(address(this));
IWETH(_WETH_).withdraw(returnAmount);
} else {
returnAmount = IERC20(_toToken).tokenBalanceOf(address(this));
}
require(returnAmount >= minReturnAmount, "DODOV2Proxy02: Return amount is not enough");
IERC20(_toToken).universalTransfer(msg.sender, returnAmount);
emit OrderHistory(_fromToken, _toToken, msg.sender, fromTokenAmount, returnAmount);
}
//============ CrowdPooling Functions (bid) ============
function bid(
address cpAddress,
uint256 quoteAmount,
uint8 flag, // 0 - ERC20, 1 - quoteInETH
uint256 deadLine
) external override payable preventReentrant judgeExpired(deadLine) {
_deposit(msg.sender, cpAddress, IDODOV2(cpAddress)._QUOTE_TOKEN_(), quoteAmount, flag == 1);
IDODOV2(cpAddress).bid(msg.sender);
}
function addLiquidityToV1(
address pair,
uint256 baseAmount,
uint256 quoteAmount,
uint256 baseMinShares,
uint256 quoteMinShares,
uint8 flag, // 0 erc20 In 1 baseInETH 2 quoteIn ETH
uint256 deadLine
) external override payable preventReentrant judgeExpired(deadLine) returns(uint256 baseShares, uint256 quoteShares) {
address _baseToken = IDODOV1(pair)._BASE_TOKEN_();
address _quoteToken = IDODOV1(pair)._QUOTE_TOKEN_();
_deposit(msg.sender, address(this), _baseToken, baseAmount, flag == 1);
_deposit(msg.sender, address(this), _quoteToken, quoteAmount, flag == 2);
if(baseAmount > 0) {
IERC20(_baseToken).universalApproveMax(pair, baseAmount);
baseShares = IDODOV1(pair).depositBaseTo(msg.sender, baseAmount);
}
if(quoteAmount > 0) {
IERC20(_quoteToken).universalApproveMax(pair, quoteAmount);
quoteShares = IDODOV1(pair).depositQuoteTo(msg.sender, quoteAmount);
}
require(baseShares >= baseMinShares && quoteShares >= quoteMinShares,"DODOV2Proxy02: Return DLP is not enough");
}
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
require(msg.value == amount, "ETH_VALUE_WRONG");
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
function _withdraw(
address payable to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).withdraw(amount);
to.transfer(amount);
}
} else {
if (amount > 0) {
SafeERC20.safeTransfer(IERC20(token), to, amount);
}
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOV2} from "../intf/IDODOV2.sol";
import {IFragment} from "../../GeneralizedFragment/intf/IFragment.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {IWETH} from "../../intf/IWETH.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
contract DODOCalleeHelper is ReentrancyGuard {
using SafeERC20 for IERC20;
address payable public immutable _WETH_;
fallback() external payable {
require(msg.sender == _WETH_, "WE_SAVED_YOUR_ETH");
}
receive() external payable {
require(msg.sender == _WETH_, "WE_SAVED_YOUR_ETH");
}
constructor(address payable weth) public {
_WETH_ = weth;
}
function DVMSellShareCall(
address payable assetTo,
uint256,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata
) external preventReentrant {
address _baseToken = IDODOV2(msg.sender)._BASE_TOKEN_();
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
_withdraw(assetTo, _baseToken, baseAmount, _baseToken == _WETH_);
_withdraw(assetTo, _quoteToken, quoteAmount, _quoteToken == _WETH_);
}
function CPCancelCall(
address payable assetTo,
uint256 amount,
bytes calldata
)external preventReentrant{
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
_withdraw(assetTo, _quoteToken, amount, _quoteToken == _WETH_);
}
function CPClaimBidCall(
address payable assetTo,
uint256 baseAmount,
uint256 quoteAmount,
bytes calldata
) external preventReentrant {
address _baseToken = IDODOV2(msg.sender)._BASE_TOKEN_();
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
_withdraw(assetTo, _baseToken, baseAmount, _baseToken == _WETH_);
_withdraw(assetTo, _quoteToken, quoteAmount, _quoteToken == _WETH_);
}
function NFTRedeemCall(
address payable assetTo,
uint256 quoteAmount,
bytes calldata
) external preventReentrant {
address _quoteToken = IFragment(msg.sender)._QUOTE_();
_withdraw(assetTo, _quoteToken, quoteAmount, _quoteToken == _WETH_);
}
function _withdraw(
address payable to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).withdraw(amount);
to.transfer(amount);
}
} else {
if (amount > 0) {
SafeERC20.safeTransfer(IERC20(token), to, amount);
}
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOV2} from "../intf/IDODOV2.sol";
contract DODONFTRouteHelper {
address public immutable _NFT_REGISTER_;
struct PairDetail {
uint256 i;
uint256 K;
uint256 B;
uint256 Q;
uint256 B0;
uint256 Q0;
uint256 R;
uint256 lpFeeRate;
uint256 mtFeeRate;
address baseToken;
address quoteToken;
address curPair;
uint256 pairVersion;
}
constructor(address nftRegistry) public {
_NFT_REGISTER_ = nftRegistry;
}
function getPairDetail(address token0,address token1,address userAddr) external view returns (PairDetail[] memory res) {
(address[] memory baseToken0DVM, address[] memory baseToken1DVM) = IDODOV2(_NFT_REGISTER_).getDODOPoolBidirection(token0,token1);
uint256 len = baseToken0DVM.length + baseToken1DVM.length;
res = new PairDetail[](len);
for(uint8 i = 0; i < len; i++) {
PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0),address(0),2);
address cur;
if(i < baseToken0DVM.length) {
cur = baseToken0DVM[i];
curRes.baseToken = token0;
curRes.quoteToken = token1;
} else {
cur = baseToken1DVM[i - baseToken0DVM.length];
curRes.baseToken = token1;
curRes.quoteToken = token0;
}
(
curRes.i,
curRes.K,
curRes.B,
curRes.Q,
curRes.B0,
curRes.Q0,
curRes.R
) = IDODOV2(cur).getPMMStateForCall();
(curRes.lpFeeRate, curRes.mtFeeRate) = IDODOV2(cur).getUserFeeRate(userAddr);
curRes.curPair = cur;
res[i] = curRes;
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOV1} from "../intf/IDODOV1.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
// import {DODOMath} from "../lib/DODOMath.sol";
interface IDODOSellHelper {
function querySellQuoteToken(address dodo, uint256 amount) external view returns (uint256);
function querySellBaseToken(address dodo, uint256 amount) external view returns (uint256);
}
library DODOMath {
using SafeMath for uint256;
/*
Integrate dodo curve fron V1 to V2
require V0>=V1>=V2>0
res = (1-k)i(V1-V2)+ikV0*V0(1/V2-1/V1)
let V1-V2=delta
res = i*delta*(1-k+k(V0^2/V1/V2))
*/
function _GeneralIntegrate(
uint256 V0,
uint256 V1,
uint256 V2,
uint256 i,
uint256 k
) internal pure returns (uint256) {
uint256 fairAmount = DecimalMath.mulFloor(i, V1.sub(V2)); // i*delta
uint256 V0V0V1V2 = DecimalMath.divCeil(V0.mul(V0).div(V1), V2);
uint256 penalty = DecimalMath.mulFloor(k, V0V0V1V2); // k(V0^2/V1/V2)
return DecimalMath.mulFloor(fairAmount, DecimalMath.ONE.sub(k).add(penalty));
}
/*
The same with integration expression above, we have:
i*deltaB = (Q2-Q1)*(1-k+kQ0^2/Q1/Q2)
Given Q1 and deltaB, solve Q2
This is a quadratic function and the standard version is
aQ2^2 + bQ2 + c = 0, where
a=1-k
-b=(1-k)Q1-kQ0^2/Q1+i*deltaB
c=-kQ0^2
and Q2=(-b+sqrt(b^2+4(1-k)kQ0^2))/2(1-k)
note: another root is negative, abondan
if deltaBSig=true, then Q2>Q1
if deltaBSig=false, then Q2<Q1
*/
function _SolveQuadraticFunctionForTrade(
uint256 Q0,
uint256 Q1,
uint256 ideltaB,
bool deltaBSig,
uint256 k
) internal pure returns (uint256) {
// calculate -b value and sig
// -b = (1-k)Q1-kQ0^2/Q1+i*deltaB
uint256 kQ02Q1 = DecimalMath.mulFloor(k, Q0).mul(Q0).div(Q1); // kQ0^2/Q1
uint256 b = DecimalMath.mulFloor(DecimalMath.ONE.sub(k), Q1); // (1-k)Q1
bool minusbSig = true;
if (deltaBSig) {
b = b.add(ideltaB); // (1-k)Q1+i*deltaB
} else {
kQ02Q1 = kQ02Q1.add(ideltaB); // i*deltaB+kQ0^2/Q1
}
if (b >= kQ02Q1) {
b = b.sub(kQ02Q1);
minusbSig = true;
} else {
b = kQ02Q1.sub(b);
minusbSig = false;
}
// calculate sqrt
uint256 squareRoot = DecimalMath.mulFloor(
DecimalMath.ONE.sub(k).mul(4),
DecimalMath.mulFloor(k, Q0).mul(Q0)
); // 4(1-k)kQ0^2
squareRoot = b.mul(b).add(squareRoot).sqrt(); // sqrt(b*b+4(1-k)kQ0*Q0)
// final res
uint256 denominator = DecimalMath.ONE.sub(k).mul(2); // 2(1-k)
uint256 numerator;
if (minusbSig) {
numerator = b.add(squareRoot);
} else {
numerator = squareRoot.sub(b);
}
if (deltaBSig) {
return DecimalMath.divFloor(numerator, denominator);
} else {
return DecimalMath.divCeil(numerator, denominator);
}
}
/*
Start from the integration function
i*deltaB = (Q2-Q1)*(1-k+kQ0^2/Q1/Q2)
Assume Q2=Q0, Given Q1 and deltaB, solve Q0
let fairAmount = i*deltaB
*/
function _SolveQuadraticFunctionForTarget(
uint256 V1,
uint256 k,
uint256 fairAmount
) internal pure returns (uint256 V0) {
// V0 = V1+V1*(sqrt-1)/2k
uint256 sqrt = DecimalMath.divCeil(DecimalMath.mulFloor(k, fairAmount).mul(4), V1);
sqrt = sqrt.add(DecimalMath.ONE).mul(DecimalMath.ONE).sqrt();
uint256 premium = DecimalMath.divCeil(sqrt.sub(DecimalMath.ONE), k.mul(2));
// V0 is greater than or equal to V1 according to the solution
return DecimalMath.mulFloor(V1, DecimalMath.ONE.add(premium));
}
}
contract DODOSellHelper {
using SafeMath for uint256;
enum RStatus {ONE, ABOVE_ONE, BELOW_ONE}
uint256 constant ONE = 10**18;
struct DODOState {
uint256 oraclePrice;
uint256 K;
uint256 B;
uint256 Q;
uint256 baseTarget;
uint256 quoteTarget;
RStatus rStatus;
}
function querySellBaseToken(address dodo, uint256 amount) public view returns (uint256) {
return IDODOV1(dodo).querySellBaseToken(amount);
}
function querySellQuoteToken(address dodo, uint256 amount) public view returns (uint256) {
DODOState memory state;
(state.baseTarget, state.quoteTarget) = IDODOV1(dodo).getExpectedTarget();
state.rStatus = RStatus(IDODOV1(dodo)._R_STATUS_());
state.oraclePrice = IDODOV1(dodo).getOraclePrice();
state.Q = IDODOV1(dodo)._QUOTE_BALANCE_();
state.B = IDODOV1(dodo)._BASE_BALANCE_();
state.K = IDODOV1(dodo)._K_();
uint256 boughtAmount;
// Determine the status (RStatus) and calculate the amount
// based on the state
if (state.rStatus == RStatus.ONE) {
boughtAmount = _ROneSellQuoteToken(amount, state);
} else if (state.rStatus == RStatus.ABOVE_ONE) {
boughtAmount = _RAboveSellQuoteToken(amount, state);
} else {
uint256 backOneBase = state.B.sub(state.baseTarget);
uint256 backOneQuote = state.quoteTarget.sub(state.Q);
if (amount <= backOneQuote) {
boughtAmount = _RBelowSellQuoteToken(amount, state);
} else {
boughtAmount = backOneBase.add(
_ROneSellQuoteToken(amount.sub(backOneQuote), state)
);
}
}
// Calculate fees
return
DecimalMath.divFloor(
boughtAmount,
DecimalMath.ONE.add(IDODOV1(dodo)._MT_FEE_RATE_()).add(
IDODOV1(dodo)._LP_FEE_RATE_()
)
);
}
function _ROneSellQuoteToken(uint256 amount, DODOState memory state)
internal
pure
returns (uint256 receiveBaseToken)
{
uint256 i = DecimalMath.divFloor(ONE, state.oraclePrice);
uint256 B2 = DODOMath._SolveQuadraticFunctionForTrade(
state.baseTarget,
state.baseTarget,
DecimalMath.mulFloor(i, amount),
false,
state.K
);
return state.baseTarget.sub(B2);
}
function _RAboveSellQuoteToken(uint256 amount, DODOState memory state)
internal
pure
returns (uint256 receieBaseToken)
{
uint256 i = DecimalMath.divFloor(ONE, state.oraclePrice);
uint256 B2 = DODOMath._SolveQuadraticFunctionForTrade(
state.baseTarget,
state.B,
DecimalMath.mulFloor(i, amount),
false,
state.K
);
return state.B.sub(B2);
}
function _RBelowSellQuoteToken(uint256 amount, DODOState memory state)
internal
pure
returns (uint256 receiveBaseToken)
{
uint256 Q1 = state.Q.add(amount);
uint256 i = DecimalMath.divFloor(ONE, state.oraclePrice);
return DODOMath._GeneralIntegrate(state.quoteTarget, Q1, state.Q, i, state.K);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOV1} from "../intf/IDODOV1.sol";
import {IDODOSellHelper} from "./DODOSellHelper.sol";
contract DODOSwapCalcHelper {
address public immutable _DODO_SELL_HELPER_;
constructor(address dodoSellHelper) public {
_DODO_SELL_HELPER_ = dodoSellHelper;
}
function calcReturnAmountV1(
uint256 fromTokenAmount,
address[] memory dodoPairs,
uint8[] memory directions
) external view returns (uint256 returnAmount,uint256[] memory midPrices,uint256[] memory feeRates) {
returnAmount = fromTokenAmount;
midPrices = new uint256[](dodoPairs.length);
feeRates = new uint256[](dodoPairs.length);
for (uint256 i = 0; i < dodoPairs.length; i++) {
address curDodoPair = dodoPairs[i];
if (directions[i] == 0) {
returnAmount = IDODOV1(curDodoPair).querySellBaseToken(returnAmount);
} else {
returnAmount = IDODOSellHelper(_DODO_SELL_HELPER_).querySellQuoteToken(
curDodoPair,
returnAmount
);
}
midPrices[i] = IDODOV1(curDodoPair).getMidPrice();
feeRates[i] = IDODOV1(curDodoPair)._MT_FEE_RATE_() + IDODOV1(curDodoPair)._LP_FEE_RATE_();
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOV1} from "../intf/IDODOV1.sol";
contract DODOV1PmmHelper {
struct PairDetail {
uint256 i;
uint256 K;
uint256 B;
uint256 Q;
uint256 B0;
uint256 Q0;
uint256 R;
uint256 lpFeeRate;
uint256 mtFeeRate;
address baseToken;
address quoteToken;
address curPair;
uint256 pairVersion;
}
function getPairDetail(address pool) external view returns (PairDetail[] memory res) {
res = new PairDetail[](1);
PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0),pool,1);
curRes.i = IDODOV1(pool).getOraclePrice();
curRes.K = IDODOV1(pool)._K_();
curRes.B = IDODOV1(pool)._BASE_BALANCE_();
curRes.Q = IDODOV1(pool)._QUOTE_BALANCE_();
(curRes.B0,curRes.Q0) = IDODOV1(pool).getExpectedTarget();
curRes.R = IDODOV1(pool)._R_STATUS_();
curRes.lpFeeRate = IDODOV1(pool)._LP_FEE_RATE_();
curRes.mtFeeRate = IDODOV1(pool)._MT_FEE_RATE_();
curRes.baseToken = IDODOV1(pool)._BASE_TOKEN_();
curRes.quoteToken = IDODOV1(pool)._QUOTE_TOKEN_();
res[0] = curRes;
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOV2} from "../intf/IDODOV2.sol";
contract DODOV2RouteHelper {
address public immutable _DVM_FACTORY_;
address public immutable _DPP_FACTORY_;
address public immutable _DSP_FACTORY_;
struct PairDetail {
uint256 i;
uint256 K;
uint256 B;
uint256 Q;
uint256 B0;
uint256 Q0;
uint256 R;
uint256 lpFeeRate;
uint256 mtFeeRate;
address baseToken;
address quoteToken;
address curPair;
uint256 pairVersion;
}
constructor(address dvmFactory,address dppFactory,address dspFactory) public {
_DVM_FACTORY_ = dvmFactory;
_DPP_FACTORY_ = dppFactory;
_DSP_FACTORY_ = dspFactory;
}
function getPairDetail(address token0,address token1,address userAddr) external view returns (PairDetail[] memory res) {
(address[] memory baseToken0DVM, address[] memory baseToken1DVM) = IDODOV2(_DVM_FACTORY_).getDODOPoolBidirection(token0,token1);
(address[] memory baseToken0DPP, address[] memory baseToken1DPP) = IDODOV2(_DPP_FACTORY_).getDODOPoolBidirection(token0,token1);
(address[] memory baseToken0DSP, address[] memory baseToken1DSP) = IDODOV2(_DSP_FACTORY_).getDODOPoolBidirection(token0,token1);
uint256 len = baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length + baseToken1DPP.length + baseToken0DSP.length + baseToken1DSP.length;
res = new PairDetail[](len);
for(uint8 i = 0; i < len; i++) {
PairDetail memory curRes = PairDetail(0,0,0,0,0,0,0,0,0,address(0),address(0),address(0),2);
address cur;
if(i < baseToken0DVM.length) {
cur = baseToken0DVM[i];
curRes.baseToken = token0;
curRes.quoteToken = token1;
} else if(i < baseToken0DVM.length + baseToken1DVM.length) {
cur = baseToken1DVM[i - baseToken0DVM.length];
curRes.baseToken = token1;
curRes.quoteToken = token0;
} else if(i < baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length) {
cur = baseToken0DPP[i - baseToken0DVM.length - baseToken1DVM.length];
curRes.baseToken = token0;
curRes.quoteToken = token1;
} else if(i < baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length + baseToken1DPP.length) {
cur = baseToken1DPP[i - baseToken0DVM.length - baseToken1DVM.length - baseToken0DPP.length];
curRes.baseToken = token1;
curRes.quoteToken = token0;
} else if(i < baseToken0DVM.length + baseToken1DVM.length + baseToken0DPP.length + baseToken1DPP.length + baseToken0DSP.length) {
cur = baseToken0DSP[i - baseToken0DVM.length - baseToken1DVM.length - baseToken0DPP.length - baseToken1DPP.length];
curRes.baseToken = token0;
curRes.quoteToken = token1;
} else {
cur = baseToken1DSP[i - baseToken0DVM.length - baseToken1DVM.length - baseToken0DPP.length - baseToken1DPP.length - baseToken0DSP.length];
curRes.baseToken = token1;
curRes.quoteToken = token0;
}
(
curRes.i,
curRes.K,
curRes.B,
curRes.Q,
curRes.B0,
curRes.Q0,
curRes.R
) = IDODOV2(cur).getPMMStateForCall();
(curRes.lpFeeRate, curRes.mtFeeRate) = IDODOV2(cur).getUserFeeRate(userAddr);
curRes.curPair = cur;
res[i] = curRes;
}
}
}
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"görli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"immutableReferences": {},
"linkReferences": {},
"object": "",
"opcodes": "",
"sourceMap": ""
},
"gasEstimates": null,
"methodIdentifiers": {
"getReserves()": "0902f1ac",
"swap(uint256,uint256,address,bytes)": "022c0d9f",
"swapExactTokensForTokens(uint256,uint256,address[],address,uint256)": "38ed1739",
"token0()": "0dfe1681",
"token1()": "d21220a7"
}
},
"abi": [
{
"inputs": [],
"name": "getReserves",
"outputs": [
{
"internalType": "uint112",
"name": "reserve0",
"type": "uint112"
},
{
"internalType": "uint112",
"name": "reserve1",
"type": "uint112"
},
{
"internalType": "uint32",
"name": "blockTimestampLast",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount0Out",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount1Out",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "swap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "path",
"type": "address[]"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
}
],
"name": "swapExactTokensForTokens",
"outputs": [
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "token0",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token1",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
]
}
{
"compiler": {
"version": "0.6.9+commit.3e3065ac"
},
"language": "Solidity",
"output": {
"abi": [
{
"inputs": [],
"name": "getReserves",
"outputs": [
{
"internalType": "uint112",
"name": "reserve0",
"type": "uint112"
},
{
"internalType": "uint112",
"name": "reserve1",
"type": "uint112"
},
{
"internalType": "uint32",
"name": "blockTimestampLast",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount0Out",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount1Out",
"type": "uint256"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "swap",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amountOutMin",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "path",
"type": "address[]"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
}
],
"name": "swapExactTokensForTokens",
"outputs": [
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "token0",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token1",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
],
"devdoc": {
"methods": {}
},
"userdoc": {
"methods": {}
}
},
"settings": {
"compilationTarget": {
"DODO/SmartRoute/intf/IUni.sol": "IUni"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
},
"sources": {
"DODO/SmartRoute/intf/IUni.sol": {
"keccak256": "0x39fd556dbf5a0f072696b3559b1ea4e43ca34c631ceb4d12dd27281711066710",
"license": "Apache-2.0",
"urls": [
"bzz-raw://4897c8ff610063a835099d7a96624aa5a6d4ae9445929e5074bdd8c72f4edf49",
"dweb:/ipfs/QmSVbmYhsdpnEspow8LwqkweYM9f4FSWAM9eRtXQ4iFZAe"
]
}
},
"version": 1
}
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IChi {
function freeUpTo(uint256 value) external returns (uint256);
}
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface ICurve {
// solium-disable-next-line mixedcase
function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns(uint256 dy);
// solium-disable-next-line mixedcase
function get_dy(int128 i, int128 j, uint256 dx) external view returns(uint256 dy);
// solium-disable-next-line mixedcase
function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 minDy) external;
// solium-disable-next-line mixedcase
function exchange(int128 i, int128 j, uint256 dx, uint256 minDy) external;
// view coins address
function underlying_coins(int128 arg0) external view returns(address out);
function coins(int128 arg0) external view returns(address out);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOAdapter {
function sellBase(address to, address pool, bytes memory data) external;
function sellQuote(address to, address pool, bytes memory data) external;
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOV1 {
function init(
address owner,
address supervisor,
address maintainer,
address baseToken,
address quoteToken,
address oracle,
uint256 lpFeeRate,
uint256 mtFeeRate,
uint256 k,
uint256 gasPriceLimit
) external;
function transferOwnership(address newOwner) external;
function claimOwnership() external;
function sellBaseToken(
uint256 amount,
uint256 minReceiveQuote,
bytes calldata data
) external returns (uint256);
function buyBaseToken(
uint256 amount,
uint256 maxPayQuote,
bytes calldata data
) external returns (uint256);
function querySellBaseToken(uint256 amount) external view returns (uint256 receiveQuote);
function queryBuyBaseToken(uint256 amount) external view returns (uint256 payQuote);
function depositBaseTo(address to, uint256 amount) external returns (uint256);
function withdrawBase(uint256 amount) external returns (uint256);
function withdrawAllBase() external returns (uint256);
function depositQuoteTo(address to, uint256 amount) external returns (uint256);
function withdrawQuote(uint256 amount) external returns (uint256);
function withdrawAllQuote() external returns (uint256);
function _BASE_CAPITAL_TOKEN_() external returns (address);
function _QUOTE_CAPITAL_TOKEN_() external returns (address);
function _BASE_TOKEN_() external view returns (address);
function _QUOTE_TOKEN_() external view returns (address);
function _R_STATUS_() external view returns (uint8);
function _QUOTE_BALANCE_() external view returns (uint256);
function _BASE_BALANCE_() external view returns (uint256);
function _K_() external view returns (uint256);
function _MT_FEE_RATE_() external view returns (uint256);
function _LP_FEE_RATE_() external view returns (uint256);
function getExpectedTarget() external view returns (uint256 baseTarget, uint256 quoteTarget);
function getOraclePrice() external view returns (uint256);
function getMidPrice() external view returns (uint256 midPrice);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOV1Proxy01 {
function dodoSwapV1(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint8[] memory directions,
uint256 deadLine
) external payable returns (uint256 returnAmount);
function externalSwap(
address fromToken,
address toToken,
address approveTarget,
address to,
uint256 fromTokenAmount,
uint256 minReturnAmount,
bytes memory callDataConcat,
uint256 deadLine
) external payable returns (uint256 returnAmount);
function mixSwapV1(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory mixPairs,
uint8[] memory directions,
address[] memory portionPath,
uint256 deadLine
) external payable returns (uint256 returnAmount);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOV1Proxy02 {
function dodoSwapV1(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
uint256 deadLine
) external payable returns (uint256 returnAmount);
function externalSwap(
address fromToken,
address toToken,
address approveTarget,
address to,
uint256 fromTokenAmount,
uint256 minReturnAmount,
bytes memory callDataConcat,
uint256 deadLine
) external payable returns (uint256 returnAmount);
function mixSwapV1(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory mixPairs,
uint256[] memory directions,
address[] memory portionPath,
uint256 deadLine
) external payable returns (uint256 returnAmount);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOV2 {
//========== Common ==================
function sellBase(address to) external returns (uint256 receiveQuoteAmount);
function sellQuote(address to) external returns (uint256 receiveBaseAmount);
function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve);
function _BASE_TOKEN_() external view returns (address);
function _QUOTE_TOKEN_() external view returns (address);
function getPMMStateForCall() external view returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint256 R
);
function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate);
function getDODOPoolBidirection(address token0, address token1) external view returns (address[] memory, address[] memory);
//========== DODOVendingMachine ========
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine);
function buyShares(address to) external returns (uint256,uint256,uint256);
//========== DODOPrivatePool ===========
function createDODOPrivatePool() external returns (address newPrivatePool);
function initDODOPrivatePool(
address dppAddress,
address creator,
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 k,
uint256 i,
bool isOpenTwap
) external;
function reset(
address operator,
uint256 newLpFeeRate,
uint256 newI,
uint256 newK,
uint256 baseOutAmount,
uint256 quoteOutAmount,
uint256 minBaseReserve,
uint256 minQuoteReserve
) external returns (bool);
function _OWNER_() external returns (address);
//========== CrowdPooling ===========
function createCrowdPooling() external returns (address payable newCrowdPooling);
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOV2Proxy01 {
function dodoSwapV2ETHToToken(
address toToken,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool isIncentive,
uint256 deadLine
) external payable returns (uint256 returnAmount);
function dodoSwapV2TokenToETH(
address fromToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool isIncentive,
uint256 deadLine
) external returns (uint256 returnAmount);
function dodoSwapV2TokenToToken(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool isIncentive,
uint256 deadLine
) external returns (uint256 returnAmount);
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP,
uint256 deadLine
) external payable returns (address newVendingMachine, uint256 shares);
function addDVMLiquidity(
address dvmAddress,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 baseMinAmount,
uint256 quoteMinAmount,
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH
uint256 deadLine
)
external
payable
returns (
uint256 shares,
uint256 baseAdjustedInAmount,
uint256 quoteAdjustedInAmount
);
// function createDODOPrivatePool(
// address baseToken,
// address quoteToken,
// uint256 baseInAmount,
// uint256 quoteInAmount,
// uint256 lpFeeRate,
// uint256 i,
// uint256 k,
// bool isOpenTwap,
// uint256 deadLine
// ) external payable returns (address newPrivatePool);
// function resetDODOPrivatePool(
// address dppAddress,
// uint256[] memory paramList, //0 - newLpFeeRate, 1 - newI, 2 - newK
// uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3 - quoteOutAmount
// uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
// uint256 minBaseReserve,
// uint256 minQuoteReserve,
// uint256 deadLine
// ) external payable;
function bid(
address cpAddress,
uint256 quoteAmount,
uint8 flag, // 0 - ERC20, 1 - quoteInETH
uint256 deadLine
) external payable;
function addLiquidityToV1(
address pair,
uint256 baseAmount,
uint256 quoteAmount,
uint256 baseMinShares,
uint256 quoteMinShares,
uint8 flag, // 0 erc20 Out 1 baseInETH 2 quoteInETH
uint256 deadLine
) external payable returns(uint256, uint256);
function dodoSwapV1(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory dodoPairs,
uint256 directions,
bool isIncentive,
uint256 deadLine
) external payable returns (uint256 returnAmount);
function externalSwap(
address fromToken,
address toToken,
address approveTarget,
address to,
uint256 fromTokenAmount,
uint256 minReturnAmount,
bytes memory callDataConcat,
bool isIncentive,
uint256 deadLine
) external payable returns (uint256 returnAmount);
// function mixSwap(
// address fromToken,
// address toToken,
// uint256 fromTokenAmount,
// uint256 minReturnAmount,
// address[] memory mixAdapters,
// address[] memory mixPairs,
// address[] memory assetTo,
// uint256 directions,
// bool isIncentive,
// uint256 deadLine
// ) external payable returns (uint256 returnAmount);
}
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IGambit {
function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);
}
//SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IUni {
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns (address);
function token1() external view returns (address);
}
pragma solidity 0.6.9;
/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
/// @dev In the implementation you must pay the pool tokens owed for the swap.
/// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
/// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IUniV3 {
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {SafeMath} from "../../lib/SafeMath.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
library UniversalERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 private constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
function universalTransfer(
IERC20 token,
address payable to,
uint256 amount
) internal {
if (amount > 0) {
if (isETH(token)) {
to.transfer(amount);
} else {
token.safeTransfer(to, amount);
}
}
}
function universalApproveMax(
IERC20 token,
address to,
uint256 amount
) internal {
uint256 allowance = token.allowance(address(this), to);
if (allowance < amount) {
if (allowance > 0) {
token.safeApprove(to, 0);
}
token.safeApprove(to, uint256(-1));
}
}
function universalBalanceOf(IERC20 token, address who) internal view returns (uint256) {
if (isETH(token)) {
return who.balance;
} else {
return token.balanceOf(who);
}
}
function tokenBalanceOf(IERC20 token, address who) internal view returns (uint256) {
return token.balanceOf(who);
}
function isETH(IERC20 token) internal pure returns (bool) {
return token == ETH_ADDRESS;
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {IDODOV2} from "./../intf/IDODOV2.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {IWETH} from "../../intf/IWETH.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
/**
* @title DODOCpProxy
* @author DODO Breeder
*
* @notice CrowdPooling && UpCrowdPooling Proxy
*/
contract DODOCpProxy is ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _UPCP_FACTORY_;
address public immutable _CP_FACTORY_;
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODOCpProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address payable weth,
address cpFactory,
address upCpFactory,
address dodoApproveProxy
) public {
_WETH_ = weth;
_CP_FACTORY_ = cpFactory;
_UPCP_FACTORY_ = upCpFactory;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
//============ UpCrowdPooling Functions (create) ============
function createUpCrowdPooling(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP,
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) returns (address payable newUpCrowdPooling) {
address _baseToken = baseToken;
address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
newUpCrowdPooling = IDODOV2(_UPCP_FACTORY_).createCrowdPooling();
_deposit(
msg.sender,
newUpCrowdPooling,
_baseToken,
baseInAmount,
false
);
(bool success, ) = newUpCrowdPooling.call{value: msg.value}("");
require(success, "DODOCpProxy: Transfer failed");
IDODOV2(_UPCP_FACTORY_).initCrowdPooling(
newUpCrowdPooling,
msg.sender,
_baseToken,
_quoteToken,
timeLine,
valueList,
isOpenTWAP
);
}
//============ CrowdPooling Functions (create) ============
function createCrowdPooling(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP,
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) returns (address payable newCrowdPooling) {
address _baseToken = baseToken;
address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
newCrowdPooling = IDODOV2(_CP_FACTORY_).createCrowdPooling();
_deposit(
msg.sender,
newCrowdPooling,
_baseToken,
baseInAmount,
false
);
(bool success, ) = newCrowdPooling.call{value: msg.value}("");
require(success, "DODOCpProxy: Transfer failed");
IDODOV2(_CP_FACTORY_).initCrowdPooling(
newCrowdPooling,
msg.sender,
_baseToken,
_quoteToken,
timeLine,
valueList,
isOpenTWAP
);
}
//====================== internal =======================
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {IDODOV2} from "./../intf/IDODOV2.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {IWETH} from "../../intf/IWETH.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
// interface IDPPOracle {
// function reset(
// address assetTo,
// uint256 newLpFeeRate,
// uint256 newK,
// uint256 baseOutAmount,
// uint256 quoteOutAmount,
// uint256 minBaseReserve,
// uint256 minQuoteReserve
// ) external returns (bool);
// }
/**
* @title DODODppProxy
* @author DODO Breeder
*
* @notice DODO Private Pool Proxy
*/
contract DODODppProxy is ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _DPP_FACTORY_;
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DPPProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address payable weth,
address dodoApproveProxy,
address dppFactory
) public {
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DPP_FACTORY_ = dppFactory;
}
function createDODOPrivatePool(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTwap,
uint256 deadLine
)
external
payable
preventReentrant
judgeExpired(deadLine)
returns (address newPrivatePool)
{
newPrivatePool = IDODOV2(_DPP_FACTORY_).createDODOPrivatePool();
address _baseToken = baseToken;
address _quoteToken = quoteToken;
_deposit(msg.sender, newPrivatePool, _baseToken, baseInAmount, _baseToken == _ETH_ADDRESS_);
_deposit(
msg.sender,
newPrivatePool,
_quoteToken,
quoteInAmount,
_quoteToken == _ETH_ADDRESS_
);
if (_baseToken == _ETH_ADDRESS_) _baseToken = _WETH_;
if (_quoteToken == _ETH_ADDRESS_) _quoteToken = _WETH_;
IDODOV2(_DPP_FACTORY_).initDODOPrivatePool(
newPrivatePool,
msg.sender,
_baseToken,
_quoteToken,
lpFeeRate,
k,
i,
isOpenTwap
);
}
function resetDODOPrivatePool(
address dppAddress,
uint256[] memory paramList, //0 - newLpFeeRate, 1 - newI, 2 - newK
uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3- quoteOutAmount
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
uint256 minBaseReserve,
uint256 minQuoteReserve,
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) {
_deposit(
msg.sender,
dppAddress,
IDODOV2(dppAddress)._BASE_TOKEN_(),
amountList[0],
flag == 1
);
_deposit(
msg.sender,
dppAddress,
IDODOV2(dppAddress)._QUOTE_TOKEN_(),
amountList[1],
flag == 2
);
require(IDODOV2(IDODOV2(dppAddress)._OWNER_()).reset(
msg.sender,
paramList[0],
paramList[1],
paramList[2],
amountList[2],
amountList[3],
minBaseReserve,
minQuoteReserve
), "Reset Failed");
_withdraw(msg.sender, IDODOV2(dppAddress)._BASE_TOKEN_(), amountList[2], flag == 3);
_withdraw(msg.sender, IDODOV2(dppAddress)._QUOTE_TOKEN_(), amountList[3], flag == 4);
}
// DPPOracle
// function resetDODOPrivatePool(
// address dppAddress,
// uint256[] memory paramList, //0 - newLpFeeRate, 1 - newK
// uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3- quoteOutAmount
// uint8 flag, //0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
// uint256 minBaseReserve,
// uint256 minQuoteReserve,
// uint256 deadLine
// ) external payable preventReentrant judgeExpired(deadLine) {
// _deposit(
// msg.sender,
// dppAddress,
// IDODOV2(dppAddress)._BASE_TOKEN_(),
// amountList[0],
// flag == 1
// );
// _deposit(
// msg.sender,
// dppAddress,
// IDODOV2(dppAddress)._QUOTE_TOKEN_(),
// amountList[1],
// flag == 2
// );
// require(IDPPOracle(IDODOV2(dppAddress)._OWNER_()).reset(
// msg.sender,
// paramList[0],
// paramList[1],
// amountList[2],
// amountList[3],
// minBaseReserve,
// minQuoteReserve
// ), "Reset Failed");
// _withdraw(msg.sender, IDODOV2(dppAddress)._BASE_TOKEN_(), amountList[2], flag == 3);
// _withdraw(msg.sender, IDODOV2(dppAddress)._QUOTE_TOKEN_(), amountList[3], flag == 4);
// }
//====================== internal =======================
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
function _withdraw(
address payable to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).withdraw(amount);
to.transfer(amount);
}
} else {
if (amount > 0) {
SafeERC20.safeTransfer(IERC20(token), to, amount);
}
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
interface IDODODrops {
function _BUY_TOKEN_() external view returns (address);
function _FEE_MODEL_() external view returns (address);
function getSellingInfo() external view returns (uint256, uint256, uint256);
function buyTickets(address assetTo, uint256 ticketAmount) external;
}
interface IDropsFeeModel {
function getPayAmount(address mysteryBox, address user, uint256 originalPrice, uint256 ticketAmount) external view returns (uint256, uint256);
}
/**
* @title DODO DropsProxy
* @author DODO Breeder
*
* @notice Entrance of Drops in DODO platform
*/
contract DODODropsProxy is ReentrancyGuard {
using SafeMath for uint256;
// ============ Storage ============
address constant _BASE_COIN_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _DODO_APPROVE_PROXY_;
// ============ Events ============
event BuyTicket(address indexed account, address indexed mysteryBox, uint256 ticketAmount);
fallback() external payable {}
receive() external payable {}
constructor(address dodoApproveProxy) public {
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
function buyTickets(address payable dodoDrops, uint256 ticketAmount) external payable preventReentrant {
(uint256 curPrice, uint256 sellAmount,) = IDODODrops(dodoDrops).getSellingInfo();
require(curPrice > 0 && sellAmount > 0, "CAN_NOT_BUY");
require(ticketAmount <= sellAmount, "TICKETS_NOT_ENOUGH");
address feeModel = IDODODrops(dodoDrops)._FEE_MODEL_();
(uint256 payAmount,) = IDropsFeeModel(feeModel).getPayAmount(dodoDrops, msg.sender, curPrice, ticketAmount);
require(payAmount > 0, "UnQualified");
address buyToken = IDODODrops(dodoDrops)._BUY_TOKEN_();
if(buyToken == _BASE_COIN_) {
require(msg.value == payAmount, "PAYAMOUNT_NOT_ENOUGH");
dodoDrops.transfer(payAmount);
}else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(buyToken, msg.sender, dodoDrops, payAmount);
}
IDODODrops(dodoDrops).buyTickets(msg.sender, ticketAmount);
emit BuyTicket(msg.sender, dodoDrops, ticketAmount);
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {IWETH} from "../../intf/IWETH.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
import {IDSP} from "../../DODOStablePool/intf/IDSP.sol";
import {IDSPFactory} from "../../Factory/DSPFactory.sol";
/**
* @title DODODspProxy
* @author DODO Breeder
*
* @notice Entrance of DODO Stable Pair in DODO platform
*/
contract DODODspProxy is ReentrancyGuard {
using SafeMath for uint256;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _DSP_FACTORY_;
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODODspProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address dspFactory,
address payable weth,
address dodoApproveProxy
) public {
_DSP_FACTORY_ = dspFactory;
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
// ============ DSP Functions (create & add liquidity) ============
function createDODOStablePair(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP,
uint256 deadLine
)
external
payable
preventReentrant
judgeExpired(deadLine)
returns (address newDODOStablePair, uint256 shares)
{
{
address _baseToken = baseToken == _ETH_ADDRESS_ ? _WETH_ : baseToken;
address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
newDODOStablePair = IDSPFactory(_DSP_FACTORY_).createDODOStablePool(
_baseToken,
_quoteToken,
lpFeeRate,
i,
k,
isOpenTWAP
);
}
{
address _baseToken = baseToken;
address _quoteToken = quoteToken;
_deposit(
msg.sender,
newDODOStablePair,
_baseToken,
baseInAmount,
_baseToken == _ETH_ADDRESS_
);
_deposit(
msg.sender,
newDODOStablePair,
_quoteToken,
quoteInAmount,
_quoteToken == _ETH_ADDRESS_
);
}
(shares, , ) = IDSP(newDODOStablePair).buyShares(msg.sender);
}
function addDSPLiquidity(
address dspAddress,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 baseMinAmount,
uint256 quoteMinAmount,
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH
uint256 deadLine
)
external
payable
preventReentrant
judgeExpired(deadLine)
returns (
uint256 shares,
uint256 baseAdjustedInAmount,
uint256 quoteAdjustedInAmount
)
{
address _dsp = dspAddress;
(baseAdjustedInAmount, quoteAdjustedInAmount) = _addDSPLiquidity(
_dsp,
baseInAmount,
quoteInAmount
);
require(
baseAdjustedInAmount >= baseMinAmount && quoteAdjustedInAmount >= quoteMinAmount,
"DODODspProxy: deposit amount is not enough"
);
_deposit(msg.sender, _dsp, IDSP(_dsp)._BASE_TOKEN_(), baseAdjustedInAmount, flag == 1);
_deposit(msg.sender, _dsp, IDSP(_dsp)._QUOTE_TOKEN_(), quoteAdjustedInAmount, flag == 2);
(shares, , ) = IDSP(_dsp).buyShares(msg.sender);
// refund dust eth
if (flag == 1 && msg.value > baseAdjustedInAmount) msg.sender.transfer(msg.value - baseAdjustedInAmount);
if (flag == 2 && msg.value > quoteAdjustedInAmount) msg.sender.transfer(msg.value - quoteAdjustedInAmount);
}
// =================== internal functions =====================
function _addDSPLiquidity(
address dspAddress,
uint256 baseInAmount,
uint256 quoteInAmount
) internal view returns (uint256 baseAdjustedInAmount, uint256 quoteAdjustedInAmount) {
(uint256 baseReserve, uint256 quoteReserve) = IDSP(dspAddress).getVaultReserve();
if (quoteReserve == 0 && baseReserve == 0) {
uint256 i = IDSP(dspAddress)._I_();
uint256 shares = quoteInAmount < DecimalMath.mulFloor(baseInAmount, i)
? DecimalMath.divFloor(quoteInAmount, i)
: baseInAmount;
baseAdjustedInAmount = shares;
quoteAdjustedInAmount = DecimalMath.mulFloor(shares, i);
}
if (quoteReserve > 0 && baseReserve > 0) {
uint256 baseIncreaseRatio = DecimalMath.divFloor(baseInAmount, baseReserve);
uint256 quoteIncreaseRatio = DecimalMath.divFloor(quoteInAmount, quoteReserve);
if (baseIncreaseRatio <= quoteIncreaseRatio) {
baseAdjustedInAmount = baseInAmount;
quoteAdjustedInAmount = DecimalMath.mulFloor(quoteReserve, baseIncreaseRatio);
} else {
quoteAdjustedInAmount = quoteInAmount;
baseAdjustedInAmount = DecimalMath.mulFloor(baseReserve, quoteIncreaseRatio);
}
}
}
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {IRewardVault} from "../../DODOToken/DODOMineV3/RewardVault.sol";
import {IDODOMineV3Registry} from "../../Factory/Registries/DODOMineV3Registry.sol";
import {ICloneFactory} from "../../lib/CloneFactory.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
interface IMineV3 {
function init(address owner, address token) external;
function addRewardToken(
address rewardToken,
uint256 rewardPerBlock,
uint256 startBlock,
uint256 endBlock
) external;
function directTransferOwnership(address newOwner) external;
function getVaultByRewardToken(address rewardToken) external view returns(address);
}
/**
* @title DODOMineV3 Proxy
* @author DODO Breeder
*
* @notice Create And Register DODOMineV3 Contracts
*/
contract DODOMineV3Proxy is InitializableOwnable {
using SafeMath for uint256;
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _DODO_MINEV3_REGISTRY_;
address public _MINEV3_TEMPLATE_;
// ============ Events ============
event DepositRewardToVault(address mine, address rewardToken, uint256 amount);
event DepositRewardToMine(address mine, address rewardToken, uint256 amount);
event CreateMineV3(address account, address mineV3);
event ChangeMineV3Template(address mineV3);
constructor(
address cloneFactory,
address mineTemplate,
address dodoApproveProxy,
address dodoMineV3Registry
) public {
_CLONE_FACTORY_ = cloneFactory;
_MINEV3_TEMPLATE_ = mineTemplate;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DODO_MINEV3_REGISTRY_ = dodoMineV3Registry;
}
// ============ Functions ============
function createDODOMineV3(
address stakeToken,
bool isLpToken,
address[] memory rewardTokens,
uint256[] memory rewardPerBlock,
uint256[] memory startBlock,
uint256[] memory endBlock
) external returns (address newMineV3) {
require(rewardTokens.length > 0, "REWARD_EMPTY");
require(rewardTokens.length == rewardPerBlock.length, "REWARD_PARAM_NOT_MATCH");
require(startBlock.length == rewardPerBlock.length, "REWARD_PARAM_NOT_MATCH");
require(endBlock.length == rewardPerBlock.length, "REWARD_PARAM_NOT_MATCH");
newMineV3 = ICloneFactory(_CLONE_FACTORY_).clone(_MINEV3_TEMPLATE_);
IMineV3(newMineV3).init(address(this), stakeToken);
for(uint i = 0; i<rewardTokens.length; i++) {
uint256 rewardAmount = rewardPerBlock[i].mul(endBlock[i].sub(startBlock[i]));
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(rewardTokens[i], msg.sender, newMineV3, rewardAmount);
IMineV3(newMineV3).addRewardToken(
rewardTokens[i],
rewardPerBlock[i],
startBlock[i],
endBlock[i]
);
}
IMineV3(newMineV3).directTransferOwnership(msg.sender);
IDODOMineV3Registry(_DODO_MINEV3_REGISTRY_).addMineV3(newMineV3, isLpToken, stakeToken);
emit CreateMineV3(msg.sender, newMineV3);
}
function depositRewardToVault(
address mineV3,
address rewardToken,
uint256 amount
) external {
address rewardVault = IMineV3(mineV3).getVaultByRewardToken(rewardToken);
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(rewardToken, msg.sender, rewardVault, amount);
IRewardVault(rewardVault).syncValue();
emit DepositRewardToVault(mineV3,rewardToken,amount);
}
function depositRewardToMine(
address mineV3,
address rewardToken,
uint256 amount
) external {
require(mineV3 != address(0), "MINE_EMPTY");
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(rewardToken, msg.sender, mineV3, amount);
emit DepositRewardToMine(mineV3,rewardToken,amount);
}
// ============ Admin Operation Functions ============
function updateMineV3Template(address _newMineV3Template) external onlyOwner {
_MINEV3_TEMPLATE_ = _newMineV3Template;
emit ChangeMineV3Template(_newMineV3Template);
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {SafeMath} from "../../lib/SafeMath.sol";
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../../lib/CloneFactory.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
import {IFilter} from "../../NFTPool/intf/IFilter.sol";
import {IFilterAdmin} from "../../NFTPool/intf/IFilterAdmin.sol";
import {IDODONFTApprove} from "../../intf/IDODONFTApprove.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
mapping(uint256 => address) public _FILTER_TEMPLATES_;
address public _FILTER_ADMIN_TEMPLATE_;
address public _MAINTAINER_;
address public _CONTROLLER_;
address public immutable _CLONE_FACTORY_;
address public immutable _DODO_NFT_APPROVE_;
address public immutable _DODO_APPROVE_;
mapping (address => bool) public isWhiteListed;
// ============ Event ==============
event SetFilterTemplate(uint256 idx, address filterTemplate);
event Erc721In(address filter, address to, uint256 received);
event Erc1155In(address filter, address to, uint256 received);
event CreateLiteNFTPool(address newFilterAdmin, address filterAdminOwner);
event CreateNFTPool(address newFilterAdmin, address filterAdminOwner, address filter);
event CreateFilterV1(address newFilterAdmin, address newFilterV1, address nftCollection, uint256 filterTemplateKey);
event Erc721toErc20(address nftContract, uint256 tokenId, address toToken, uint256 returnAmount);
event ChangeMaintainer(address newMaintainer);
event ChangeContoller(address newController);
event ChangeFilterAdminTemplate(address newFilterAdminTemplate);
event ChangeWhiteList(address contractAddr, bool isAllowed);
constructor(
address cloneFactory,
address filterAdminTemplate,
address controllerModel,
address defaultMaintainer,
address dodoNftApprove,
address dodoApprove
) public {
_CLONE_FACTORY_ = cloneFactory;
_FILTER_ADMIN_TEMPLATE_ = filterAdminTemplate;
_CONTROLLER_ = controllerModel;
_MAINTAINER_ = defaultMaintainer;
_DODO_NFT_APPROVE_ = dodoNftApprove;
_DODO_APPROVE_ = dodoApprove;
}
// ================ ERC721 In and Out ===================
function erc721In(
address filter,
address nftCollection,
uint256[] memory tokenIds,
address to,
uint256 minMintAmount
) external {
for(uint256 i = 0; i < tokenIds.length; i++) {
require(IFilter(filter).isNFTValid(nftCollection,tokenIds[i]), "NOT_REGISTRIED");
IDODONFTApprove(_DODO_NFT_APPROVE_).claimERC721(nftCollection, msg.sender, filter, tokenIds[i]);
}
uint256 received = IFilter(filter).ERC721In(tokenIds, to);
require(received >= minMintAmount, "MINT_AMOUNT_NOT_ENOUGH");
emit Erc721In(filter, to, received);
}
// ================== ERC1155 In and Out ===================
function erc1155In(
address filter,
address nftCollection,
uint256[] memory tokenIds,
uint256[] memory amounts,
address to,
uint256 minMintAmount
) external {
for(uint256 i = 0; i < tokenIds.length; i++) {
require(IFilter(filter).isNFTValid(nftCollection,tokenIds[i]), "NOT_REGISTRIED");
}
IDODONFTApprove(_DODO_NFT_APPROVE_).claimERC1155Batch(nftCollection, msg.sender, filter, tokenIds, amounts);
uint256 received = IFilter(filter).ERC1155In(tokenIds, to);
require(received >= minMintAmount, "MINT_AMOUNT_NOT_ENOUGH");
emit Erc1155In(filter, to, received);
}
// ================== Create NFTPool ===================
function createLiteNFTPool(
address filterAdminOwner,
string[] memory infos, // 0 => fragName, 1 => fragSymbol
uint256[] memory numParams //0 - initSupply, 1 - fee
) external returns(address newFilterAdmin) {
newFilterAdmin = ICloneFactory(_CLONE_FACTORY_).clone(_FILTER_ADMIN_TEMPLATE_);
address[] memory filters = new address[](0);
IFilterAdmin(newFilterAdmin).init(
filterAdminOwner,
numParams[0],
infos[0],
infos[1],
numParams[1],
_CONTROLLER_,
_MAINTAINER_,
filters
);
emit CreateLiteNFTPool(newFilterAdmin, filterAdminOwner);
}
function createNewNFTPoolV1(
address filterAdminOwner,
address nftCollection,
uint256 filterKey, //1 => FilterERC721V1, 2 => FilterERC1155V1
string[] memory infos, // 0 => filterName, 1 => fragName, 2 => fragSymbol
uint256[] memory numParams,//0 - initSupply, 1 - fee
bool[] memory toggles,
uint256[] memory filterNumParams, //0 - startId, 1 - endId, 2 - maxAmount, 3 - minAmount
uint256[] memory priceRules,
uint256[] memory spreadIds
) external returns(address newFilterAdmin) {
newFilterAdmin = ICloneFactory(_CLONE_FACTORY_).clone(_FILTER_ADMIN_TEMPLATE_);
address filterV1 = createFilterV1(
filterKey,
newFilterAdmin,
nftCollection,
toggles,
infos[0],
filterNumParams,
priceRules,
spreadIds
);
address[] memory filters = new address[](1);
filters[0] = filterV1;
IFilterAdmin(newFilterAdmin).init(
filterAdminOwner,
numParams[0],
infos[1],
infos[2],
numParams[1],
_CONTROLLER_,
_MAINTAINER_,
filters
);
emit CreateNFTPool(newFilterAdmin, filterAdminOwner, filterV1);
}
// ================== Create Filter ===================
function createFilterV1(
uint256 key,
address filterAdmin,
address nftCollection,
bool[] memory toggles,
string memory filterName,
uint256[] memory numParams, //0 - startId, 1 - endId, 2 - maxAmount, 3 - minAmount
uint256[] memory priceRules,
uint256[] memory spreadIds
) public returns(address newFilterV1) {
newFilterV1 = ICloneFactory(_CLONE_FACTORY_).clone(_FILTER_TEMPLATES_[key]);
emit CreateFilterV1(filterAdmin, newFilterV1, nftCollection, key);
IFilter(newFilterV1).init(
filterAdmin,
nftCollection,
toggles,
filterName,
numParams,
priceRules,
spreadIds
);
}
// ================== NFT ERC20 Swap ======================
function erc721ToErc20(
address filterAdmin,
address filter,
address nftContract,
uint256 tokenId,
address toToken,
address dodoProxy,
bytes memory dodoSwapData
)
external
preventReentrant
{
IDODONFTApprove(_DODO_NFT_APPROVE_).claimERC721(nftContract, msg.sender, filter, tokenId);
uint256[] memory tokenIds = new uint256[](1);
tokenIds[0] = tokenId;
uint256 receivedFragAmount = IFilter(filter).ERC721In(tokenIds, address(this));
_generalApproveMax(filterAdmin, _DODO_APPROVE_, receivedFragAmount);
require(isWhiteListed[dodoProxy], "Not Whitelist Proxy Contract");
(bool success, ) = dodoProxy.call(dodoSwapData);
require(success, "API_SWAP_FAILED");
uint256 returnAmount = _generalBalanceOf(toToken, address(this));
_generalTransfer(toToken, msg.sender, returnAmount);
emit Erc721toErc20(nftContract, tokenId, toToken, returnAmount);
}
//====================== Ownable ========================
function changeMaintainer(address newMaintainer) external onlyOwner {
_MAINTAINER_ = newMaintainer;
emit ChangeMaintainer(newMaintainer);
}
function changeFilterAdminTemplate(address newFilterAdminTemplate) external onlyOwner {
_FILTER_ADMIN_TEMPLATE_ = newFilterAdminTemplate;
emit ChangeFilterAdminTemplate(newFilterAdminTemplate);
}
function changeController(address newController) external onlyOwner {
_CONTROLLER_ = newController;
emit ChangeContoller(newController);
}
function setFilterTemplate(uint256 idx, address newFilterTemplate) external onlyOwner {
_FILTER_TEMPLATES_[idx] = newFilterTemplate;
emit SetFilterTemplate(idx, newFilterTemplate);
}
function changeWhiteList(address contractAddr, bool isAllowed) external onlyOwner {
isWhiteListed[contractAddr] = isAllowed;
emit ChangeWhiteList(contractAddr, isAllowed);
}
//======================= Internal =====================
function _generalApproveMax(
address token,
address to,
uint256 amount
) internal {
uint256 allowance = IERC20(token).allowance(address(this), to);
if (allowance < amount) {
if (allowance > 0) {
IERC20(token).safeApprove(to, 0);
}
IERC20(token).safeApprove(to, uint256(-1));
}
}
function _generalBalanceOf(
address token,
address who
) internal view returns (uint256) {
if (token == _ETH_ADDRESS_) {
return who.balance;
} else {
return IERC20(token).balanceOf(who);
}
}
function _generalTransfer(
address token,
address payable to,
uint256 amount
) internal {
if (amount > 0) {
if (token == _ETH_ADDRESS_) {
to.transfer(amount);
} else {
IERC20(token).safeTransfer(to, amount);
}
}
}
}
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {ICloneFactory} from "../../lib/CloneFactory.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {IWETH} from "../../intf/IWETH.sol";
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {ICollateralVault} from "../../CollateralVault/intf/ICollateralVault.sol";
import {IDVM} from "../../DODOVendingMachine/intf/IDVM.sol";
import {IFragment} from "../../GeneralizedFragment/intf/IFragment.sol";
import {IDODONFTRegistry} from "../../Factory/Registries/DODONFTRegistry.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
/**
* @title DODONFTProxy
* @author DODO Breeder
*
* @notice Entrance of NFT in DODO platform
*/
contract DODONFTProxy is ReentrancyGuard, InitializableOwnable {
using SafeMath for uint256;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _CLONE_FACTORY_;
address public immutable _NFT_REGISTY_;
address public _DEFAULT_MAINTAINER_;
address public _MT_FEE_RATE_MODEL_;
address public _VAULT_TEMPLATE_;
address public _FRAG_TEMPLATE_;
address public _DVM_TEMPLATE_;
address public _BUYOUT_MODEL_;
// ============ Events ============
event ChangeVaultTemplate(address newVaultTemplate);
event ChangeFragTemplate(address newFragTemplate);
event ChangeDvmTemplate(address newDvmTemplate);
event ChangeMtFeeRateTemplate(address newMtFeeRateTemplate);
event ChangeBuyoutModel(address newBuyoutModel);
event ChangeMaintainer(address newMaintainer);
event CreateNFTCollateralVault(address creator, address vault, string name, string baseURI);
event CreateFragment(address vault, address fragment, address dvm);
event Buyout(address from, address fragment, uint256 amount);
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODONFTProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address cloneFactory,
address payable weth,
address dodoApproveProxy,
address defaultMaintainer,
address buyoutModel,
address mtFeeRateModel,
address vaultTemplate,
address fragTemplate,
address dvmTemplate,
address nftRegistry
) public {
_CLONE_FACTORY_ = cloneFactory;
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_MT_FEE_RATE_MODEL_ = mtFeeRateModel;
_BUYOUT_MODEL_ = buyoutModel;
_VAULT_TEMPLATE_ = vaultTemplate;
_FRAG_TEMPLATE_ = fragTemplate;
_DVM_TEMPLATE_ = dvmTemplate;
_NFT_REGISTY_ = nftRegistry;
}
function createNFTCollateralVault(string memory name, string memory baseURI) external returns (address newVault) {
newVault = ICloneFactory(_CLONE_FACTORY_).clone(_VAULT_TEMPLATE_);
ICollateralVault(newVault).init(msg.sender, name, baseURI);
emit CreateNFTCollateralVault(msg.sender, newVault, name, baseURI);
}
function createFragment(
address[] calldata addrList, //0 - quoteToken, 1 - vaultPreOwner
uint256[] calldata params, //(DVM: 0 - lpFeeRate 1 - I, 2 - K) , (FRAG: 3 - totalSupply, 4 - ownerRatio, 5 - buyoutTimestamp, 6 - distributionRatio)
bool isOpenTwap,
string memory fragSymbol
) external returns (address newFragment, address newDvm) {
newFragment = ICloneFactory(_CLONE_FACTORY_).clone(_FRAG_TEMPLATE_);
address _quoteToken = addrList[0] == _ETH_ADDRESS_ ? _WETH_ : addrList[0];
{
uint256[] memory _params = params;
newDvm = ICloneFactory(_CLONE_FACTORY_).clone(_DVM_TEMPLATE_);
IDVM(newDvm).init(
_DEFAULT_MAINTAINER_,
newFragment,
_quoteToken,
_params[0],
_MT_FEE_RATE_MODEL_,
_params[1],
_params[2],
isOpenTwap
);
IFragment(newFragment).init(
newDvm,
addrList[1],
msg.sender,
_params[3],
_params[4],
_params[5],
_DEFAULT_MAINTAINER_,
_BUYOUT_MODEL_,
_params[6],
fragSymbol
);
}
ICollateralVault(msg.sender).directTransferOwnership(newFragment);
IDODONFTRegistry(_NFT_REGISTY_).addRegistry(msg.sender, newFragment, _quoteToken, newDvm);
emit CreateFragment(msg.sender, newFragment, newDvm);
}
function buyout(
address fragment,
uint256 quoteMaxAmount,
uint8 flag, // 0 - ERC20, 1 - quoteInETH
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) {
if(flag == 0)
require(msg.value == 0, "DODONFTProxy: WE_SAVED_YOUR_MONEY");
address dvm = IFragment(fragment)._DVM_();
uint256 fragTotalSupply = IFragment(fragment).totalSupply();
uint256 buyPrice = IDVM(dvm).getMidPrice();
uint256 curRequireQuote = DecimalMath.mulCeil(buyPrice, fragTotalSupply);
require(curRequireQuote <= quoteMaxAmount, "DODONFTProxy: CURRENT_TOTAL_VAULE_MORE_THAN_QUOTEMAX");
_deposit(msg.sender, fragment, IFragment(fragment)._QUOTE_(), curRequireQuote, flag == 1);
IFragment(fragment).buyout(msg.sender);
// IDODONFTRegistry(_NFT_REGISTY_).removeRegistry(fragment);
// refund dust eth
if (flag == 1 && msg.value > curRequireQuote) msg.sender.transfer(msg.value - curRequireQuote);
emit Buyout(msg.sender, fragment, curRequireQuote);
}
//============= Owner ===================
function updateVaultTemplate(address newVaultTemplate) external onlyOwner {
_VAULT_TEMPLATE_ = newVaultTemplate;
emit ChangeVaultTemplate(newVaultTemplate);
}
function updateFragTemplate(address newFragTemplate) external onlyOwner {
_FRAG_TEMPLATE_ = newFragTemplate;
emit ChangeFragTemplate(newFragTemplate);
}
function updateMtFeeRateTemplate(address newMtFeeRateTemplate) external onlyOwner {
_MT_FEE_RATE_MODEL_ = newMtFeeRateTemplate;
emit ChangeMtFeeRateTemplate(newMtFeeRateTemplate);
}
function updateDvmTemplate(address newDvmTemplate) external onlyOwner {
_DVM_TEMPLATE_ = newDvmTemplate;
emit ChangeDvmTemplate(newDvmTemplate);
}
function updateBuyoutModel(address newBuyoutModel) external onlyOwner {
_BUYOUT_MODEL_ = newBuyoutModel;
emit ChangeBuyoutModel(newBuyoutModel);
}
function updateMaintainer(address newMaintainer) external onlyOwner {
_DEFAULT_MAINTAINER_ = newMaintainer;
emit ChangeMaintainer(newMaintainer);
}
//============= Internal ================
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {IDODOApproveProxy} from "../DODOApproveProxy.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {IWETH} from "../../intf/IWETH.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {UniversalERC20} from "../lib/UniversalERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
import {IDODOAdapter} from "../intf/IDODOAdapter.sol";
/**
* @title DODORouteProxy
* @author DODO Breeder
*
* @notice Entrance of Split trading in DODO platform
*/
contract DODORouteProxy {
using SafeMath for uint256;
using UniversalERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
struct PoolInfo {
uint256 direction;
uint256 poolEdition;
uint256 weight;
address pool;
address adapter;
bytes moreInfo;
}
// ============ Events ============
event OrderHistory(
address fromToken,
address toToken,
address sender,
uint256 fromAmount,
uint256 returnAmount
);
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODORouteProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor (
address payable weth,
address dodoApproveProxy
) public {
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
function mixSwap(
address fromToken,
address toToken,
uint256 fromTokenAmount,
uint256 minReturnAmount,
address[] memory mixAdapters,
address[] memory mixPairs,
address[] memory assetTo,
uint256 directions,
bytes[] memory moreInfos,
uint256 deadLine
) external payable judgeExpired(deadLine) returns (uint256 returnAmount) {
require(mixPairs.length > 0, "DODORouteProxy: PAIRS_EMPTY");
require(mixPairs.length == mixAdapters.length, "DODORouteProxy: PAIR_ADAPTER_NOT_MATCH");
require(mixPairs.length == assetTo.length - 1, "DODORouteProxy: PAIR_ASSETTO_NOT_MATCH");
require(minReturnAmount > 0, "DODORouteProxy: RETURN_AMOUNT_ZERO");
address _fromToken = fromToken;
address _toToken = toToken;
uint256 _fromTokenAmount = fromTokenAmount;
uint256 toTokenOriginBalance = IERC20(_toToken).universalBalanceOf(msg.sender);
_deposit(msg.sender, assetTo[0], _fromToken, _fromTokenAmount, _fromToken == _ETH_ADDRESS_);
for (uint256 i = 0; i < mixPairs.length; i++) {
if (directions & 1 == 0) {
IDODOAdapter(mixAdapters[i]).sellBase(assetTo[i + 1],mixPairs[i], moreInfos[i]);
} else {
IDODOAdapter(mixAdapters[i]).sellQuote(assetTo[i + 1],mixPairs[i], moreInfos[i]);
}
directions = directions >> 1;
}
if(_toToken == _ETH_ADDRESS_) {
returnAmount = IWETH(_WETH_).balanceOf(address(this));
IWETH(_WETH_).withdraw(returnAmount);
msg.sender.transfer(returnAmount);
}else {
returnAmount = IERC20(_toToken).tokenBalanceOf(msg.sender).sub(toTokenOriginBalance);
}
require(returnAmount >= minReturnAmount, "DODORouteProxy: Return amount is not enough");
emit OrderHistory(
_fromToken,
_toToken,
msg.sender,
_fromTokenAmount,
returnAmount
);
}
function dodoMutliSwap(
uint256 fromTokenAmount,
uint256 minReturnAmount,
uint256[] memory totalWeight,
uint256[] memory splitNumber,
address[] memory midToken,
address[] memory assetFrom,
bytes[] memory sequence,
uint256 deadLine
) external payable judgeExpired(deadLine) returns (uint256 returnAmount) {
require(assetFrom.length == splitNumber.length, 'DODORouteProxy: PAIR_ASSETTO_NOT_MATCH');
require(minReturnAmount > 0, "DODORouteProxy: RETURN_AMOUNT_ZERO");
uint256 _fromTokenAmount = fromTokenAmount;
address fromToken = midToken[0];
address toToken = midToken[midToken.length - 1];
uint256 toTokenOriginBalance = IERC20(toToken).universalBalanceOf(msg.sender);
_deposit(msg.sender, assetFrom[0], fromToken, _fromTokenAmount, fromToken == _ETH_ADDRESS_);
_multiSwap(totalWeight, midToken, splitNumber, sequence, assetFrom);
if(toToken == _ETH_ADDRESS_) {
returnAmount = IWETH(_WETH_).balanceOf(address(this));
IWETH(_WETH_).withdraw(returnAmount);
msg.sender.transfer(returnAmount);
}else {
returnAmount = IERC20(toToken).tokenBalanceOf(msg.sender).sub(toTokenOriginBalance);
}
require(returnAmount >= minReturnAmount, "DODORouteProxy: Return amount is not enough");
emit OrderHistory(
fromToken,
toToken,
msg.sender,
_fromTokenAmount,
returnAmount
);
}
//====================== internal =======================
function _multiSwap(
uint256[] memory totalWeight,
address[] memory midToken,
uint256[] memory splitNumber,
bytes[] memory swapSequence,
address[] memory assetFrom
) internal {
for(uint256 i = 1; i < splitNumber.length; i++) {
// define midtoken address, ETH -> WETH address
uint256 curTotalAmount = IERC20(midToken[i]).tokenBalanceOf(assetFrom[i-1]);
uint256 curTotalWeight = totalWeight[i-1];
for(uint256 j = splitNumber[i-1]; j < splitNumber[i]; j++) {
PoolInfo memory curPoolInfo;
{
(address pool, address adapter, uint256 mixPara, bytes memory moreInfo) = abi.decode(swapSequence[j], (address, address, uint256, bytes));
curPoolInfo.direction = mixPara >> 17;
curPoolInfo.weight = (0xffff & mixPara) >> 9;
curPoolInfo.poolEdition = (0xff & mixPara);
curPoolInfo.pool = pool;
curPoolInfo.adapter = adapter;
curPoolInfo.moreInfo = moreInfo;
}
if(assetFrom[i-1] == address(this)) {
uint256 curAmount = curTotalAmount.mul(curPoolInfo.weight).div(curTotalWeight);
if(curPoolInfo.poolEdition == 1) {
//For using transferFrom pool (like dodoV1, Curve)
IERC20(midToken[i]).transfer(curPoolInfo.adapter, curAmount);
} else {
//For using transfer pool (like dodoV2)
IERC20(midToken[i]).transfer(curPoolInfo.pool, curAmount);
}
}
if(curPoolInfo.direction == 0) {
IDODOAdapter(curPoolInfo.adapter).sellBase(assetFrom[i], curPoolInfo.pool, curPoolInfo.moreInfo);
} else {
IDODOAdapter(curPoolInfo.adapter).sellQuote(assetFrom[i], curPoolInfo.pool, curPoolInfo.moreInfo);
}
}
}
}
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
require(msg.value == amount, "ETH_VALUE_WRONG");
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
}
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import "../intf/ICurve.sol";
contract CurveSampler {
function sampleFromCurve(
address curveAddress,
int128 fromTokenIdx,
int128 toTokenIdx,
uint256[] memory takerTokenAmounts
)
public
view
returns (uint256[] memory makerTokenAmounts)
{
uint256 numSamples = takerTokenAmounts.length;
makerTokenAmounts = new uint256[](numSamples);
for (uint256 i = 0; i < numSamples; i++) {
uint256 buyAmount = ICurve(curveAddress).get_dy_underlying(fromTokenIdx, toTokenIdx, takerTokenAmounts[i]);
makerTokenAmounts[i] = buyAmount;
// Break early if there are 0 amounts
if (makerTokenAmounts[i] == 0) {
break;
}
}
return makerTokenAmounts;
}
}
// Sources flattened with hardhat v2.9.2 https://hardhat.org
// File contracts/intf/IDODOApprove.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOApprove {
function claimTokens(address token,address who,address dest,uint256 amount) external;
function getDODOProxy() external view returns (address);
}
// File contracts/lib/InitializableOwnable.sol
pragma solidity 0.6.9;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File contracts/SmartRoute/DODOApproveProxy.sol
pragma solidity 0.6.9;
interface IDODOApproveProxy {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimTokens(address token,address who,address dest,uint256 amount) external;
}
/**
* @title DODOApproveProxy
* @author DODO Breeder
*
* @notice Allow different version dodoproxy to claim from DODOApprove
*/
contract DODOApproveProxy is InitializableOwnable {
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
mapping (address => bool) public _IS_ALLOWED_PROXY_;
uint256 public _TIMELOCK_;
address public _PENDING_ADD_DODO_PROXY_;
address public immutable _DODO_APPROVE_;
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"SetProxy is timelocked"
);
_;
}
constructor(address dodoApporve) public {
_DODO_APPROVE_ = dodoApporve;
}
function init(address owner, address[] memory proxies) external {
initOwner(owner);
for(uint i = 0; i < proxies.length; i++)
_IS_ALLOWED_PROXY_[proxies[i]] = true;
}
function unlockAddProxy(address newDodoProxy) public onlyOwner {
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_ADD_DODO_PROXY_ = newDodoProxy;
}
function lockAddProxy() public onlyOwner {
_PENDING_ADD_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function addDODOProxy() external onlyOwner notLocked() {
_IS_ALLOWED_PROXY_[_PENDING_ADD_DODO_PROXY_] = true;
lockAddProxy();
}
function removeDODOProxy (address oldDodoProxy) public onlyOwner {
_IS_ALLOWED_PROXY_[oldDodoProxy] = false;
}
function claimTokens(
address token,
address who,
address dest,
uint256 amount
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODOApproveProxy:Access restricted");
IDODOApprove(_DODO_APPROVE_).claimTokens(
token,
who,
dest,
amount
);
}
function isAllowedProxy(address _proxy) external view returns (bool) {
return _IS_ALLOWED_PROXY_[_proxy];
}
}
// File contracts/SmartRoute/intf/IDODOV2.sol
pragma solidity 0.6.9;
interface IDODOV2 {
//========== Common ==================
function sellBase(address to) external returns (uint256 receiveQuoteAmount);
function sellQuote(address to) external returns (uint256 receiveBaseAmount);
function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve);
function _BASE_TOKEN_() external view returns (address);
function _QUOTE_TOKEN_() external view returns (address);
function getPMMStateForCall() external view returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint256 R
);
function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate);
function getDODOPoolBidirection(address token0, address token1) external view returns (address[] memory, address[] memory);
//========== DODOVendingMachine ========
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine);
function buyShares(address to) external returns (uint256,uint256,uint256);
//========== DODOPrivatePool ===========
function createDODOPrivatePool() external returns (address newPrivatePool);
function initDODOPrivatePool(
address dppAddress,
address creator,
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 k,
uint256 i,
bool isOpenTwap
) external;
function reset(
address operator,
uint256 newLpFeeRate,
uint256 newI,
uint256 newK,
uint256 baseOutAmount,
uint256 quoteOutAmount,
uint256 minBaseReserve,
uint256 minQuoteReserve
) external returns (bool);
function _OWNER_() external returns (address);
//========== CrowdPooling ===========
function createCrowdPooling() external returns (address payable newCrowdPooling);
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
}
// File contracts/intf/IERC20.sol
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
pragma solidity 0.6.9;
/**
* @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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @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);
}
// File contracts/lib/SafeMath.sol
pragma solidity >=0.6.6;
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File contracts/lib/SafeERC20.sol
pragma solidity 0.6.9;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File contracts/intf/IWETH.sol
pragma solidity 0.6.9;
interface IWETH {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File contracts/lib/ReentrancyGuard.sol
pragma solidity 0.6.9;
/**
* @title ReentrancyGuard
* @author DODO Breeder
*
* @notice Protect functions from Reentrancy Attack
*/
contract ReentrancyGuard {
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
// zero-state of _ENTERED_ is false
bool private _ENTERED_;
modifier preventReentrant() {
require(!_ENTERED_, "REENTRANT");
_ENTERED_ = true;
_;
_ENTERED_ = false;
}
}
// File contracts/SmartRoute/proxies/DODODppProxy.sol
pragma solidity 0.6.9;
// interface IDPPOracle {
// function reset(
// address assetTo,
// uint256 newLpFeeRate,
// uint256 newK,
// uint256 baseOutAmount,
// uint256 quoteOutAmount,
// uint256 minBaseReserve,
// uint256 minQuoteReserve
// ) external returns (bool);
// }
/**
* @title DODODppProxy
* @author DODO Breeder
*
* @notice DODO Private Pool Proxy
*/
contract DODODppProxy is ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _DPP_FACTORY_;
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DPPProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address payable weth,
address dodoApproveProxy,
address dppFactory
) public {
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DPP_FACTORY_ = dppFactory;
}
function createDODOPrivatePool(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTwap,
uint256 deadLine
)
external
payable
preventReentrant
judgeExpired(deadLine)
returns (address newPrivatePool)
{
newPrivatePool = IDODOV2(_DPP_FACTORY_).createDODOPrivatePool();
address _baseToken = baseToken;
address _quoteToken = quoteToken;
_deposit(msg.sender, newPrivatePool, _baseToken, baseInAmount, _baseToken == _ETH_ADDRESS_);
_deposit(
msg.sender,
newPrivatePool,
_quoteToken,
quoteInAmount,
_quoteToken == _ETH_ADDRESS_
);
if (_baseToken == _ETH_ADDRESS_) _baseToken = _WETH_;
if (_quoteToken == _ETH_ADDRESS_) _quoteToken = _WETH_;
IDODOV2(_DPP_FACTORY_).initDODOPrivatePool(
newPrivatePool,
msg.sender,
_baseToken,
_quoteToken,
lpFeeRate,
k,
i,
isOpenTwap
);
}
function resetDODOPrivatePool(
address dppAddress,
uint256[] memory paramList, //0 - newLpFeeRate, 1 - newI, 2 - newK
uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3- quoteOutAmount
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
uint256 minBaseReserve,
uint256 minQuoteReserve,
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) {
_deposit(
msg.sender,
dppAddress,
IDODOV2(dppAddress)._BASE_TOKEN_(),
amountList[0],
flag == 1
);
_deposit(
msg.sender,
dppAddress,
IDODOV2(dppAddress)._QUOTE_TOKEN_(),
amountList[1],
flag == 2
);
require(IDODOV2(IDODOV2(dppAddress)._OWNER_()).reset(
msg.sender,
paramList[0],
paramList[1],
paramList[2],
amountList[2],
amountList[3],
minBaseReserve,
minQuoteReserve
), "Reset Failed");
_withdraw(msg.sender, IDODOV2(dppAddress)._BASE_TOKEN_(), amountList[2], flag == 3);
_withdraw(msg.sender, IDODOV2(dppAddress)._QUOTE_TOKEN_(), amountList[3], flag == 4);
}
// DPPOracle
// function resetDODOPrivatePool(
// address dppAddress,
// uint256[] memory paramList, //0 - newLpFeeRate, 1 - newK
// uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3- quoteOutAmount
// uint8 flag, //0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
// uint256 minBaseReserve,
// uint256 minQuoteReserve,
// uint256 deadLine
// ) external payable preventReentrant judgeExpired(deadLine) {
// _deposit(
// msg.sender,
// dppAddress,
// IDODOV2(dppAddress)._BASE_TOKEN_(),
// amountList[0],
// flag == 1
// );
// _deposit(
// msg.sender,
// dppAddress,
// IDODOV2(dppAddress)._QUOTE_TOKEN_(),
// amountList[1],
// flag == 2
// );
// require(IDPPOracle(IDODOV2(dppAddress)._OWNER_()).reset(
// msg.sender,
// paramList[0],
// paramList[1],
// amountList[2],
// amountList[3],
// minBaseReserve,
// minQuoteReserve
// ), "Reset Failed");
// _withdraw(msg.sender, IDODOV2(dppAddress)._BASE_TOKEN_(), amountList[2], flag == 3);
// _withdraw(msg.sender, IDODOV2(dppAddress)._QUOTE_TOKEN_(), amountList[3], flag == 4);
// }
//====================== internal =======================
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
function _withdraw(
address payable to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).withdraw(amount);
to.transfer(amount);
}
} else {
if (amount > 0) {
SafeERC20.safeTransfer(IERC20(token), to, amount);
}
}
}
}
This file has been truncated, but you can view the full file.
{
"deploy": {
"VM:-": {
"linkReferences": {},
"autoDeployLib": true
},
"main:1": {
"linkReferences": {},
"autoDeployLib": true
},
"ropsten:3": {
"linkReferences": {},
"autoDeployLib": true
},
"rinkeby:4": {
"linkReferences": {},
"autoDeployLib": true
},
"kovan:42": {
"linkReferences": {},
"autoDeployLib": true
},
"görli:5": {
"linkReferences": {},
"autoDeployLib": true
},
"Custom": {
"linkReferences": {},
"autoDeployLib": true
}
},
"data": {
"bytecode": {
"functionDebugData": {
"@_1271": {
"entryPoint": null,
"id": 1271,
"parameterSlots": 0,
"returnSlots": 0
},
"@_2047": {
"entryPoint": null,
"id": 2047,
"parameterSlots": 11,
"returnSlots": 0
},
"@_2635": {
"entryPoint": null,
"id": 2635,
"parameterSlots": 11,
"returnSlots": 0
},
"@_msgSender_1239": {
"entryPoint": 530,
"id": 1239,
"parameterSlots": 0,
"returnSlots": 1
},
"@_transferOwnership_1351": {
"entryPoint": 538,
"id": 1351,
"parameterSlots": 1,
"returnSlots": 0
},
"abi_decode_available_length_t_string_memory_ptr_fromMemory": {
"entryPoint": 1584,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory": {
"entryPoint": 1156,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_contract$_ERC20_$1936_fromMemory": {
"entryPoint": 1225,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_contract$_IBondStorage_$218_fromMemory": {
"entryPoint": 1087,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_contract$_Staking_$1228_fromMemory": {
"entryPoint": 1294,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_string_memory_ptr_fromMemory": {
"entryPoint": 1659,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint256_fromMemory": {
"entryPoint": 966,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256t_contract$_IBondStorage_$218t_contract$_AggregatorV3Interface_$263t_contract$_AggregatorV3Interface_$263t_contract$_ERC20_$1936t_contract$_ERC20_$1936t_contract$_Staking_$1228t_string_memory_ptr_fromMemory": {
"entryPoint": 1710,
"id": null,
"parameterSlots": 2,
"returnSlots": 11
},
"allocate_memory": {
"entryPoint": 1445,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"allocate_unbounded": {
"entryPoint": 910,
"id": null,
"parameterSlots": 0,
"returnSlots": 1
},
"array_allocation_size_t_string_memory_ptr": {
"entryPoint": 1476,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_address": {
"entryPoint": 1021,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_contract$_AggregatorV3Interface_$263": {
"entryPoint": 1110,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_contract$_ERC20_$1936": {
"entryPoint": 1179,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_contract$_IBondStorage_$218": {
"entryPoint": 1041,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_contract$_Staking_$1228": {
"entryPoint": 1248,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint160": {
"entryPoint": 989,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 930,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"copy_memory_to_memory": {
"entryPoint": 1530,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"extract_byte_array_length": {
"entryPoint": 2057,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"finalize_allocation": {
"entryPoint": 1391,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"panic_error_0x22": {
"entryPoint": 2010,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x41": {
"entryPoint": 1344,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d": {
"entryPoint": 1317,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae": {
"entryPoint": 1322,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": {
"entryPoint": 925,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": {
"entryPoint": 920,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"round_up_to_mul_of_32": {
"entryPoint": 1327,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"validator_revert_t_contract$_AggregatorV3Interface_$263": {
"entryPoint": 1130,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_contract$_ERC20_$1936": {
"entryPoint": 1199,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_contract$_IBondStorage_$218": {
"entryPoint": 1061,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_contract$_Staking_$1228": {
"entryPoint": 1268,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint256": {
"entryPoint": 940,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:8083:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "47:35:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "57:19:1",
"value": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "73:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "67:5:1"
},
"nodeType": "YulFunctionCall",
"src": "67:9:1"
},
"variableNames": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "57:6:1"
}
]
}
]
},
"name": "allocate_unbounded",
"nodeType": "YulFunctionDefinition",
"returnVariables": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "40:6:1",
"type": ""
}
],
"src": "7:75:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "177:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "194:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "197:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "187:6:1"
},
"nodeType": "YulFunctionCall",
"src": "187:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "187:12:1"
}
]
},
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulFunctionDefinition",
"src": "88:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "300:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "317:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "320:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "310:6:1"
},
"nodeType": "YulFunctionCall",
"src": "310:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "310:12:1"
}
]
},
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulFunctionDefinition",
"src": "211:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "379:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "389:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "400:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "389:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "361:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "371:7:1",
"type": ""
}
],
"src": "334:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "460:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "517:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "526:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "529:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "519:6:1"
},
"nodeType": "YulFunctionCall",
"src": "519:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "519:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "483:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "508:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "490:17:1"
},
"nodeType": "YulFunctionCall",
"src": "490:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "480:2:1"
},
"nodeType": "YulFunctionCall",
"src": "480:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "473:6:1"
},
"nodeType": "YulFunctionCall",
"src": "473:43:1"
},
"nodeType": "YulIf",
"src": "470:63:1"
}
]
},
"name": "validator_revert_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "453:5:1",
"type": ""
}
],
"src": "417:122:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "608:80:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "618:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "633:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "627:5:1"
},
"nodeType": "YulFunctionCall",
"src": "627:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "618:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "676:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nodeType": "YulIdentifier",
"src": "649:26:1"
},
"nodeType": "YulFunctionCall",
"src": "649:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "649:33:1"
}
]
},
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "586:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "594:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "602:5:1",
"type": ""
}
],
"src": "545:143:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "739:81:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "749:65:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "764:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "771:42:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "760:3:1"
},
"nodeType": "YulFunctionCall",
"src": "760:54:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "749:7:1"
}
]
}
]
},
"name": "cleanup_t_uint160",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "721:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "731:7:1",
"type": ""
}
],
"src": "694:126:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "871:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "881:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "910:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "892:17:1"
},
"nodeType": "YulFunctionCall",
"src": "892:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "881:7:1"
}
]
}
]
},
"name": "cleanup_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "853:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "863:7:1",
"type": ""
}
],
"src": "826:96:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "993:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1003:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1032:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "1014:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1014:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1003:7:1"
}
]
}
]
},
"name": "cleanup_t_contract$_IBondStorage_$218",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "975:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "985:7:1",
"type": ""
}
],
"src": "928:116:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1113:99:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "1190:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1199:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1202:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1192:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1192:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1192:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1136:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1181:5:1"
}
],
"functionName": {
"name": "cleanup_t_contract$_IBondStorage_$218",
"nodeType": "YulIdentifier",
"src": "1143:37:1"
},
"nodeType": "YulFunctionCall",
"src": "1143:44:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "1133:2:1"
},
"nodeType": "YulFunctionCall",
"src": "1133:55:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "1126:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1126:63:1"
},
"nodeType": "YulIf",
"src": "1123:83:1"
}
]
},
"name": "validator_revert_t_contract$_IBondStorage_$218",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1106:5:1",
"type": ""
}
],
"src": "1050:162:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1301:100:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1311:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "1326:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "1320:5:1"
},
"nodeType": "YulFunctionCall",
"src": "1320:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1311:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1389:5:1"
}
],
"functionName": {
"name": "validator_revert_t_contract$_IBondStorage_$218",
"nodeType": "YulIdentifier",
"src": "1342:46:1"
},
"nodeType": "YulFunctionCall",
"src": "1342:53:1"
},
"nodeType": "YulExpressionStatement",
"src": "1342:53:1"
}
]
},
"name": "abi_decode_t_contract$_IBondStorage_$218_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "1279:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "1287:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1295:5:1",
"type": ""
}
],
"src": "1218:183:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1481:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1491:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1520:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "1502:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1502:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1491:7:1"
}
]
}
]
},
"name": "cleanup_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1463:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1473:7:1",
"type": ""
}
],
"src": "1407:125:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1610:108:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "1696:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1705:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1708:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1698:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1698:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1698:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1633:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1687:5:1"
}
],
"functionName": {
"name": "cleanup_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulIdentifier",
"src": "1640:46:1"
},
"nodeType": "YulFunctionCall",
"src": "1640:53:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "1630:2:1"
},
"nodeType": "YulFunctionCall",
"src": "1630:64:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "1623:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1623:72:1"
},
"nodeType": "YulIf",
"src": "1620:92:1"
}
]
},
"name": "validator_revert_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1603:5:1",
"type": ""
}
],
"src": "1538:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1816:109:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1826:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "1841:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "1835:5:1"
},
"nodeType": "YulFunctionCall",
"src": "1835:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1826:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1913:5:1"
}
],
"functionName": {
"name": "validator_revert_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulIdentifier",
"src": "1857:55:1"
},
"nodeType": "YulFunctionCall",
"src": "1857:62:1"
},
"nodeType": "YulExpressionStatement",
"src": "1857:62:1"
}
]
},
"name": "abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "1794:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "1802:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1810:5:1",
"type": ""
}
],
"src": "1724:201:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1990:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2000:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2029:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "2011:17:1"
},
"nodeType": "YulFunctionCall",
"src": "2011:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "2000:7:1"
}
]
}
]
},
"name": "cleanup_t_contract$_ERC20_$1936",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1972:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1982:7:1",
"type": ""
}
],
"src": "1931:110:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2104:93:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "2175:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2184:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2187:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2177:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2177:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2177:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2127:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2166:5:1"
}
],
"functionName": {
"name": "cleanup_t_contract$_ERC20_$1936",
"nodeType": "YulIdentifier",
"src": "2134:31:1"
},
"nodeType": "YulFunctionCall",
"src": "2134:38:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "2124:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2124:49:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "2117:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2117:57:1"
},
"nodeType": "YulIf",
"src": "2114:77:1"
}
]
},
"name": "validator_revert_t_contract$_ERC20_$1936",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2097:5:1",
"type": ""
}
],
"src": "2047:150:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2280:94:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2290:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "2305:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "2299:5:1"
},
"nodeType": "YulFunctionCall",
"src": "2299:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2290:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2362:5:1"
}
],
"functionName": {
"name": "validator_revert_t_contract$_ERC20_$1936",
"nodeType": "YulIdentifier",
"src": "2321:40:1"
},
"nodeType": "YulFunctionCall",
"src": "2321:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "2321:47:1"
}
]
},
"name": "abi_decode_t_contract$_ERC20_$1936_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "2258:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "2266:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2274:5:1",
"type": ""
}
],
"src": "2203:171:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2441:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2451:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2480:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "2462:17:1"
},
"nodeType": "YulFunctionCall",
"src": "2462:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "2451:7:1"
}
]
}
]
},
"name": "cleanup_t_contract$_Staking_$1228",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2423:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "2433:7:1",
"type": ""
}
],
"src": "2380:112:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2557:95:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "2630:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2639:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2642:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2632:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2632:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2632:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2580:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2621:5:1"
}
],
"functionName": {
"name": "cleanup_t_contract$_Staking_$1228",
"nodeType": "YulIdentifier",
"src": "2587:33:1"
},
"nodeType": "YulFunctionCall",
"src": "2587:40:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "2577:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2577:51:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "2570:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2570:59:1"
},
"nodeType": "YulIf",
"src": "2567:79:1"
}
]
},
"name": "validator_revert_t_contract$_Staking_$1228",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2550:5:1",
"type": ""
}
],
"src": "2498:154:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2737:96:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2747:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "2762:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "2756:5:1"
},
"nodeType": "YulFunctionCall",
"src": "2756:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2747:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "2821:5:1"
}
],
"functionName": {
"name": "validator_revert_t_contract$_Staking_$1228",
"nodeType": "YulIdentifier",
"src": "2778:42:1"
},
"nodeType": "YulFunctionCall",
"src": "2778:49:1"
},
"nodeType": "YulExpressionStatement",
"src": "2778:49:1"
}
]
},
"name": "abi_decode_t_contract$_Staking_$1228_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "2715:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "2723:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "2731:5:1",
"type": ""
}
],
"src": "2658:175:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2928:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2945:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2948:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2938:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2938:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "2938:12:1"
}
]
},
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nodeType": "YulFunctionDefinition",
"src": "2839:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3051:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3068:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3071:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "3061:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3061:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "3061:12:1"
}
]
},
"name": "revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae",
"nodeType": "YulFunctionDefinition",
"src": "2962:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3133:54:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "3143:38:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "3161:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3168:2:1",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "3157:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3157:14:1"
},
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3177:2:1",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nodeType": "YulIdentifier",
"src": "3173:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3173:7:1"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "3153:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3153:28:1"
},
"variableNames": [
{
"name": "result",
"nodeType": "YulIdentifier",
"src": "3143:6:1"
}
]
}
]
},
"name": "round_up_to_mul_of_32",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "3116:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "result",
"nodeType": "YulTypedName",
"src": "3126:6:1",
"type": ""
}
],
"src": "3085:102:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3221:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3238:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3241:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "3231:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3231:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "3231:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3335:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3338:4:1",
"type": "",
"value": "0x41"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "3328:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3328:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "3328:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3359:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3362:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "3352:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3352:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "3352:15:1"
}
]
},
"name": "panic_error_0x41",
"nodeType": "YulFunctionDefinition",
"src": "3193:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3422:238:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "3432:58:1",
"value": {
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "3454:6:1"
},
{
"arguments": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "3484:4:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nodeType": "YulIdentifier",
"src": "3462:21:1"
},
"nodeType": "YulFunctionCall",
"src": "3462:27:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "3450:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3450:40:1"
},
"variables": [
{
"name": "newFreePtr",
"nodeType": "YulTypedName",
"src": "3436:10:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "3601:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nodeType": "YulIdentifier",
"src": "3603:16:1"
},
"nodeType": "YulFunctionCall",
"src": "3603:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "3603:18:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "newFreePtr",
"nodeType": "YulIdentifier",
"src": "3544:10:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3556:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "3541:2:1"
},
"nodeType": "YulFunctionCall",
"src": "3541:34:1"
},
{
"arguments": [
{
"name": "newFreePtr",
"nodeType": "YulIdentifier",
"src": "3580:10:1"
},
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "3592:6:1"
}
],
"functionName": {
"name": "lt",
"nodeType": "YulIdentifier",
"src": "3577:2:1"
},
"nodeType": "YulFunctionCall",
"src": "3577:22:1"
}
],
"functionName": {
"name": "or",
"nodeType": "YulIdentifier",
"src": "3538:2:1"
},
"nodeType": "YulFunctionCall",
"src": "3538:62:1"
},
"nodeType": "YulIf",
"src": "3535:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3639:2:1",
"type": "",
"value": "64"
},
{
"name": "newFreePtr",
"nodeType": "YulIdentifier",
"src": "3643:10:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "3632:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3632:22:1"
},
"nodeType": "YulExpressionStatement",
"src": "3632:22:1"
}
]
},
"name": "finalize_allocation",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "3408:6:1",
"type": ""
},
{
"name": "size",
"nodeType": "YulTypedName",
"src": "3416:4:1",
"type": ""
}
],
"src": "3379:281:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3707:88:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "3717:30:1",
"value": {
"arguments": [],
"functionName": {
"name": "allocate_unbounded",
"nodeType": "YulIdentifier",
"src": "3727:18:1"
},
"nodeType": "YulFunctionCall",
"src": "3727:20:1"
},
"variableNames": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "3717:6:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "3776:6:1"
},
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "3784:4:1"
}
],
"functionName": {
"name": "finalize_allocation",
"nodeType": "YulIdentifier",
"src": "3756:19:1"
},
"nodeType": "YulFunctionCall",
"src": "3756:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "3756:33:1"
}
]
},
"name": "allocate_memory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "size",
"nodeType": "YulTypedName",
"src": "3691:4:1",
"type": ""
}
],
"returnVariables": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "3700:6:1",
"type": ""
}
],
"src": "3666:129:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3868:241:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "3973:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nodeType": "YulIdentifier",
"src": "3975:16:1"
},
"nodeType": "YulFunctionCall",
"src": "3975:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "3975:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "3945:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3953:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "3942:2:1"
},
"nodeType": "YulFunctionCall",
"src": "3942:30:1"
},
"nodeType": "YulIf",
"src": "3939:56:1"
},
{
"nodeType": "YulAssignment",
"src": "4005:37:1",
"value": {
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4035:6:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nodeType": "YulIdentifier",
"src": "4013:21:1"
},
"nodeType": "YulFunctionCall",
"src": "4013:29:1"
},
"variableNames": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "4005:4:1"
}
]
},
{
"nodeType": "YulAssignment",
"src": "4079:23:1",
"value": {
"arguments": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "4091:4:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4097:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4087:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4087:15:1"
},
"variableNames": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "4079:4:1"
}
]
}
]
},
"name": "array_allocation_size_t_string_memory_ptr",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "3852:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "size",
"nodeType": "YulTypedName",
"src": "3863:4:1",
"type": ""
}
],
"src": "3801:308:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "4164:258:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "4174:10:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "4183:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "i",
"nodeType": "YulTypedName",
"src": "4178:1:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "4243:63:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "4268:3:1"
},
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "4273:1:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4264:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4264:11:1"
},
{
"arguments": [
{
"arguments": [
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "4287:3:1"
},
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "4292:1:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4283:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4283:11:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "4277:5:1"
},
"nodeType": "YulFunctionCall",
"src": "4277:18:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "4257:6:1"
},
"nodeType": "YulFunctionCall",
"src": "4257:39:1"
},
"nodeType": "YulExpressionStatement",
"src": "4257:39:1"
}
]
},
"condition": {
"arguments": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "4204:1:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4207:6:1"
}
],
"functionName": {
"name": "lt",
"nodeType": "YulIdentifier",
"src": "4201:2:1"
},
"nodeType": "YulFunctionCall",
"src": "4201:13:1"
},
"nodeType": "YulForLoop",
"post": {
"nodeType": "YulBlock",
"src": "4215:19:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "4217:15:1",
"value": {
"arguments": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "4226:1:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4229:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4222:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4222:10:1"
},
"variableNames": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "4217:1:1"
}
]
}
]
},
"pre": {
"nodeType": "YulBlock",
"src": "4197:3:1",
"statements": []
},
"src": "4193:113:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "4340:76:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "4390:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4395:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4386:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4386:16:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4404:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "4379:6:1"
},
"nodeType": "YulFunctionCall",
"src": "4379:27:1"
},
"nodeType": "YulExpressionStatement",
"src": "4379:27:1"
}
]
},
"condition": {
"arguments": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "4321:1:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4324:6:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "4318:2:1"
},
"nodeType": "YulFunctionCall",
"src": "4318:13:1"
},
"nodeType": "YulIf",
"src": "4315:101:1"
}
]
},
"name": "copy_memory_to_memory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nodeType": "YulTypedName",
"src": "4146:3:1",
"type": ""
},
{
"name": "dst",
"nodeType": "YulTypedName",
"src": "4151:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "4156:6:1",
"type": ""
}
],
"src": "4115:307:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "4523:326:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "4533:75:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4600:6:1"
}
],
"functionName": {
"name": "array_allocation_size_t_string_memory_ptr",
"nodeType": "YulIdentifier",
"src": "4558:41:1"
},
"nodeType": "YulFunctionCall",
"src": "4558:49:1"
}
],
"functionName": {
"name": "allocate_memory",
"nodeType": "YulIdentifier",
"src": "4542:15:1"
},
"nodeType": "YulFunctionCall",
"src": "4542:66:1"
},
"variableNames": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "4533:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "4624:5:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4631:6:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "4617:6:1"
},
"nodeType": "YulFunctionCall",
"src": "4617:21:1"
},
"nodeType": "YulExpressionStatement",
"src": "4617:21:1"
},
{
"nodeType": "YulVariableDeclaration",
"src": "4647:27:1",
"value": {
"arguments": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "4662:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4669:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4658:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4658:16:1"
},
"variables": [
{
"name": "dst",
"nodeType": "YulTypedName",
"src": "4651:3:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "4712:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae",
"nodeType": "YulIdentifier",
"src": "4714:77:1"
},
"nodeType": "YulFunctionCall",
"src": "4714:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "4714:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "4693:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4698:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4689:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4689:16:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "4707:3:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "4686:2:1"
},
"nodeType": "YulFunctionCall",
"src": "4686:25:1"
},
"nodeType": "YulIf",
"src": "4683:112:1"
},
{
"expression": {
"arguments": [
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "4826:3:1"
},
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "4831:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "4836:6:1"
}
],
"functionName": {
"name": "copy_memory_to_memory",
"nodeType": "YulIdentifier",
"src": "4804:21:1"
},
"nodeType": "YulFunctionCall",
"src": "4804:39:1"
},
"nodeType": "YulExpressionStatement",
"src": "4804:39:1"
}
]
},
"name": "abi_decode_available_length_t_string_memory_ptr_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nodeType": "YulTypedName",
"src": "4496:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "4501:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "4509:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nodeType": "YulTypedName",
"src": "4517:5:1",
"type": ""
}
],
"src": "4428:421:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "4942:282:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "4991:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nodeType": "YulIdentifier",
"src": "4993:77:1"
},
"nodeType": "YulFunctionCall",
"src": "4993:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "4993:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "4970:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4978:4:1",
"type": "",
"value": "0x1f"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4966:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4966:17:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "4985:3:1"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "4962:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4962:27:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "4955:6:1"
},
"nodeType": "YulFunctionCall",
"src": "4955:35:1"
},
"nodeType": "YulIf",
"src": "4952:122:1"
},
{
"nodeType": "YulVariableDeclaration",
"src": "5083:27:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "5103:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "5097:5:1"
},
"nodeType": "YulFunctionCall",
"src": "5097:13:1"
},
"variables": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "5087:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "5119:99:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "5191:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5199:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5187:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5187:17:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "5206:6:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "5214:3:1"
}
],
"functionName": {
"name": "abi_decode_available_length_t_string_memory_ptr_fromMemory",
"nodeType": "YulIdentifier",
"src": "5128:58:1"
},
"nodeType": "YulFunctionCall",
"src": "5128:90:1"
},
"variableNames": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "5119:5:1"
}
]
}
]
},
"name": "abi_decode_t_string_memory_ptr_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "4920:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "4928:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nodeType": "YulTypedName",
"src": "4936:5:1",
"type": ""
}
],
"src": "4869:355:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5610:1958:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "5657:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "5659:77:1"
},
"nodeType": "YulFunctionCall",
"src": "5659:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "5659:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "5631:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5640:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "5627:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5627:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5652:3:1",
"type": "",
"value": "352"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "5623:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5623:33:1"
},
"nodeType": "YulIf",
"src": "5620:120:1"
},
{
"nodeType": "YulBlock",
"src": "5750:128:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "5765:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "5779:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "5769:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "5794:74:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5840:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "5851:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5836:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5836:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "5860:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulIdentifier",
"src": "5804:31:1"
},
"nodeType": "YulFunctionCall",
"src": "5804:64:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "5794:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "5888:129:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "5903:16:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "5917:2:1",
"type": "",
"value": "32"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "5907:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "5933:74:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5979:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "5990:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5975:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5975:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "5999:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulIdentifier",
"src": "5943:31:1"
},
"nodeType": "YulFunctionCall",
"src": "5943:64:1"
},
"variableNames": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "5933:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6027:129:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6042:16:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6056:2:1",
"type": "",
"value": "64"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6046:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6072:74:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6118:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6129:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6114:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6114:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6138:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulIdentifier",
"src": "6082:31:1"
},
"nodeType": "YulFunctionCall",
"src": "6082:64:1"
},
"variableNames": [
{
"name": "value2",
"nodeType": "YulIdentifier",
"src": "6072:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6166:129:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6181:16:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6195:2:1",
"type": "",
"value": "96"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6185:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6211:74:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6257:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6268:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6253:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6253:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6277:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256_fromMemory",
"nodeType": "YulIdentifier",
"src": "6221:31:1"
},
"nodeType": "YulFunctionCall",
"src": "6221:64:1"
},
"variableNames": [
{
"name": "value3",
"nodeType": "YulIdentifier",
"src": "6211:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6305:150:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6320:17:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6334:3:1",
"type": "",
"value": "128"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6324:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6351:94:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6417:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6428:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6413:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6413:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6437:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_IBondStorage_$218_fromMemory",
"nodeType": "YulIdentifier",
"src": "6361:51:1"
},
"nodeType": "YulFunctionCall",
"src": "6361:84:1"
},
"variableNames": [
{
"name": "value4",
"nodeType": "YulIdentifier",
"src": "6351:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6465:159:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6480:17:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6494:3:1",
"type": "",
"value": "160"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6484:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6511:103:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6586:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6597:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6582:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6582:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6606:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory",
"nodeType": "YulIdentifier",
"src": "6521:60:1"
},
"nodeType": "YulFunctionCall",
"src": "6521:93:1"
},
"variableNames": [
{
"name": "value5",
"nodeType": "YulIdentifier",
"src": "6511:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6634:159:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6649:17:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6663:3:1",
"type": "",
"value": "192"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6653:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6680:103:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6755:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6766:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6751:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6751:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6775:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory",
"nodeType": "YulIdentifier",
"src": "6690:60:1"
},
"nodeType": "YulFunctionCall",
"src": "6690:93:1"
},
"variableNames": [
{
"name": "value6",
"nodeType": "YulIdentifier",
"src": "6680:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6803:144:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6818:17:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6832:3:1",
"type": "",
"value": "224"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6822:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6849:88:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6909:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6920:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6905:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6905:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6929:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_ERC20_$1936_fromMemory",
"nodeType": "YulIdentifier",
"src": "6859:45:1"
},
"nodeType": "YulFunctionCall",
"src": "6859:78:1"
},
"variableNames": [
{
"name": "value7",
"nodeType": "YulIdentifier",
"src": "6849:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "6957:144:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6972:17:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6986:3:1",
"type": "",
"value": "256"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6976:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "7003:88:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7063:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7074:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "7059:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7059:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "7083:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_ERC20_$1936_fromMemory",
"nodeType": "YulIdentifier",
"src": "7013:45:1"
},
"nodeType": "YulFunctionCall",
"src": "7013:78:1"
},
"variableNames": [
{
"name": "value8",
"nodeType": "YulIdentifier",
"src": "7003:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "7111:146:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "7126:17:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "7140:3:1",
"type": "",
"value": "288"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "7130:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "7157:90:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7219:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7230:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "7215:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7215:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "7239:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_Staking_$1228_fromMemory",
"nodeType": "YulIdentifier",
"src": "7167:47:1"
},
"nodeType": "YulFunctionCall",
"src": "7167:80:1"
},
"variableNames": [
{
"name": "value9",
"nodeType": "YulIdentifier",
"src": "7157:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "7267:294:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "7282:40:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7306:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7317:3:1",
"type": "",
"value": "320"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "7302:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7302:19:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "7296:5:1"
},
"nodeType": "YulFunctionCall",
"src": "7296:26:1"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "7286:6:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "7369:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulIdentifier",
"src": "7371:77:1"
},
"nodeType": "YulFunctionCall",
"src": "7371:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "7371:79:1"
}
]
},
"condition": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7341:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7349:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "7338:2:1"
},
"nodeType": "YulFunctionCall",
"src": "7338:30:1"
},
"nodeType": "YulIf",
"src": "7335:117:1"
},
{
"nodeType": "YulAssignment",
"src": "7466:85:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7523:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7534:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "7519:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7519:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "7543:7:1"
}
],
"functionName": {
"name": "abi_decode_t_string_memory_ptr_fromMemory",
"nodeType": "YulIdentifier",
"src": "7477:41:1"
},
"nodeType": "YulFunctionCall",
"src": "7477:74:1"
},
"variableNames": [
{
"name": "value10",
"nodeType": "YulIdentifier",
"src": "7466:7:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256t_contract$_IBondStorage_$218t_contract$_AggregatorV3Interface_$263t_contract$_AggregatorV3Interface_$263t_contract$_ERC20_$1936t_contract$_ERC20_$1936t_contract$_Staking_$1228t_string_memory_ptr_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "5499:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "5510:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "5522:6:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "5530:6:1",
"type": ""
},
{
"name": "value2",
"nodeType": "YulTypedName",
"src": "5538:6:1",
"type": ""
},
{
"name": "value3",
"nodeType": "YulTypedName",
"src": "5546:6:1",
"type": ""
},
{
"name": "value4",
"nodeType": "YulTypedName",
"src": "5554:6:1",
"type": ""
},
{
"name": "value5",
"nodeType": "YulTypedName",
"src": "5562:6:1",
"type": ""
},
{
"name": "value6",
"nodeType": "YulTypedName",
"src": "5570:6:1",
"type": ""
},
{
"name": "value7",
"nodeType": "YulTypedName",
"src": "5578:6:1",
"type": ""
},
{
"name": "value8",
"nodeType": "YulTypedName",
"src": "5586:6:1",
"type": ""
},
{
"name": "value9",
"nodeType": "YulTypedName",
"src": "5594:6:1",
"type": ""
},
{
"name": "value10",
"nodeType": "YulTypedName",
"src": "5602:7:1",
"type": ""
}
],
"src": "5230:2338:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7602:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7619:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7622:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "7612:6:1"
},
"nodeType": "YulFunctionCall",
"src": "7612:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "7612:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7716:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7719:4:1",
"type": "",
"value": "0x22"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "7709:6:1"
},
"nodeType": "YulFunctionCall",
"src": "7709:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "7709:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7740:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7743:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "7733:6:1"
},
"nodeType": "YulFunctionCall",
"src": "7733:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "7733:15:1"
}
]
},
"name": "panic_error_0x22",
"nodeType": "YulFunctionDefinition",
"src": "7574:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7811:269:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "7821:22:1",
"value": {
"arguments": [
{
"name": "data",
"nodeType": "YulIdentifier",
"src": "7835:4:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7841:1:1",
"type": "",
"value": "2"
}
],
"functionName": {
"name": "div",
"nodeType": "YulIdentifier",
"src": "7831:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7831:12:1"
},
"variableNames": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "7821:6:1"
}
]
},
{
"nodeType": "YulVariableDeclaration",
"src": "7852:38:1",
"value": {
"arguments": [
{
"name": "data",
"nodeType": "YulIdentifier",
"src": "7882:4:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7888:1:1",
"type": "",
"value": "1"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "7878:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7878:12:1"
},
"variables": [
{
"name": "outOfPlaceEncoding",
"nodeType": "YulTypedName",
"src": "7856:18:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "7929:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "7943:27:1",
"value": {
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "7957:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7965:4:1",
"type": "",
"value": "0x7f"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "7953:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7953:17:1"
},
"variableNames": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "7943:6:1"
}
]
}
]
},
"condition": {
"arguments": [
{
"name": "outOfPlaceEncoding",
"nodeType": "YulIdentifier",
"src": "7909:18:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "7902:6:1"
},
"nodeType": "YulFunctionCall",
"src": "7902:26:1"
},
"nodeType": "YulIf",
"src": "7899:81:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "8032:42:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x22",
"nodeType": "YulIdentifier",
"src": "8046:16:1"
},
"nodeType": "YulFunctionCall",
"src": "8046:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "8046:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "outOfPlaceEncoding",
"nodeType": "YulIdentifier",
"src": "7996:18:1"
},
{
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "8019:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "8027:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "lt",
"nodeType": "YulIdentifier",
"src": "8016:2:1"
},
"nodeType": "YulFunctionCall",
"src": "8016:14:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "7993:2:1"
},
"nodeType": "YulFunctionCall",
"src": "7993:38:1"
},
"nodeType": "YulIf",
"src": "7990:84:1"
}
]
},
"name": "extract_byte_array_length",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "data",
"nodeType": "YulTypedName",
"src": "7795:4:1",
"type": ""
}
],
"returnVariables": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "7804:6:1",
"type": ""
}
],
"src": "7760:320:1"
}
]
},
"contents": "{\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_uint256_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_uint256(value)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function cleanup_t_contract$_IBondStorage_$218(value) -> cleaned {\n cleaned := cleanup_t_address(value)\n }\n\n function validator_revert_t_contract$_IBondStorage_$218(value) {\n if iszero(eq(value, cleanup_t_contract$_IBondStorage_$218(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_contract$_IBondStorage_$218_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_contract$_IBondStorage_$218(value)\n }\n\n function cleanup_t_contract$_AggregatorV3Interface_$263(value) -> cleaned {\n cleaned := cleanup_t_address(value)\n }\n\n function validator_revert_t_contract$_AggregatorV3Interface_$263(value) {\n if iszero(eq(value, cleanup_t_contract$_AggregatorV3Interface_$263(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_contract$_AggregatorV3Interface_$263(value)\n }\n\n function cleanup_t_contract$_ERC20_$1936(value) -> cleaned {\n cleaned := cleanup_t_address(value)\n }\n\n function validator_revert_t_contract$_ERC20_$1936(value) {\n if iszero(eq(value, cleanup_t_contract$_ERC20_$1936(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_contract$_ERC20_$1936_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_contract$_ERC20_$1936(value)\n }\n\n function cleanup_t_contract$_Staking_$1228(value) -> cleaned {\n cleaned := cleanup_t_address(value)\n }\n\n function validator_revert_t_contract$_Staking_$1228(value) {\n if iszero(eq(value, cleanup_t_contract$_Staking_$1228(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_contract$_Staking_$1228_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_contract$_Staking_$1228(value)\n }\n\n function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() {\n revert(0, 0)\n }\n\n function revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae() {\n revert(0, 0)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function panic_error_0x41() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n\n function finalize_allocation(memPtr, size) {\n let newFreePtr := add(memPtr, round_up_to_mul_of_32(size))\n // protect against overflow\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n }\n\n function allocate_memory(size) -> memPtr {\n memPtr := allocate_unbounded()\n finalize_allocation(memPtr, size)\n }\n\n function array_allocation_size_t_string_memory_ptr(length) -> size {\n // Make sure we can allocate memory without overflow\n if gt(length, 0xffffffffffffffff) { panic_error_0x41() }\n\n size := round_up_to_mul_of_32(length)\n\n // add length slot\n size := add(size, 0x20)\n\n }\n\n function copy_memory_to_memory(src, dst, length) {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n if gt(i, length)\n {\n // clear end\n mstore(add(dst, length), 0)\n }\n }\n\n function abi_decode_available_length_t_string_memory_ptr_fromMemory(src, length, end) -> array {\n array := allocate_memory(array_allocation_size_t_string_memory_ptr(length))\n mstore(array, length)\n let dst := add(array, 0x20)\n if gt(add(src, length), end) { revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae() }\n copy_memory_to_memory(src, dst, length)\n }\n\n // string\n function abi_decode_t_string_memory_ptr_fromMemory(offset, end) -> array {\n if iszero(slt(add(offset, 0x1f), end)) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }\n let length := mload(offset)\n array := abi_decode_available_length_t_string_memory_ptr_fromMemory(add(offset, 0x20), length, end)\n }\n\n function abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256t_contract$_IBondStorage_$218t_contract$_AggregatorV3Interface_$263t_contract$_AggregatorV3Interface_$263t_contract$_ERC20_$1936t_contract$_ERC20_$1936t_contract$_Staking_$1228t_string_memory_ptr_fromMemory(headStart, dataEnd) -> value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10 {\n if slt(sub(dataEnd, headStart), 352) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 32\n\n value1 := abi_decode_t_uint256_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 64\n\n value2 := abi_decode_t_uint256_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 96\n\n value3 := abi_decode_t_uint256_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 128\n\n value4 := abi_decode_t_contract$_IBondStorage_$218_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 160\n\n value5 := abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 192\n\n value6 := abi_decode_t_contract$_AggregatorV3Interface_$263_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 224\n\n value7 := abi_decode_t_contract$_ERC20_$1936_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 256\n\n value8 := abi_decode_t_contract$_ERC20_$1936_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 288\n\n value9 := abi_decode_t_contract$_Staking_$1228_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := mload(add(headStart, 320))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value10 := abi_decode_t_string_memory_ptr_fromMemory(add(headStart, offset), dataEnd)\n }\n\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n}\n",
"id": 1,
"language": "Yul",
"name": "#utility.yul"
}
],
"linkReferences": {},
"object": "6101006040523480156200001257600080fd5b50604051620038bc380380620038bc8339818101604052810190620000389190620006ae565b8a8a8a8a8a8a8a8a8a8a8a62000063620000576200021260201b60201c565b6200021a60201b60201c565b8a6005819055508960038190555088600481905550876007819055508673ffffffffffffffffffffffffffffffffffffffff1660e08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505085600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508273ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1660601b815250508060019080519060200190620001f5929190620002de565b50505050505050505050505050505050505050505050506200083f565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b828054620002ec9062000809565b90600052602060002090601f0160209004810192826200031057600085556200035c565b82601f106200032b57805160ff19168380011785556200035c565b828001600101855582156200035c579182015b828111156200035b5782518255916020019190600101906200033e565b5b5090506200036b91906200036f565b5090565b5b808211156200038a57600081600090555060010162000370565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b620003b781620003a2565b8114620003c357600080fd5b50565b600081519050620003d781620003ac565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200040a82620003dd565b9050919050565b60006200041e82620003fd565b9050919050565b620004308162000411565b81146200043c57600080fd5b50565b600081519050620004508162000425565b92915050565b60006200046382620003fd565b9050919050565b620004758162000456565b81146200048157600080fd5b50565b60008151905062000495816200046a565b92915050565b6000620004a882620003fd565b9050919050565b620004ba816200049b565b8114620004c657600080fd5b50565b600081519050620004da81620004af565b92915050565b6000620004ed82620003fd565b9050919050565b620004ff81620004e0565b81146200050b57600080fd5b50565b6000815190506200051f81620004f4565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200057a826200052f565b810181811067ffffffffffffffff821117156200059c576200059b62000540565b5b80604052505050565b6000620005b16200038e565b9050620005bf82826200056f565b919050565b600067ffffffffffffffff821115620005e257620005e162000540565b5b620005ed826200052f565b9050602081019050919050565b60005b838110156200061a578082015181840152602081019050620005fd565b838111156200062a576000848401525b50505050565b6000620006476200064184620005c4565b620005a5565b9050828152602081018484840111156200066657620006656200052a565b5b62000673848285620005fa565b509392505050565b600082601f83011262000693576200069262000525565b5b8151620006a584826020860162000630565b91505092915050565b60008060008060008060008060008060006101608c8e031215620006d757620006d662000398565b5b6000620006e78e828f01620003c6565b9b50506020620006fa8e828f01620003c6565b9a505060406200070d8e828f01620003c6565b9950506060620007208e828f01620003c6565b9850506080620007338e828f016200043f565b97505060a0620007468e828f0162000484565b96505060c0620007598e828f0162000484565b95505060e06200076c8e828f01620004c9565b945050610100620007808e828f01620004c9565b935050610120620007948e828f016200050e565b9250506101408c015167ffffffffffffffff811115620007b957620007b86200039d565b5b620007c78e828f016200067b565b9150509295989b509295989b9093969950565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200082257607f821691505b60208210811415620008395762000838620007da565b5b50919050565b60805160601c60a05160601c60c05160601c60e05160601c612ff1620008cb60003960008181610af501528181610fdc0152611c07015260008181610c3b01528181610cd10152818161132d0152818161158601528181611628015281816116ca015261176c015260008181610bff015261191a015260008181611a3c0152611d8c0152612ff16000f3fe60806040526004361061021a5760003560e01c80638da5cb5b11610123578063c4c72337116100ab578063f2d81c331161006f578063f2d81c33146107a7578063f2fde38b146107d2578063fc0c546a146107fb578063fc2d3da914610826578063fd7f6771146108635761021a565b8063c4c72337146106d2578063c74364f4146106fd578063c8932f8114610726578063d3308f5414610751578063d370e0521461077c5761021a565b8063a3820322116100f2578063a3820322146105d9578063a3eb5ffa14610604578063a526c5f01461062f578063a80e4ff014610658578063abfe35ad146106955761021a565b80638da5cb5b1461052857806394c8636f146105535780639e00e6131461057e578063a0712d68146105a95761021a565b8063457fcd0e116101a65780635fa73e33116101755780635fa73e3314610466578063715018a61461047d5780637ec164a014610494578063821de0af146104bd5780638c387b93146104fd5761021a565b8063457fcd0e146103bc57806348ae238f146103e75780635831d885146104105780635a4ef6b91461043b5761021a565b80631e1ebf27116101ed5780631e1ebf27146102db578063263b1491146103185780632f8d16eb14610341578063379607f51461036a5780633d568cdb146103935761021a565b806302d0d8681461021f578063150b7a021461024857806318160ddd146102855780631c0ca1ab146102b0575b600080fd5b34801561022b57600080fd5b5061024660048036038101906102419190611f70565b61088e565b005b34801561025457600080fd5b5061026f600480360381019061026a9190612141565b610914565b60405161027c91906121ff565b60405180910390f35b34801561029157600080fd5b5061029a610928565b6040516102a79190612229565b60405180910390f35b3480156102bc57600080fd5b506102c5610932565b6040516102d29190612229565b60405180910390f35b3480156102e757600080fd5b5061030260048036038101906102fd9190611f70565b610938565b60405161030f919061225f565b60405180910390f35b34801561032457600080fd5b5061033f600480360381019061033a91906122b8565b610965565b005b34801561034d57600080fd5b5061036860048036038101906103639190611f70565b610a25565b005b34801561037657600080fd5b50610391600480360381019061038c9190611f70565b610aab565b005b34801561039f57600080fd5b506103ba60048036038101906103b59190611f70565b610db2565b005b3480156103c857600080fd5b506103d1610e38565b6040516103de9190612229565b60405180910390f35b3480156103f357600080fd5b5061040e60048036038101906104099190612323565b610e3e565b005b34801561041c57600080fd5b50610425610fd4565b6040516104329190612229565b60405180910390f35b34801561044757600080fd5b50610450610fda565b60405161045d91906123c2565b60405180910390f35b34801561047257600080fd5b5061047b610ffe565b005b34801561048957600080fd5b506104926110cb565b005b3480156104a057600080fd5b506104bb60048036038101906104b691906122b8565b611153565b005b3480156104c957600080fd5b506104e460048036038101906104df9190611f70565b611213565b6040516104f494939291906123dd565b60405180910390f35b34801561050957600080fd5b50610512611250565b60405161051f919061225f565b60405180910390f35b34801561053457600080fd5b5061053d611270565b60405161054a9190612431565b60405180910390f35b34801561055f57600080fd5b50610568611299565b60405161057591906124d4565b60405180910390f35b34801561058a57600080fd5b5061059361132b565b6040516105a09190612517565b60405180910390f35b6105c360048036038101906105be9190611f70565b61134f565b6040516105d09190612229565b60405180910390f35b3480156105e557600080fd5b506105ee611400565b6040516105fb9190612229565b60405180910390f35b34801561061057600080fd5b50610619611406565b6040516106269190612229565b60405180910390f35b34801561063b57600080fd5b5061065660048036038101906106519190612570565b61141d565b005b34801561066457600080fd5b5061067f600480360381019061067a9190611f70565b6114e3565b60405161068c9190612229565b60405180910390f35b3480156106a157600080fd5b506106bc60048036038101906106b79190611f70565b611581565b6040516106c99190612229565b60405180910390f35b3480156106de57600080fd5b506106e7611860565b6040516106f491906125be565b60405180910390f35b34801561070957600080fd5b50610724600480360381019061071f9190611f70565b611886565b005b34801561073257600080fd5b5061073b61190c565b6040516107489190612229565b60405180910390f35b34801561075d57600080fd5b50610766611912565b6040516107739190612229565b60405180910390f35b34801561078857600080fd5b50610791611918565b60405161079e91906125fa565b60405180910390f35b3480156107b357600080fd5b506107bc61193c565b6040516107c99190612229565b60405180910390f35b3480156107de57600080fd5b506107f960048036038101906107f49190612615565b611942565b005b34801561080757600080fd5b50610810611a3a565b60405161081d91906125fa565b60405180910390f35b34801561083257600080fd5b5061084d60048036038101906108489190611f70565b611a5e565b60405161085a9190612229565b60405180910390f35b34801561086f57600080fd5b50610878611a94565b60405161088591906125be565b60405180910390f35b610896611aba565b73ffffffffffffffffffffffffffffffffffffffff166108b4611270565b73ffffffffffffffffffffffffffffffffffffffff161461090a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109019061268e565b60405180910390fd5b8060058190555050565b600063150b7a0260e01b9050949350505050565b6000600654905090565b60025481565b60006008600083815260200190815260200160002060000160009054906101000a900460ff169050919050565b61096d611aba565b73ffffffffffffffffffffffffffffffffffffffff1661098b611270565b73ffffffffffffffffffffffffffffffffffffffff16146109e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d89061268e565b60405180910390fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610a2d611aba565b73ffffffffffffffffffffffffffffffffffffffff16610a4b611270565b73ffffffffffffffffffffffffffffffffffffffff1614610aa1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a989061268e565b60405180910390fd5b8060078190555050565b610ab481610938565b610af3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aea90612720565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166342842e0e3330846040518463ffffffff1660e01b8152600401610b5093929190612740565b600060405180830381600087803b158015610b6a57600080fd5b505af1158015610b7e573d6000803e3d6000fd5b5050505060006008600083815260200190815260200160002090504281600201541115610be0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd7906127e9565b60405180910390fd5b60008160000160006101000a81548160ff0219169083151502179055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f000000000000000000000000000000000000000000000000000000000000000083600301546040518363ffffffff1660e01b8152600401610c7c929190612809565b602060405180830381600087803b158015610c9657600080fd5b505af1158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce919061285e565b507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16637acb77578260030154336040518363ffffffff1660e01b8152600401610d2e92919061288b565b600060405180830381600087803b158015610d4857600080fd5b505af1158015610d5c573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d483604051610da69190612229565b60405180910390a25050565b610dba611aba565b73ffffffffffffffffffffffffffffffffffffffff16610dd8611270565b73ffffffffffffffffffffffffffffffffffffffff1614610e2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e259061268e565b60405180910390fd5b8060048190555050565b60055481565b610e46611aba565b73ffffffffffffffffffffffffffffffffffffffff16610e64611270565b73ffffffffffffffffffffffffffffffffffffffff1614610eba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb19061268e565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb828473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f109190612431565b60206040518083038186803b158015610f2857600080fd5b505afa158015610f3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6091906128c9565b6040518363ffffffff1660e01b8152600401610f7d929190612809565b602060405180830381600087803b158015610f9757600080fd5b505af1158015610fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcf919061285e565b505050565b60065481565b7f000000000000000000000000000000000000000000000000000000000000000081565b611006611aba565b73ffffffffffffffffffffffffffffffffffffffff16611024611270565b73ffffffffffffffffffffffffffffffffffffffff161461107a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110719061268e565b60405180910390fd5b611082611250565b156110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b990612968565b60405180910390fd5b42600281905550565b6110d3611aba565b73ffffffffffffffffffffffffffffffffffffffff166110f1611270565b73ffffffffffffffffffffffffffffffffffffffff1614611147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113e9061268e565b60405180910390fd5b6111516000611ac2565b565b61115b611aba565b73ffffffffffffffffffffffffffffffffffffffff16611179611270565b73ffffffffffffffffffffffffffffffffffffffff16146111cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c69061268e565b60405180910390fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154908060030154905084565b6000600254421015801561126b5750611267611406565b4211155b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546112a8906129b7565b80601f01602080910402602001604051908101604052809291908181526020018280546112d4906129b7565b80156113215780601f106112f657610100808354040283529160200191611321565b820191906000526020600020905b81548152906001019060200180831161130457829003601f168201915b5050505050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000611359611250565b611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f90612a5b565b60405180910390fd5b813410156113db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d290612aed565b60405180910390fd5b6000600454426113eb9190612b3c565b90506113f8833383611b86565b915050919050565b60045481565b60006003546002546114189190612b3c565b905090565b611425611aba565b73ffffffffffffffffffffffffffffffffffffffff16611443611270565b73ffffffffffffffffffffffffffffffffffffffff1614611499576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114909061268e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156114df573d6000803e3d6000fd5b5050565b6000806000611513600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611e0e565b91509150600080611545600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611e0e565b9150915083818484896115589190612b92565b6115629190612b92565b61156c9190612c1b565b6115769190612c1b565b945050505050919050565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632bdd2ad96040518163ffffffff1660e01b815260040160206040518083038186803b1580156115ea57600080fd5b505afa1580156115fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162291906128c9565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315a361d26040518163ffffffff1660e01b815260040160206040518083038186803b15801561168c57600080fd5b505afa1580156116a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c491906128c9565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166304bd829c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561172e57600080fd5b505afa158015611742573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176691906128c9565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16633ea6713e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117d057600080fd5b505afa1580156117e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180891906128c9565b905060008385848961181a9190612b92565b6118249190612b92565b61182e9190612c1b565b90508282600454836118409190612b92565b61184a9190612c1b565b6118549190612c1b565b95505050505050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61188e611aba565b73ffffffffffffffffffffffffffffffffffffffff166118ac611270565b73ffffffffffffffffffffffffffffffffffffffff1614611902576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f99061268e565b60405180910390fd5b8060038190555050565b60035481565b60075481565b7f000000000000000000000000000000000000000000000000000000000000000081565b61271081565b61194a611aba565b73ffffffffffffffffffffffffffffffffffffffff16611968611270565b73ffffffffffffffffffffffffffffffffffffffff16146119be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b59061268e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2590612cbe565b60405180910390fd5b611a3781611ac2565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600754612710611a719190612cde565b90508061271084611a829190612b92565b611a8c9190612c1b565b915050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600060065460055411611bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc590612d84565b60405180910390fd5b6000611bd985611a5e565b90506000611be6826114e3565b90506000611bf382611581565b905060008183611c039190612b3c565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663156e29f68888846040518463ffffffff1660e01b8152600401611c6293929190612da4565b602060405180830381600087803b158015611c7c57600080fd5b505af1158015611c90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb491906128c9565b94506040518060800160405280600115158152602001428152602001878152602001828152506008600087815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201556060820151816003015590505060066000815480929190611d4190612ddb565b91905055508673ffffffffffffffffffffffffffffffffffffffff16857ff3cea5493d790af0133817606f7350a91d7f154ea52eaa79d179d4d231e5010260405160405180910390a37f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff167fa905f6b4e3c9dc35b2832ccaf7dd7235c51f5d01d851b5b760189701450dc4f68288611dec611299565b604051611dfb93929190612e24565b60405180910390a2505050509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611e5757600080fd5b505afa158015611e6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8f9190612e9b565b60ff1690508273ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015611eda57600080fd5b505afa158015611eee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f129190612f40565b909192935090915090505080925050915091565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b611f4d81611f3a565b8114611f5857600080fd5b50565b600081359050611f6a81611f44565b92915050565b600060208284031215611f8657611f85611f30565b5b6000611f9484828501611f5b565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611fc882611f9d565b9050919050565b611fd881611fbd565b8114611fe357600080fd5b50565b600081359050611ff581611fcf565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61204e82612005565b810181811067ffffffffffffffff8211171561206d5761206c612016565b5b80604052505050565b6000612080611f26565b905061208c8282612045565b919050565b600067ffffffffffffffff8211156120ac576120ab612016565b5b6120b582612005565b9050602081019050919050565b82818337600083830152505050565b60006120e46120df84612091565b612076565b905082815260208101848484011115612100576120ff612000565b5b61210b8482856120c2565b509392505050565b600082601f83011261212857612127611ffb565b5b81356121388482602086016120d1565b91505092915050565b6000806000806080858703121561215b5761215a611f30565b5b600061216987828801611fe6565b945050602061217a87828801611fe6565b935050604061218b87828801611f5b565b925050606085013567ffffffffffffffff8111156121ac576121ab611f35565b5b6121b887828801612113565b91505092959194509250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6121f9816121c4565b82525050565b600060208201905061221460008301846121f0565b92915050565b61222381611f3a565b82525050565b600060208201905061223e600083018461221a565b92915050565b60008115159050919050565b61225981612244565b82525050565b60006020820190506122746000830184612250565b92915050565b600061228582611fbd565b9050919050565b6122958161227a565b81146122a057600080fd5b50565b6000813590506122b28161228c565b92915050565b6000602082840312156122ce576122cd611f30565b5b60006122dc848285016122a3565b91505092915050565b60006122f082611fbd565b9050919050565b612300816122e5565b811461230b57600080fd5b50565b60008135905061231d816122f7565b92915050565b6000806040838503121561233a57612339611f30565b5b60006123488582860161230e565b925050602061235985828601611fe6565b9150509250929050565b6000819050919050565b600061238861238361237e84611f9d565b612363565b611f9d565b9050919050565b600061239a8261236d565b9050919050565b60006123ac8261238f565b9050919050565b6123bc816123a1565b82525050565b60006020820190506123d760008301846123b3565b92915050565b60006080820190506123f26000830187612250565b6123ff602083018661221a565b61240c604083018561221a565b612419606083018461221a565b95945050505050565b61242b81611fbd565b82525050565b60006020820190506124466000830184612422565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561248657808201518184015260208101905061246b565b83811115612495576000848401525b50505050565b60006124a68261244c565b6124b08185612457565b93506124c0818560208601612468565b6124c981612005565b840191505092915050565b600060208201905081810360008301526124ee818461249b565b905092915050565b60006125018261238f565b9050919050565b612511816124f6565b82525050565b600060208201905061252c6000830184612508565b92915050565b600061253d82611f9d565b9050919050565b61254d81612532565b811461255857600080fd5b50565b60008135905061256a81612544565b92915050565b60006020828403121561258657612585611f30565b5b60006125948482850161255b565b91505092915050565b60006125a88261238f565b9050919050565b6125b88161259d565b82525050565b60006020820190506125d360008301846125af565b92915050565b60006125e48261238f565b9050919050565b6125f4816125d9565b82525050565b600060208201905061260f60008301846125eb565b92915050565b60006020828403121561262b5761262a611f30565b5b600061263984828501611fe6565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612678602083612457565b915061268382612642565b602082019050919050565b600060208201905081810360008301526126a78161266b565b9050919050565b7f426f6e64696e673a2043616e6e6f7420636c61696d20696e616374697665206260008201527f6f6e640000000000000000000000000000000000000000000000000000000000602082015250565b600061270a602383612457565b9150612715826126ae565b604082019050919050565b60006020820190508181036000830152612739816126fd565b9050919050565b60006060820190506127556000830186612422565b6127626020830185612422565b61276f604083018461221a565b949350505050565b7f426f6e64696e673a20426f6e64206973206c6f636b656420746f20636c61696d60008201527f206e6f7700000000000000000000000000000000000000000000000000000000602082015250565b60006127d3602483612457565b91506127de82612777565b604082019050919050565b60006020820190508181036000830152612802816127c6565b9050919050565b600060408201905061281e6000830185612422565b61282b602083018461221a565b9392505050565b61283b81612244565b811461284657600080fd5b50565b60008151905061285881612832565b92915050565b60006020828403121561287457612873611f30565b5b600061288284828501612849565b91505092915050565b60006040820190506128a0600083018561221a565b6128ad6020830184612422565b9392505050565b6000815190506128c381611f44565b92915050565b6000602082840312156128df576128de611f30565b5b60006128ed848285016128b4565b91505092915050565b7f426f6e64696e673a20426f6e64696e6720697320616c7265616479206163746960008201527f7665000000000000000000000000000000000000000000000000000000000000602082015250565b6000612952602283612457565b915061295d826128f6565b604082019050919050565b6000602082019050818103600083015261298181612945565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806129cf57607f821691505b602082108114156129e3576129e2612988565b5b50919050565b7f426f6e64696e673a204d696e74206973206e6f7420617661696c61626c65206960008201527f6e207468697320706572696f6400000000000000000000000000000000000000602082015250565b6000612a45602d83612457565b9150612a50826129e9565b604082019050919050565b60006020820190508181036000830152612a7481612a38565b9050919050565b7f426f6e64696e673a20496e73756666696369656e7420616d6f756e74206f662060008201527f4554480000000000000000000000000000000000000000000000000000000000602082015250565b6000612ad7602383612457565b9150612ae282612a7b565b604082019050919050565b60006020820190508181036000830152612b0681612aca565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612b4782611f3a565b9150612b5283611f3a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b8757612b86612b0d565b5b828201905092915050565b6000612b9d82611f3a565b9150612ba883611f3a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612be157612be0612b0d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612c2682611f3a565b9150612c3183611f3a565b925082612c4157612c40612bec565b5b828204905092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612ca8602683612457565b9150612cb382612c4c565b604082019050919050565b60006020820190508181036000830152612cd781612c9b565b9050919050565b6000612ce982611f3a565b9150612cf483611f3a565b925082821015612d0757612d06612b0d565b5b828203905092915050565b7f426f6e64696e673a20457863656564656420616d6f756e74206f6620626f6e6460008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b6000612d6e602183612457565b9150612d7982612d12565b604082019050919050565b60006020820190508181036000830152612d9d81612d61565b9050919050565b6000606082019050612db96000830186612422565b612dc6602083018561221a565b612dd3604083018461221a565b949350505050565b6000612de682611f3a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e1957612e18612b0d565b5b600182019050919050565b6000606082019050612e39600083018661221a565b612e46602083018561221a565b8181036040830152612e58818461249b565b9050949350505050565b600060ff82169050919050565b612e7881612e62565b8114612e8357600080fd5b50565b600081519050612e9581612e6f565b92915050565b600060208284031215612eb157612eb0611f30565b5b6000612ebf84828501612e86565b91505092915050565b600069ffffffffffffffffffff82169050919050565b612ee781612ec8565b8114612ef257600080fd5b50565b600081519050612f0481612ede565b92915050565b6000819050919050565b612f1d81612f0a565b8114612f2857600080fd5b50565b600081519050612f3a81612f14565b92915050565b600080600080600060a08688031215612f5c57612f5b611f30565b5b6000612f6a88828901612ef5565b9550506020612f7b88828901612f2b565b9450506040612f8c888289016128b4565b9350506060612f9d888289016128b4565b9250506080612fae88828901612ef5565b915050929550929590935056fea2646970667358221220451cba0a5273e20000f37fdacd149d8ab3c98abc26aa6f1be8787d834d09216564736f6c63430008080033",
"opcodes": "PUSH2 0x100 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x12 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x38BC CODESIZE SUB DUP1 PUSH3 0x38BC DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE DUP2 ADD SWAP1 PUSH3 0x38 SWAP2 SWAP1 PUSH3 0x6AE JUMP JUMPDEST DUP11 DUP11 DUP11 DUP11 DUP11 DUP11 DUP11 DUP11 DUP11 DUP11 DUP11 PUSH3 0x63 PUSH3 0x57 PUSH3 0x212 PUSH1 0x20 SHL PUSH1 0x20 SHR JUMP JUMPDEST PUSH3 0x21A PUSH1 0x20 SHL PUSH1 0x20 SHR JUMP JUMPDEST DUP11 PUSH1 0x5 DUP2 SWAP1 SSTORE POP DUP10 PUSH1 0x3 DUP2 SWAP1 SSTORE POP DUP9 PUSH1 0x4 DUP2 SWAP1 SSTORE POP DUP8 PUSH1 0x7 DUP2 SWAP1 SSTORE POP DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0xE0 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x60 SHL DUP2 MSTORE POP POP DUP6 PUSH1 0x9 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP5 PUSH1 0xA PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x80 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x60 SHL DUP2 MSTORE POP POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0xA0 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x60 SHL DUP2 MSTORE POP POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0xC0 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x60 SHL DUP2 MSTORE POP POP DUP1 PUSH1 0x1 SWAP1 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 PUSH3 0x1F5 SWAP3 SWAP2 SWAP1 PUSH3 0x2DE JUMP JUMPDEST POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP POP PUSH3 0x83F JUMP JUMPDEST PUSH1 0x0 CALLER SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH3 0x2EC SWAP1 PUSH3 0x809 JUMP JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH3 0x310 JUMPI PUSH1 0x0 DUP6 SSTORE PUSH3 0x35C JUMP JUMPDEST DUP3 PUSH1 0x1F LT PUSH3 0x32B JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0x35C JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0x35C JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x35B JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0x33E JUMP JUMPDEST JUMPDEST POP SWAP1 POP PUSH3 0x36B SWAP2 SWAP1 PUSH3 0x36F JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x38A JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH3 0x370 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH3 0x3B7 DUP2 PUSH3 0x3A2 JUMP JUMPDEST DUP2 EQ PUSH3 0x3C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH3 0x3D7 DUP2 PUSH3 0x3AC JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x40A DUP3 PUSH3 0x3DD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x41E DUP3 PUSH3 0x3FD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH3 0x430 DUP2 PUSH3 0x411 JUMP JUMPDEST DUP2 EQ PUSH3 0x43C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH3 0x450 DUP2 PUSH3 0x425 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x463 DUP3 PUSH3 0x3FD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH3 0x475 DUP2 PUSH3 0x456 JUMP JUMPDEST DUP2 EQ PUSH3 0x481 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH3 0x495 DUP2 PUSH3 0x46A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x4A8 DUP3 PUSH3 0x3FD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH3 0x4BA DUP2 PUSH3 0x49B JUMP JUMPDEST DUP2 EQ PUSH3 0x4C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH3 0x4DA DUP2 PUSH3 0x4AF JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x4ED DUP3 PUSH3 0x3FD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH3 0x4FF DUP2 PUSH3 0x4E0 JUMP JUMPDEST DUP2 EQ PUSH3 0x50B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH3 0x51F DUP2 PUSH3 0x4F4 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH3 0x57A DUP3 PUSH3 0x52F JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH3 0x59C JUMPI PUSH3 0x59B PUSH3 0x540 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x5B1 PUSH3 0x38E JUMP JUMPDEST SWAP1 POP PUSH3 0x5BF DUP3 DUP3 PUSH3 0x56F JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH3 0x5E2 JUMPI PUSH3 0x5E1 PUSH3 0x540 JUMP JUMPDEST JUMPDEST PUSH3 0x5ED DUP3 PUSH3 0x52F JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH3 0x61A JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH3 0x5FD JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH3 0x62A JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x647 PUSH3 0x641 DUP5 PUSH3 0x5C4 JUMP JUMPDEST PUSH3 0x5A5 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH3 0x666 JUMPI PUSH3 0x665 PUSH3 0x52A JUMP JUMPDEST JUMPDEST PUSH3 0x673 DUP5 DUP3 DUP6 PUSH3 0x5FA JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH3 0x693 JUMPI PUSH3 0x692 PUSH3 0x525 JUMP JUMPDEST JUMPDEST DUP2 MLOAD PUSH3 0x6A5 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH3 0x630 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x160 DUP13 DUP15 SUB SLT ISZERO PUSH3 0x6D7 JUMPI PUSH3 0x6D6 PUSH3 0x398 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH3 0x6E7 DUP15 DUP3 DUP16 ADD PUSH3 0x3C6 JUMP JUMPDEST SWAP12 POP POP PUSH1 0x20 PUSH3 0x6FA DUP15 DUP3 DUP16 ADD PUSH3 0x3C6 JUMP JUMPDEST SWAP11 POP POP PUSH1 0x40 PUSH3 0x70D DUP15 DUP3 DUP16 ADD PUSH3 0x3C6 JUMP JUMPDEST SWAP10 POP POP PUSH1 0x60 PUSH3 0x720 DUP15 DUP3 DUP16 ADD PUSH3 0x3C6 JUMP JUMPDEST SWAP9 POP POP PUSH1 0x80 PUSH3 0x733 DUP15 DUP3 DUP16 ADD PUSH3 0x43F JUMP JUMPDEST SWAP8 POP POP PUSH1 0xA0 PUSH3 0x746 DUP15 DUP3 DUP16 ADD PUSH3 0x484 JUMP JUMPDEST SWAP7 POP POP PUSH1 0xC0 PUSH3 0x759 DUP15 DUP3 DUP16 ADD PUSH3 0x484 JUMP JUMPDEST SWAP6 POP POP PUSH1 0xE0 PUSH3 0x76C DUP15 DUP3 DUP16 ADD PUSH3 0x4C9 JUMP JUMPDEST SWAP5 POP POP PUSH2 0x100 PUSH3 0x780 DUP15 DUP3 DUP16 ADD PUSH3 0x4C9 JUMP JUMPDEST SWAP4 POP POP PUSH2 0x120 PUSH3 0x794 DUP15 DUP3 DUP16 ADD PUSH3 0x50E JUMP JUMPDEST SWAP3 POP POP PUSH2 0x140 DUP13 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH3 0x7B9 JUMPI PUSH3 0x7B8 PUSH3 0x39D JUMP JUMPDEST JUMPDEST PUSH3 0x7C7 DUP15 DUP3 DUP16 ADD PUSH3 0x67B JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP9 SWAP12 POP SWAP3 SWAP6 SWAP9 SWAP12 SWAP1 SWAP4 SWAP7 SWAP10 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH3 0x822 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 EQ ISZERO PUSH3 0x839 JUMPI PUSH3 0x838 PUSH3 0x7DA JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0x60 SHR PUSH1 0xA0 MLOAD PUSH1 0x60 SHR PUSH1 0xC0 MLOAD PUSH1 0x60 SHR PUSH1 0xE0 MLOAD PUSH1 0x60 SHR PUSH2 0x2FF1 PUSH3 0x8CB PUSH1 0x0 CODECOPY PUSH1 0x0 DUP2 DUP2 PUSH2 0xAF5 ADD MSTORE DUP2 DUP2 PUSH2 0xFDC ADD MSTORE PUSH2 0x1C07 ADD MSTORE PUSH1 0x0 DUP2 DUP2 PUSH2 0xC3B ADD MSTORE DUP2 DUP2 PUSH2 0xCD1 ADD MSTORE DUP2 DUP2 PUSH2 0x132D ADD MSTORE DUP2 DUP2 PUSH2 0x1586 ADD MSTORE DUP2 DUP2 PUSH2 0x1628 ADD MSTORE DUP2 DUP2 PUSH2 0x16CA ADD MSTORE PUSH2 0x176C ADD MSTORE PUSH1 0x0 DUP2 DUP2 PUSH2 0xBFF ADD MSTORE PUSH2 0x191A ADD MSTORE PUSH1 0x0 DUP2 DUP2 PUSH2 0x1A3C ADD MSTORE PUSH2 0x1D8C ADD MSTORE PUSH2 0x2FF1 PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x21A JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x8DA5CB5B GT PUSH2 0x123 JUMPI DUP1 PUSH4 0xC4C72337 GT PUSH2 0xAB JUMPI DUP1 PUSH4 0xF2D81C33 GT PUSH2 0x6F JUMPI DUP1 PUSH4 0xF2D81C33 EQ PUSH2 0x7A7 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x7D2 JUMPI DUP1 PUSH4 0xFC0C546A EQ PUSH2 0x7FB JUMPI DUP1 PUSH4 0xFC2D3DA9 EQ PUSH2 0x826 JUMPI DUP1 PUSH4 0xFD7F6771 EQ PUSH2 0x863 JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0xC4C72337 EQ PUSH2 0x6D2 JUMPI DUP1 PUSH4 0xC74364F4 EQ PUSH2 0x6FD JUMPI DUP1 PUSH4 0xC8932F81 EQ PUSH2 0x726 JUMPI DUP1 PUSH4 0xD3308F54 EQ PUSH2 0x751 JUMPI DUP1 PUSH4 0xD370E052 EQ PUSH2 0x77C JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0xA3820322 GT PUSH2 0xF2 JUMPI DUP1 PUSH4 0xA3820322 EQ PUSH2 0x5D9 JUMPI DUP1 PUSH4 0xA3EB5FFA EQ PUSH2 0x604 JUMPI DUP1 PUSH4 0xA526C5F0 EQ PUSH2 0x62F JUMPI DUP1 PUSH4 0xA80E4FF0 EQ PUSH2 0x658 JUMPI DUP1 PUSH4 0xABFE35AD EQ PUSH2 0x695 JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x528 JUMPI DUP1 PUSH4 0x94C8636F EQ PUSH2 0x553 JUMPI DUP1 PUSH4 0x9E00E613 EQ PUSH2 0x57E JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x5A9 JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0x457FCD0E GT PUSH2 0x1A6 JUMPI DUP1 PUSH4 0x5FA73E33 GT PUSH2 0x175 JUMPI DUP1 PUSH4 0x5FA73E33 EQ PUSH2 0x466 JUMPI DUP1 PUSH4 0x715018A6 EQ PUSH2 0x47D JUMPI DUP1 PUSH4 0x7EC164A0 EQ PUSH2 0x494 JUMPI DUP1 PUSH4 0x821DE0AF EQ PUSH2 0x4BD JUMPI DUP1 PUSH4 0x8C387B93 EQ PUSH2 0x4FD JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0x457FCD0E EQ PUSH2 0x3BC JUMPI DUP1 PUSH4 0x48AE238F EQ PUSH2 0x3E7 JUMPI DUP1 PUSH4 0x5831D885 EQ PUSH2 0x410 JUMPI DUP1 PUSH4 0x5A4EF6B9 EQ PUSH2 0x43B JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0x1E1EBF27 GT PUSH2 0x1ED JUMPI DUP1 PUSH4 0x1E1EBF27 EQ PUSH2 0x2DB JUMPI DUP1 PUSH4 0x263B1491 EQ PUSH2 0x318 JUMPI DUP1 PUSH4 0x2F8D16EB EQ PUSH2 0x341 JUMPI DUP1 PUSH4 0x379607F5 EQ PUSH2 0x36A JUMPI DUP1 PUSH4 0x3D568CDB EQ PUSH2 0x393 JUMPI PUSH2 0x21A JUMP JUMPDEST DUP1 PUSH4 0x2D0D868 EQ PUSH2 0x21F JUMPI DUP1 PUSH4 0x150B7A02 EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x285 JUMPI DUP1 PUSH4 0x1C0CA1AB EQ PUSH2 0x2B0 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x246 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x241 SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x88E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x26A SWAP2 SWAP1 PUSH2 0x2141 JUMP JUMPDEST PUSH2 0x914 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x27C SWAP2 SWAP1 PUSH2 0x21FF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x291 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x29A PUSH2 0x928 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x2A7 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C5 PUSH2 0x932 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x2D2 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2E7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x302 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2FD SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x938 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x30F SWAP2 SWAP1 PUSH2 0x225F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x324 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x33F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x33A SWAP2 SWAP1 PUSH2 0x22B8 JUMP JUMPDEST PUSH2 0x965 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x34D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x368 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x363 SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0xA25 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x376 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x391 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x38C SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0xAAB JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x39F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3BA PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x3B5 SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0xDB2 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH2 0xE38 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x3DE SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x40E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x409 SWAP2 SWAP1 PUSH2 0x2323 JUMP JUMPDEST PUSH2 0xE3E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x41C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x425 PUSH2 0xFD4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x432 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x447 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x450 PUSH2 0xFDA JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x45D SWAP2 SWAP1 PUSH2 0x23C2 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x472 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x47B PUSH2 0xFFE JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x489 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x492 PUSH2 0x10CB JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4BB PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x4B6 SWAP2 SWAP1 PUSH2 0x22B8 JUMP JUMPDEST PUSH2 0x1153 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4C9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4E4 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x4DF SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x1213 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x4F4 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x23DD JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x509 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x512 PUSH2 0x1250 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x51F SWAP2 SWAP1 PUSH2 0x225F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x534 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x53D PUSH2 0x1270 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x54A SWAP2 SWAP1 PUSH2 0x2431 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x55F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x568 PUSH2 0x1299 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x575 SWAP2 SWAP1 PUSH2 0x24D4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x58A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x593 PUSH2 0x132B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5A0 SWAP2 SWAP1 PUSH2 0x2517 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x5C3 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x5BE SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x134F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5D0 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5EE PUSH2 0x1400 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x5FB SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x610 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x619 PUSH2 0x1406 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x626 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x63B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x656 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x651 SWAP2 SWAP1 PUSH2 0x2570 JUMP JUMPDEST PUSH2 0x141D JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x664 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x67F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x67A SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x14E3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x68C SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6A1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6BC PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x6B7 SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x1581 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6C9 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6E7 PUSH2 0x1860 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x6F4 SWAP2 SWAP1 PUSH2 0x25BE JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x709 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x724 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x71F SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x1886 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x732 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x73B PUSH2 0x190C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x748 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x75D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x766 PUSH2 0x1912 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x773 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x788 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x791 PUSH2 0x1918 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x79E SWAP2 SWAP1 PUSH2 0x25FA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7B3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7BC PUSH2 0x193C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x7C9 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F9 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x7F4 SWAP2 SWAP1 PUSH2 0x2615 JUMP JUMPDEST PUSH2 0x1942 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x807 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x810 PUSH2 0x1A3A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x81D SWAP2 SWAP1 PUSH2 0x25FA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x832 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x84D PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x848 SWAP2 SWAP1 PUSH2 0x1F70 JUMP JUMPDEST PUSH2 0x1A5E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x85A SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x86F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x878 PUSH2 0x1A94 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x885 SWAP2 SWAP1 PUSH2 0x25BE JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x896 PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8B4 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x90A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x901 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x5 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH4 0x150B7A02 PUSH1 0xE0 SHL SWAP1 POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x6 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x8 PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x96D PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x98B PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x9E1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x9D8 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x9 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH2 0xA2D PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0xA4B PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xAA1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xA98 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x7 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH2 0xAB4 DUP2 PUSH2 0x938 JUMP JUMPDEST PUSH2 0xAF3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xAEA SWAP1 PUSH2 0x2720 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x42842E0E CALLER ADDRESS DUP5 PUSH1 0x40 MLOAD DUP5 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xB50 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2740 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xB6A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xB7E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x0 PUSH1 0x8 PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SWAP1 POP TIMESTAMP DUP2 PUSH1 0x2 ADD SLOAD GT ISZERO PUSH2 0xBE0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD7 SWAP1 PUSH2 0x27E9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x0 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x95EA7B3 PUSH32 0x0 DUP4 PUSH1 0x3 ADD SLOAD PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xC7C SWAP3 SWAP2 SWAP1 PUSH2 0x2809 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xC96 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xCAA JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xCCE SWAP2 SWAP1 PUSH2 0x285E JUMP JUMPDEST POP PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x7ACB7757 DUP3 PUSH1 0x3 ADD SLOAD CALLER PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xD2E SWAP3 SWAP2 SWAP1 PUSH2 0x288B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xD48 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xD5C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x47CEE97CB7ACD717B3C0AA1435D004CD5B3C8C57D70DBCEB4E4458BBD60E39D4 DUP4 PUSH1 0x40 MLOAD PUSH2 0xDA6 SWAP2 SWAP1 PUSH2 0x2229 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH2 0xDBA PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0xDD8 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xE2E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE25 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x4 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST PUSH2 0xE46 PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0xE64 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xEBA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xEB1 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xA9059CBB DUP3 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x70A08231 ADDRESS PUSH1 0x40 MLOAD DUP3 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xF10 SWAP2 SWAP1 PUSH2 0x2431 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xF28 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0xF3C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xF60 SWAP2 SWAP1 PUSH2 0x28C9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xF7D SWAP3 SWAP2 SWAP1 PUSH2 0x2809 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xF97 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xFAB JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0xFCF SWAP2 SWAP1 PUSH2 0x285E JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH2 0x1006 PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x1024 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x107A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1071 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1082 PUSH2 0x1250 JUMP JUMPDEST ISZERO PUSH2 0x10C2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x10B9 SWAP1 PUSH2 0x2968 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST TIMESTAMP PUSH1 0x2 DUP2 SWAP1 SSTORE POP JUMP JUMPDEST PUSH2 0x10D3 PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x10F1 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x1147 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x113E SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1151 PUSH1 0x0 PUSH2 0x1AC2 JUMP JUMPDEST JUMP JUMPDEST PUSH2 0x115B PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x1179 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x11CF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x11C6 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP DUP1 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 DUP1 PUSH1 0x1 ADD SLOAD SWAP1 DUP1 PUSH1 0x2 ADD SLOAD SWAP1 DUP1 PUSH1 0x3 ADD SLOAD SWAP1 POP DUP5 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 SLOAD TIMESTAMP LT ISZERO DUP1 ISZERO PUSH2 0x126B JUMPI POP PUSH2 0x1267 PUSH2 0x1406 JUMP JUMPDEST TIMESTAMP GT ISZERO JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x1 DUP1 SLOAD PUSH2 0x12A8 SWAP1 PUSH2 0x29B7 JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x12D4 SWAP1 PUSH2 0x29B7 JUMP JUMPDEST DUP1 ISZERO PUSH2 0x1321 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x12F6 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1321 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1304 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1359 PUSH2 0x1250 JUMP JUMPDEST PUSH2 0x1398 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x138F SWAP1 PUSH2 0x2A5B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP2 CALLVALUE LT ISZERO PUSH2 0x13DB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x13D2 SWAP1 PUSH2 0x2AED JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x4 SLOAD TIMESTAMP PUSH2 0x13EB SWAP2 SWAP1 PUSH2 0x2B3C JUMP JUMPDEST SWAP1 POP PUSH2 0x13F8 DUP4 CALLER DUP4 PUSH2 0x1B86 JUMP JUMPDEST SWAP2 POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x3 SLOAD PUSH1 0x2 SLOAD PUSH2 0x1418 SWAP2 SWAP1 PUSH2 0x2B3C JUMP JUMPDEST SWAP1 POP SWAP1 JUMP JUMPDEST PUSH2 0x1425 PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x1443 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x1499 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1490 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x8FC SELFBALANCE SWAP1 DUP2 ISZERO MUL SWAP1 PUSH1 0x40 MLOAD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x14DF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x1513 PUSH1 0xA PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x1E0E JUMP JUMPDEST SWAP2 POP SWAP2 POP PUSH1 0x0 DUP1 PUSH2 0x1545 PUSH1 0x9 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x1E0E JUMP JUMPDEST SWAP2 POP SWAP2 POP DUP4 DUP2 DUP5 DUP5 DUP10 PUSH2 0x1558 SWAP2 SWAP1 PUSH2 0x2B92 JUMP JUMPDEST PUSH2 0x1562 SWAP2 SWAP1 PUSH2 0x2B92 JUMP JUMPDEST PUSH2 0x156C SWAP2 SWAP1 PUSH2 0x2C1B JUMP JUMPDEST PUSH2 0x1576 SWAP2 SWAP1 PUSH2 0x2C1B JUMP JUMPDEST SWAP5 POP POP POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x2BDD2AD9 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x15EA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x15FE JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1622 SWAP2 SWAP1 PUSH2 0x28C9 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x15A361D2 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x168C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x16A0 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x16C4 SWAP2 SWAP1 PUSH2 0x28C9 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x4BD829C PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x172E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1742 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1766 SWAP2 SWAP1 PUSH2 0x28C9 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x3EA6713E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x17D0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x17E4 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1808 SWAP2 SWAP1 PUSH2 0x28C9 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 DUP4 DUP6 DUP5 DUP10 PUSH2 0x181A SWAP2 SWAP1 PUSH2 0x2B92 JUMP JUMPDEST PUSH2 0x1824 SWAP2 SWAP1 PUSH2 0x2B92 JUMP JUMPDEST PUSH2 0x182E SWAP2 SWAP1 PUSH2 0x2C1B JUMP JUMPDEST SWAP1 POP DUP3 DUP3 PUSH1 0x4 SLOAD DUP4 PUSH2 0x1840 SWAP2 SWAP1 PUSH2 0x2B92 JUMP JUMPDEST PUSH2 0x184A SWAP2 SWAP1 PUSH2 0x2C1B JUMP JUMPDEST PUSH2 0x1854 SWAP2 SWAP1 PUSH2 0x2C1B JUMP JUMPDEST SWAP6 POP POP POP POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x9 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH2 0x188E PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x18AC PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x1902 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x18F9 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x3 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x7 SLOAD DUP2 JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH2 0x2710 DUP2 JUMP JUMPDEST PUSH2 0x194A PUSH2 0x1ABA JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x1968 PUSH2 0x1270 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x19BE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x19B5 SWAP1 PUSH2 0x268E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1A2E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1A25 SWAP1 PUSH2 0x2CBE JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1A37 DUP2 PUSH2 0x1AC2 JUMP JUMPDEST POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x7 SLOAD PUSH2 0x2710 PUSH2 0x1A71 SWAP2 SWAP1 PUSH2 0x2CDE JUMP JUMPDEST SWAP1 POP DUP1 PUSH2 0x2710 DUP5 PUSH2 0x1A82 SWAP2 SWAP1 PUSH2 0x2B92 JUMP JUMPDEST PUSH2 0x1A8C SWAP2 SWAP1 PUSH2 0x2C1B JUMP JUMPDEST SWAP2 POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0xA PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x6 SLOAD PUSH1 0x5 SLOAD GT PUSH2 0x1BCE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1BC5 SWAP1 PUSH2 0x2D84 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1BD9 DUP6 PUSH2 0x1A5E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x1BE6 DUP3 PUSH2 0x14E3 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x1BF3 DUP3 PUSH2 0x1581 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 DUP2 DUP4 PUSH2 0x1C03 SWAP2 SWAP1 PUSH2 0x2B3C JUMP JUMPDEST SWAP1 POP PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x156E29F6 DUP9 DUP9 DUP5 PUSH1 0x40 MLOAD DUP5 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1C62 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2DA4 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1C7C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1C90 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1CB4 SWAP2 SWAP1 PUSH2 0x28C9 JUMP JUMPDEST SWAP5 POP PUSH1 0x40 MLOAD DUP1 PUSH1 0x80 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x1 ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD TIMESTAMP DUP2 MSTORE PUSH1 0x20 ADD DUP8 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE POP PUSH1 0x8 PUSH1 0x0 DUP8 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 ADD MLOAD DUP2 PUSH1 0x0 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH1 0x20 DUP3 ADD MLOAD DUP2 PUSH1 0x1 ADD SSTORE PUSH1 0x40 DUP3 ADD MLOAD DUP2 PUSH1 0x2 ADD SSTORE PUSH1 0x60 DUP3 ADD MLOAD DUP2 PUSH1 0x3 ADD SSTORE SWAP1 POP POP PUSH1 0x6 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH2 0x1D41 SWAP1 PUSH2 0x2DDB JUMP JUMPDEST SWAP2 SWAP1 POP SSTORE POP DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH32 0xF3CEA5493D790AF0133817606F7350A91D7F154EA52EAA79D179D4D231E50102 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xA905F6B4E3C9DC35B2832CCAF7DD7235C51F5D01D851B5B760189701450DC4F6 DUP3 DUP9 PUSH2 0x1DEC PUSH2 0x1299 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1DFB SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2E24 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x313CE567 PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1E57 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1E6B JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1E8F SWAP2 SWAP1 PUSH2 0x2E9B JUMP JUMPDEST PUSH1 0xFF AND SWAP1 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xFEAF968C PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0xA0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1EDA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1EEE JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1F12 SWAP2 SWAP1 PUSH2 0x2F40 JUMP JUMPDEST SWAP1 SWAP2 SWAP3 SWAP4 POP SWAP1 SWAP2 POP SWAP1 POP POP DUP1 SWAP3 POP POP SWAP2 POP SWAP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x1F4D DUP2 PUSH2 0x1F3A JUMP JUMPDEST DUP2 EQ PUSH2 0x1F58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1F6A DUP2 PUSH2 0x1F44 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1F86 JUMPI PUSH2 0x1F85 PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1F94 DUP5 DUP3 DUP6 ADD PUSH2 0x1F5B JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1FC8 DUP3 PUSH2 0x1F9D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x1FD8 DUP2 PUSH2 0x1FBD JUMP JUMPDEST DUP2 EQ PUSH2 0x1FE3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1FF5 DUP2 PUSH2 0x1FCF JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x204E DUP3 PUSH2 0x2005 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x206D JUMPI PUSH2 0x206C PUSH2 0x2016 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2080 PUSH2 0x1F26 JUMP JUMPDEST SWAP1 POP PUSH2 0x208C DUP3 DUP3 PUSH2 0x2045 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x20AC JUMPI PUSH2 0x20AB PUSH2 0x2016 JUMP JUMPDEST JUMPDEST PUSH2 0x20B5 DUP3 PUSH2 0x2005 JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY PUSH1 0x0 DUP4 DUP4 ADD MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x20E4 PUSH2 0x20DF DUP5 PUSH2 0x2091 JUMP JUMPDEST PUSH2 0x2076 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH2 0x2100 JUMPI PUSH2 0x20FF PUSH2 0x2000 JUMP JUMPDEST JUMPDEST PUSH2 0x210B DUP5 DUP3 DUP6 PUSH2 0x20C2 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x2128 JUMPI PUSH2 0x2127 PUSH2 0x1FFB JUMP JUMPDEST JUMPDEST DUP2 CALLDATALOAD PUSH2 0x2138 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x20D1 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x215B JUMPI PUSH2 0x215A PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2169 DUP8 DUP3 DUP9 ADD PUSH2 0x1FE6 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x217A DUP8 DUP3 DUP9 ADD PUSH2 0x1FE6 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0x218B DUP8 DUP3 DUP9 ADD PUSH2 0x1F5B JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x21AC JUMPI PUSH2 0x21AB PUSH2 0x1F35 JUMP JUMPDEST JUMPDEST PUSH2 0x21B8 DUP8 DUP3 DUP9 ADD PUSH2 0x2113 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x21F9 DUP2 PUSH2 0x21C4 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x2214 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x21F0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x2223 DUP2 PUSH2 0x1F3A JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x223E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x221A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2259 DUP2 PUSH2 0x2244 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x2274 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x2250 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2285 DUP3 PUSH2 0x1FBD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2295 DUP2 PUSH2 0x227A JUMP JUMPDEST DUP2 EQ PUSH2 0x22A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x22B2 DUP2 PUSH2 0x228C JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x22CE JUMPI PUSH2 0x22CD PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x22DC DUP5 DUP3 DUP6 ADD PUSH2 0x22A3 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x22F0 DUP3 PUSH2 0x1FBD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2300 DUP2 PUSH2 0x22E5 JUMP JUMPDEST DUP2 EQ PUSH2 0x230B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x231D DUP2 PUSH2 0x22F7 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x233A JUMPI PUSH2 0x2339 PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2348 DUP6 DUP3 DUP7 ADD PUSH2 0x230E JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x2359 DUP6 DUP3 DUP7 ADD PUSH2 0x1FE6 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2388 PUSH2 0x2383 PUSH2 0x237E DUP5 PUSH2 0x1F9D JUMP JUMPDEST PUSH2 0x2363 JUMP JUMPDEST PUSH2 0x1F9D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x239A DUP3 PUSH2 0x236D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x23AC DUP3 PUSH2 0x238F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x23BC DUP2 PUSH2 0x23A1 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x23D7 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x23B3 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 ADD SWAP1 POP PUSH2 0x23F2 PUSH1 0x0 DUP4 ADD DUP8 PUSH2 0x2250 JUMP JUMPDEST PUSH2 0x23FF PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x221A JUMP JUMPDEST PUSH2 0x240C PUSH1 0x40 DUP4 ADD DUP6 PUSH2 0x221A JUMP JUMPDEST PUSH2 0x2419 PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x221A JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x242B DUP2 PUSH2 0x1FBD JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x2446 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x2422 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x2486 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x246B JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x2495 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x24A6 DUP3 PUSH2 0x244C JUMP JUMPDEST PUSH2 0x24B0 DUP2 DUP6 PUSH2 0x2457 JUMP JUMPDEST SWAP4 POP PUSH2 0x24C0 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x2468 JUMP JUMPDEST PUSH2 0x24C9 DUP2 PUSH2 0x2005 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x24EE DUP2 DUP5 PUSH2 0x249B JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2501 DUP3 PUSH2 0x238F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2511 DUP2 PUSH2 0x24F6 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x252C PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x2508 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x253D DUP3 PUSH2 0x1F9D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x254D DUP2 PUSH2 0x2532 JUMP JUMPDEST DUP2 EQ PUSH2 0x2558 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x256A DUP2 PUSH2 0x2544 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2586 JUMPI PUSH2 0x2585 PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2594 DUP5 DUP3 DUP6 ADD PUSH2 0x255B JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x25A8 DUP3 PUSH2 0x238F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x25B8 DUP2 PUSH2 0x259D JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x25D3 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x25AF JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x25E4 DUP3 PUSH2 0x238F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x25F4 DUP2 PUSH2 0x25D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x260F PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x25EB JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x262B JUMPI PUSH2 0x262A PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2639 DUP5 DUP3 DUP6 ADD PUSH2 0x1FE6 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A2063616C6C6572206973206E6F7420746865206F776E6572 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2678 PUSH1 0x20 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x2683 DUP3 PUSH2 0x2642 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x26A7 DUP2 PUSH2 0x266B JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x426F6E64696E673A2043616E6E6F7420636C61696D20696E6163746976652062 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6F6E640000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x270A PUSH1 0x23 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x2715 DUP3 PUSH2 0x26AE JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2739 DUP2 PUSH2 0x26FD JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2755 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x2422 JUMP JUMPDEST PUSH2 0x2762 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x2422 JUMP JUMPDEST PUSH2 0x276F PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x221A JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0x426F6E64696E673A20426F6E64206973206C6F636B656420746F20636C61696D PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x206E6F7700000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x27D3 PUSH1 0x24 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x27DE DUP3 PUSH2 0x2777 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2802 DUP2 PUSH2 0x27C6 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x281E PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x2422 JUMP JUMPDEST PUSH2 0x282B PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x221A JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x283B DUP2 PUSH2 0x2244 JUMP JUMPDEST DUP2 EQ PUSH2 0x2846 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2858 DUP2 PUSH2 0x2832 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2874 JUMPI PUSH2 0x2873 PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2882 DUP5 DUP3 DUP6 ADD PUSH2 0x2849 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x28A0 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x221A JUMP JUMPDEST PUSH2 0x28AD PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x2422 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x28C3 DUP2 PUSH2 0x1F44 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x28DF JUMPI PUSH2 0x28DE PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x28ED DUP5 DUP3 DUP6 ADD PUSH2 0x28B4 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x426F6E64696E673A20426F6E64696E6720697320616C72656164792061637469 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x7665000000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2952 PUSH1 0x22 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x295D DUP3 PUSH2 0x28F6 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2981 DUP2 PUSH2 0x2945 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x29CF JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 EQ ISZERO PUSH2 0x29E3 JUMPI PUSH2 0x29E2 PUSH2 0x2988 JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x426F6E64696E673A204D696E74206973206E6F7420617661696C61626C652069 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6E207468697320706572696F6400000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2A45 PUSH1 0x2D DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x2A50 DUP3 PUSH2 0x29E9 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2A74 DUP2 PUSH2 0x2A38 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x426F6E64696E673A20496E73756666696369656E7420616D6F756E74206F6620 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x4554480000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2AD7 PUSH1 0x23 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x2AE2 DUP3 PUSH2 0x2A7B JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2B06 DUP2 PUSH2 0x2ACA JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x2B47 DUP3 PUSH2 0x1F3A JUMP JUMPDEST SWAP2 POP PUSH2 0x2B52 DUP4 PUSH2 0x1F3A JUMP JUMPDEST SWAP3 POP DUP3 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SUB DUP3 GT ISZERO PUSH2 0x2B87 JUMPI PUSH2 0x2B86 PUSH2 0x2B0D JUMP JUMPDEST JUMPDEST DUP3 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2B9D DUP3 PUSH2 0x1F3A JUMP JUMPDEST SWAP2 POP PUSH2 0x2BA8 DUP4 PUSH2 0x1F3A JUMP JUMPDEST SWAP3 POP DUP2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DIV DUP4 GT DUP3 ISZERO ISZERO AND ISZERO PUSH2 0x2BE1 JUMPI PUSH2 0x2BE0 PUSH2 0x2B0D JUMP JUMPDEST JUMPDEST DUP3 DUP3 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x12 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x2C26 DUP3 PUSH2 0x1F3A JUMP JUMPDEST SWAP2 POP PUSH2 0x2C31 DUP4 PUSH2 0x1F3A JUMP JUMPDEST SWAP3 POP DUP3 PUSH2 0x2C41 JUMPI PUSH2 0x2C40 PUSH2 0x2BEC JUMP JUMPDEST JUMPDEST DUP3 DUP3 DIV SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A206E6577206F776E657220697320746865207A65726F2061 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6464726573730000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2CA8 PUSH1 0x26 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x2CB3 DUP3 PUSH2 0x2C4C JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2CD7 DUP2 PUSH2 0x2C9B JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2CE9 DUP3 PUSH2 0x1F3A JUMP JUMPDEST SWAP2 POP PUSH2 0x2CF4 DUP4 PUSH2 0x1F3A JUMP JUMPDEST SWAP3 POP DUP3 DUP3 LT ISZERO PUSH2 0x2D07 JUMPI PUSH2 0x2D06 PUSH2 0x2B0D JUMP JUMPDEST JUMPDEST DUP3 DUP3 SUB SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x426F6E64696E673A20457863656564656420616D6F756E74206F6620626F6E64 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x7300000000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2D6E PUSH1 0x21 DUP4 PUSH2 0x2457 JUMP JUMPDEST SWAP2 POP PUSH2 0x2D79 DUP3 PUSH2 0x2D12 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2D9D DUP2 PUSH2 0x2D61 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2DB9 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x2422 JUMP JUMPDEST PUSH2 0x2DC6 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x221A JUMP JUMPDEST PUSH2 0x2DD3 PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x221A JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2DE6 DUP3 PUSH2 0x1F3A JUMP JUMPDEST SWAP2 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 EQ ISZERO PUSH2 0x2E19 JUMPI PUSH2 0x2E18 PUSH2 0x2B0D JUMP JUMPDEST JUMPDEST PUSH1 0x1 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2E39 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x221A JUMP JUMPDEST PUSH2 0x2E46 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x221A JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x2E58 DUP2 DUP5 PUSH2 0x249B JUMP JUMPDEST SWAP1 POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2E78 DUP2 PUSH2 0x2E62 JUMP JUMPDEST DUP2 EQ PUSH2 0x2E83 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2E95 DUP2 PUSH2 0x2E6F JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2EB1 JUMPI PUSH2 0x2EB0 PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2EBF DUP5 DUP3 DUP6 ADD PUSH2 0x2E86 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH10 0xFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2EE7 DUP2 PUSH2 0x2EC8 JUMP JUMPDEST DUP2 EQ PUSH2 0x2EF2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2F04 DUP2 PUSH2 0x2EDE JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2F1D DUP2 PUSH2 0x2F0A JUMP JUMPDEST DUP2 EQ PUSH2 0x2F28 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2F3A DUP2 PUSH2 0x2F14 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0xA0 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x2F5C JUMPI PUSH2 0x2F5B PUSH2 0x1F30 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x2F6A DUP9 DUP3 DUP10 ADD PUSH2 0x2EF5 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x20 PUSH2 0x2F7B DUP9 DUP3 DUP10 ADD PUSH2 0x2F2B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x40 PUSH2 0x2F8C DUP9 DUP3 DUP10 ADD PUSH2 0x28B4 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x60 PUSH2 0x2F9D DUP9 DUP3 DUP10 ADD PUSH2 0x28B4 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x2FAE DUP9 DUP3 DUP10 ADD PUSH2 0x2EF5 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 GASLIMIT SHR 0xBA EXP MSTORE PUSH20 0xE20000F37FDACD149D8AB3C98ABC26AA6F1BE878 PUSH30 0x834D09216564736F6C634300080800330000000000000000000000000000 ",
"sourceMap": "45702:1268:0:-:0;;;45741:689;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;46142:10;46167:17;46199:18;46232;46264:12;46291:16;46321:15;46350:6;46370:5;46389:6;46409:9;23060:32;23079:12;:10;;;:12;;:::i;:::-;23060:18;;;:32;;:::i;:::-;38504:10;38492:9;:22;;;;38543:17;38524:16;:36;;;;38590:18;38570:17;:38;;;;38638:18;38618:17;:38;;;;38680:12;38666:26;;;;;;;;;;;;38720:16;38702:15;;:34;;;;;;;;;;;;;;;;;;38763:15;38746:14;;:32;;;;;;;;;;;;;;;;;;38796:6;38788:14;;;;;;;;;;;;38819:5;38812:12;;;;;;;;;;;;38842:6;38834:14;;;;;;;;;;;;38876:8;38858:9;:27;;;;;;;;;;;;:::i;:::-;;38104:788;;;;;;;;;;;45741:689;;;;;;;;;;;45702:1268;;21937:96;21990:7;22016:10;22009:17;;21937:96;:::o;24409:187::-;24482:16;24501:6;;;;;;;;;;;24482:25;;24526:8;24517:6;;:17;;;;;;;;;;;;;;;;;;24580:8;24549:40;;24570:8;24549:40;;;;;;;;;;;;24472:124;24409:187;:::o;45702:1268::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:75:1:-;40:6;73:2;67:9;57:19;;7:75;:::o;88:117::-;197:1;194;187:12;211:117;320:1;317;310:12;334:77;371:7;400:5;389:16;;334:77;;;:::o;417:122::-;490:24;508:5;490:24;:::i;:::-;483:5;480:35;470:63;;529:1;526;519:12;470:63;417:122;:::o;545:143::-;602:5;633:6;627:13;618:22;;649:33;676:5;649:33;:::i;:::-;545:143;;;;:::o;694:126::-;731:7;771:42;764:5;760:54;749:65;;694:126;;;:::o;826:96::-;863:7;892:24;910:5;892:24;:::i;:::-;881:35;;826:96;;;:::o;928:116::-;985:7;1014:24;1032:5;1014:24;:::i;:::-;1003:35;;928:116;;;:::o;1050:162::-;1143:44;1181:5;1143:44;:::i;:::-;1136:5;1133:55;1123:83;;1202:1;1199;1192:12;1123:83;1050:162;:::o;1218:183::-;1295:5;1326:6;1320:13;1311:22;;1342:53;1389:5;1342:53;:::i;:::-;1218:183;;;;:::o;1407:125::-;1473:7;1502:24;1520:5;1502:24;:::i;:::-;1491:35;;1407:125;;;:::o;1538:180::-;1640:53;1687:5;1640:53;:::i;:::-;1633:5;1630:64;1620:92;;1708:1;1705;1698:12;1620:92;1538:180;:::o;1724:201::-;1810:5;1841:6;1835:13;1826:22;;1857:62;1913:5;1857:62;:::i;:::-;1724:201;;;;:::o;1931:110::-;1982:7;2011:24;2029:5;2011:24;:::i;:::-;2000:35;;1931:110;;;:::o;2047:150::-;2134:38;2166:5;2134:38;:::i;:::-;2127:5;2124:49;2114:77;;2187:1;2184;2177:12;2114:77;2047:150;:::o;2203:171::-;2274:5;2305:6;2299:13;2290:22;;2321:47;2362:5;2321:47;:::i;:::-;2203:171;;;;:::o;2380:112::-;2433:7;2462:24;2480:5;2462:24;:::i;:::-;2451:35;;2380:112;;;:::o;2498:154::-;2587:40;2621:5;2587:40;:::i;:::-;2580:5;2577:51;2567:79;;2642:1;2639;2632:12;2567:79;2498:154;:::o;2658:175::-;2731:5;2762:6;2756:13;2747:22;;2778:49;2821:5;2778:49;:::i;:::-;2658:175;;;;:::o;2839:117::-;2948:1;2945;2938:12;2962:117;3071:1;3068;3061:12;3085:102;3126:6;3177:2;3173:7;3168:2;3161:5;3157:14;3153:28;3143:38;;3085:102;;;:::o;3193:180::-;3241:77;3238:1;3231:88;3338:4;3335:1;3328:15;3362:4;3359:1;3352:15;3379:281;3462:27;3484:4;3462:27;:::i;:::-;3454:6;3450:40;3592:6;3580:10;3577:22;3556:18;3544:10;3541:34;3538:62;3535:88;;;3603:18;;:::i;:::-;3535:88;3643:10;3639:2;3632:22;3422:238;3379:281;;:::o;3666:129::-;3700:6;3727:20;;:::i;:::-;3717:30;;3756:33;3784:4;3776:6;3756:33;:::i;:::-;3666:129;;;:::o;3801:308::-;3863:4;3953:18;3945:6;3942:30;3939:56;;;3975:18;;:::i;:::-;3939:56;4013:29;4035:6;4013:29;:::i;:::-;4005:37;;4097:4;4091;4087:15;4079:23;;3801:308;;;:::o;4115:307::-;4183:1;4193:113;4207:6;4204:1;4201:13;4193:113;;;4292:1;4287:3;4283:11;4277:18;4273:1;4268:3;4264:11;4257:39;4229:2;4226:1;4222:10;4217:15;;4193:113;;;4324:6;4321:1;4318:13;4315:101;;;4404:1;4395:6;4390:3;4386:16;4379:27;4315:101;4164:258;4115:307;;;:::o;4428:421::-;4517:5;4542:66;4558:49;4600:6;4558:49;:::i;:::-;4542:66;:::i;:::-;4533:75;;4631:6;4624:5;4617:21;4669:4;4662:5;4658:16;4707:3;4698:6;4693:3;4689:16;4686:25;4683:112;;;4714:79;;:::i;:::-;4683:112;4804:39;4836:6;4831:3;4826;4804:39;:::i;:::-;4523:326;4428:421;;;;;:::o;4869:355::-;4936:5;4985:3;4978:4;4970:6;4966:17;4962:27;4952:122;;4993:79;;:::i;:::-;4952:122;5103:6;5097:13;5128:90;5214:3;5206:6;5199:4;5191:6;5187:17;5128:90;:::i;:::-;5119:99;;4942:282;4869:355;;;;:::o;5230:2338::-;5522:6;5530;5538;5546;5554;5562;5570;5578;5586;5594;5602:7;5652:3;5640:9;5631:7;5627:23;5623:33;5620:120;;;5659:79;;:::i;:::-;5620:120;5779:1;5804:64;5860:7;5851:6;5840:9;5836:22;5804:64;:::i;:::-;5794:74;;5750:128;5917:2;5943:64;5999:7;5990:6;5979:9;5975:22;5943:64;:::i;:::-;5933:74;;5888:129;6056:2;6082:64;6138:7;6129:6;6118:9;6114:22;6082:64;:::i;:::-;6072:74;;6027:129;6195:2;6221:64;6277:7;6268:6;6257:9;6253:22;6221:64;:::i;:::-;6211:74;;6166:129;6334:3;6361:84;6437:7;6428:6;6417:9;6413:22;6361:84;:::i;:::-;6351:94;;6305:150;6494:3;6521:93;6606:7;6597:6;6586:9;6582:22;6521:93;:::i;:::-;6511:103;;6465:159;6663:3;6690:93;6775:7;6766:6;6755:9;6751:22;6690:93;:::i;:::-;6680:103;;6634:159;6832:3;6859:78;6929:7;6920:6;6909:9;6905:22;6859:78;:::i;:::-;6849:88;;6803:144;6986:3;7013:78;7083:7;7074:6;7063:9;7059:22;7013:78;:::i;:::-;7003:88;;6957:144;7140:3;7167:80;7239:7;7230:6;7219:9;7215:22;7167:80;:::i;:::-;7157:90;;7111:146;7317:3;7306:9;7302:19;7296:26;7349:18;7341:6;7338:30;7335:117;;;7371:79;;:::i;:::-;7335:117;7477:74;7543:7;7534:6;7523:9;7519:22;7477:74;:::i;:::-;7466:85;;7267:294;5230:2338;;;;;;;;;;;;;;:::o;7574:180::-;7622:77;7619:1;7612:88;7719:4;7716:1;7709:15;7743:4;7740:1;7733:15;7760:320;7804:6;7841:1;7835:4;7831:12;7821:22;;7888:1;7882:4;7878:12;7909:18;7899:81;;7965:4;7957:6;7953:17;7943:27;;7899:81;8027:2;8019:6;8016:14;7996:18;7993:38;7990:84;;;8046:18;;:::i;:::-;7990:84;7811:269;7760:320;;;:::o;45702:1268:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"functionDebugData": {
"@_mint_2393": {
"entryPoint": 7046,
"id": 2393,
"parameterSlots": 3,
"returnSlots": 1
},
"@_msgSender_1239": {
"entryPoint": 6842,
"id": 1239,
"parameterSlots": 0,
"returnSlots": 1
},
"@_transferOwnership_1351": {
"entryPoint": 6850,
"id": 1351,
"parameterSlots": 1,
"returnSlots": 0
},
"@activeBonds_2080": {
"entryPoint": 4627,
"id": 2080,
"parameterSlots": 0,
"returnSlots": 0
},
"@amountWithoutDiscount_2282": {
"entryPoint": 6750,
"id": 2282,
"parameterSlots": 1,
"returnSlots": 1
},
"@bondActivePeriod_2067": {
"entryPoint": 6412,
"id": 2067,
"parameterSlots": 0,
"returnSlots": 0
},
"@bondAmountOut_2261": {
"entryPoint": 5347,
"id": 2261,
"parameterSlots": 1,
"returnSlots": 1
},
"@bondCounter_2073": {
"entryPoint": 4052,
"id": 2073,
"parameterSlots": 0,
"returnSlots": 0
},
"@bondLimit_2071": {
"entryPoint": 3640,
"id": 2071,
"parameterSlots": 0,
"returnSlots": 0
},
"@bondStorage_2101": {
"entryPoint": 4058,
"id": 2101,
"parameterSlots": 0,
"returnSlots": 0
},
"@bondToClaimPeriod_2069": {
"entryPoint": 5120,
"id": 2069,
"parameterSlots": 0,
"returnSlots": 0
},
"@bondType_2131": {
"entryPoint": 4761,
"id": 2131,
"parameterSlots": 0,
"returnSlots": 1
},
"@bondingWindowEndTimestamp_2193": {
"entryPoint": 5126,
"id": 2193,
"parameterSlots": 0,
"returnSlots": 1
},
"@claim_2468": {
"entryPoint": 2731,
"id": 2468,
"parameterSlots": 1,
"returnSlots": 0
},
"@discountDenominator_2061": {
"entryPoint": 6460,
"id": 2061,
"parameterSlots": 0,
"returnSlots": 0
},
"@discountNominator_2075": {
"entryPoint": 6418,
"id": 2075,
"parameterSlots": 0,
"returnSlots": 0
},
"@getStakingReward_2182": {
"entryPoint": 5505,
"id": 2182,
"parameterSlots": 1,
"returnSlots": 1
},
"@gtonAggregator_2107": {
"entryPoint": 6804,
"id": 2107,
"parameterSlots": 0,
"returnSlots": 0
},
"@gton_2095": {
"entryPoint": 6424,
"id": 2095,
"parameterSlots": 0,
"returnSlots": 0
},
"@isActiveBond_2120": {
"entryPoint": 2360,
"id": 2120,
"parameterSlots": 1,
"returnSlots": 1
},
"@isBondingActive_2300": {
"entryPoint": 4688,
"id": 2300,
"parameterSlots": 0,
"returnSlots": 1
},
"@lastBondActivation_2065": {
"entryPoint": 2354,
"id": 2065,
"parameterSlots": 0,
"returnSlots": 0
},
"@mint_2670": {
"entryPoint": 4943,
"id": 2670,
"parameterSlots": 1,
"returnSlots": 1
},
"@onERC721Received_1960": {
"entryPoint": 2324,
"id": 1960,
"parameterSlots": 4,
"returnSlots": 1
},
"@owner_1280": {
"entryPoint": 4720,
"id": 1280,
"parameterSlots": 0,
"returnSlots": 1
},
"@renounceOwnership_1308": {
"entryPoint": 4299,
"id": 1308,
"parameterSlots": 0,
"returnSlots": 0
},
"@setBondActivePeriod_2538": {
"entryPoint": 6278,
"id": 2538,
"parameterSlots": 1,
"returnSlots": 0
},
"@setBondLimit_2562": {
"entryPoint": 2190,
"id": 2562,
"parameterSlots": 1,
"returnSlots": 0
},
"@setBondToClaimPeriod_2550": {
"entryPoint": 3506,
"id": 2550,
"parameterSlots": 1,
"returnSlots": 0
},
"@setDiscountNominator_2526": {
"entryPoint": 2597,
"id": 2526,
"parameterSlots": 1,
"returnSlots": 0
},
"@setGtonAggregator_2501": {
"entryPoint": 4435,
"id": 2501,
"parameterSlots": 1,
"returnSlots": 0
},
"@setTokenAggregator_2514": {
"entryPoint": 2405,
"id": 2514,
"parameterSlots": 1,
"returnSlots": 0
},
"@sgton_2098": {
"entryPoint": 4907,
"id": 2098,
"parameterSlots": 0,
"returnSlots": 0
},
"@startBonding_2488": {
"entryPoint": 4094,
"id": 2488,
"parameterSlots": 0,
"returnSlots": 0
},
"@tokenAggregator_2104": {
"entryPoint": 6240,
"id": 2104,
"parameterSlots": 0,
"returnSlots": 0
},
"@tokenPriceAndDecimals_2218": {
"entryPoint": 7694,
"id": 2218,
"parameterSlots": 1,
"returnSlots": 2
},
"@token_2092": {
"entryPoint": 6714,
"id": 2092,
"parameterSlots": 0,
"returnSlots": 0
},
"@totalSupply_2310": {
"entryPoint": 2344,
"id": 2310,
"parameterSlots": 0,
"returnSlots": 1
},
"@transferNative_2688": {
"entryPoint": 5149,
"id": 2688,
"parameterSlots": 1,
"returnSlots": 0
},
"@transferOwnership_1331": {
"entryPoint": 6466,
"id": 1331,
"parameterSlots": 1,
"returnSlots": 0
},
"@transferToken_2586": {
"entryPoint": 3646,
"id": 2586,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_decode_available_length_t_bytes_memory_ptr": {
"entryPoint": 8401,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_decode_t_address": {
"entryPoint": 8166,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_address_payable": {
"entryPoint": 9563,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_bool_fromMemory": {
"entryPoint": 10313,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_bytes_memory_ptr": {
"entryPoint": 8467,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_contract$_AggregatorV3Interface_$263": {
"entryPoint": 8867,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_contract$_ERC20_$1936": {
"entryPoint": 8974,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_int256_fromMemory": {
"entryPoint": 12075,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint256": {
"entryPoint": 8027,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint256_fromMemory": {
"entryPoint": 10420,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint80_fromMemory": {
"entryPoint": 12021,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_t_uint8_fromMemory": {
"entryPoint": 11910,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_address": {
"entryPoint": 9749,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_address_payable": {
"entryPoint": 9584,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_addresst_addresst_uint256t_bytes_memory_ptr": {
"entryPoint": 8513,
"id": null,
"parameterSlots": 2,
"returnSlots": 4
},
"abi_decode_tuple_t_bool_fromMemory": {
"entryPoint": 10334,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_contract$_AggregatorV3Interface_$263": {
"entryPoint": 8888,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_contract$_ERC20_$1936t_address": {
"entryPoint": 8995,
"id": null,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_uint256": {
"entryPoint": 8048,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint256_fromMemory": {
"entryPoint": 10441,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_decode_tuple_t_uint80t_int256t_uint256t_uint256t_uint80_fromMemory": {
"entryPoint": 12096,
"id": null,
"parameterSlots": 2,
"returnSlots": 5
},
"abi_decode_tuple_t_uint8_fromMemory": {
"entryPoint": 11931,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_t_address_to_t_address_fromStack": {
"entryPoint": 9250,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_bool_to_t_bool_fromStack": {
"entryPoint": 8784,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_bytes4_to_t_bytes4_fromStack": {
"entryPoint": 8688,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_contract$_AggregatorV3Interface_$263_to_t_address_fromStack": {
"entryPoint": 9647,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_contract$_ERC20_$1936_to_t_address_fromStack": {
"entryPoint": 9707,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_contract$_IBondStorage_$218_to_t_address_fromStack": {
"entryPoint": 9139,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_contract$_Staking_$1228_to_t_address_fromStack": {
"entryPoint": 9480,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack": {
"entryPoint": 9371,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe_to_t_string_memory_ptr_fromStack": {
"entryPoint": 11419,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_2e5d2f8e9272cd2eecb6ea3d5317e7a6aa81f67a89163c8b38954732ef8a4d01_to_t_string_memory_ptr_fromStack": {
"entryPoint": 10954,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_481ecf275e0e796614c56002f081a16fd72c039961d22e2e174ed51c0ef179db_to_t_string_memory_ptr_fromStack": {
"entryPoint": 10565,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_5748e990c67d250090012f060a2b894ce2f18a96f4bb4cb6892c61acfb2b043f_to_t_string_memory_ptr_fromStack": {
"entryPoint": 11617,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack": {
"entryPoint": 9835,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820_to_t_string_memory_ptr_fromStack": {
"entryPoint": 9981,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa_to_t_string_memory_ptr_fromStack": {
"entryPoint": 10182,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_stringliteral_fc4401988e7caf39e97c6817d9ae57218e8ab2cccfb36150e2ee117e213b50f0_to_t_string_memory_ptr_fromStack": {
"entryPoint": 10808,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_t_uint256_to_t_uint256_fromStack": {
"entryPoint": 8730,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"abi_encode_tuple_t_address__to_t_address__fromStack_reversed": {
"entryPoint": 9265,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed": {
"entryPoint": 10048,
"id": null,
"parameterSlots": 4,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed": {
"entryPoint": 10249,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_address_t_uint256_t_uint256__to_t_address_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": 11684,
"id": null,
"parameterSlots": 4,
"returnSlots": 1
},
"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": {
"entryPoint": 8799,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_bool_t_uint256_t_uint256_t_uint256__to_t_bool_t_uint256_t_uint256_t_uint256__fromStack_reversed": {
"entryPoint": 9181,
"id": null,
"parameterSlots": 5,
"returnSlots": 1
},
"abi_encode_tuple_t_bytes4__to_t_bytes4__fromStack_reversed": {
"entryPoint": 8703,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_contract$_AggregatorV3Interface_$263__to_t_address__fromStack_reversed": {
"entryPoint": 9662,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_contract$_ERC20_$1936__to_t_address__fromStack_reversed": {
"entryPoint": 9722,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_contract$_IBondStorage_$218__to_t_address__fromStack_reversed": {
"entryPoint": 9154,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_contract$_Staking_$1228__to_t_address__fromStack_reversed": {
"entryPoint": 9495,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 9428,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 11454,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_2e5d2f8e9272cd2eecb6ea3d5317e7a6aa81f67a89163c8b38954732ef8a4d01__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 10989,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_481ecf275e0e796614c56002f081a16fd72c039961d22e2e174ed51c0ef179db__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 10600,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_5748e990c67d250090012f060a2b894ce2f18a96f4bb4cb6892c61acfb2b043f__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 11652,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 9870,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 10016,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 10217,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_stringliteral_fc4401988e7caf39e97c6817d9ae57218e8ab2cccfb36150e2ee117e213b50f0__to_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 10843,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": {
"entryPoint": 8745,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_address__to_t_uint256_t_address__fromStack_reversed": {
"entryPoint": 10379,
"id": null,
"parameterSlots": 3,
"returnSlots": 1
},
"abi_encode_tuple_t_uint256_t_uint256_t_string_memory_ptr__to_t_uint256_t_uint256_t_string_memory_ptr__fromStack_reversed": {
"entryPoint": 11812,
"id": null,
"parameterSlots": 4,
"returnSlots": 1
},
"allocate_memory": {
"entryPoint": 8310,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"allocate_unbounded": {
"entryPoint": 7974,
"id": null,
"parameterSlots": 0,
"returnSlots": 1
},
"array_allocation_size_t_bytes_memory_ptr": {
"entryPoint": 8337,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_length_t_string_memory_ptr": {
"entryPoint": 9292,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"array_storeLengthForEncoding_t_string_memory_ptr_fromStack": {
"entryPoint": 9303,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_add_t_uint256": {
"entryPoint": 11068,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_div_t_uint256": {
"entryPoint": 11291,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_mul_t_uint256": {
"entryPoint": 11154,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"checked_sub_t_uint256": {
"entryPoint": 11486,
"id": null,
"parameterSlots": 2,
"returnSlots": 1
},
"cleanup_t_address": {
"entryPoint": 8125,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_address_payable": {
"entryPoint": 9522,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_bool": {
"entryPoint": 8772,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_bytes4": {
"entryPoint": 8644,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_contract$_AggregatorV3Interface_$263": {
"entryPoint": 8826,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_contract$_ERC20_$1936": {
"entryPoint": 8933,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_int256": {
"entryPoint": 12042,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint160": {
"entryPoint": 8093,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint256": {
"entryPoint": 7994,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint8": {
"entryPoint": 11874,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"cleanup_t_uint80": {
"entryPoint": 11976,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"convert_t_contract$_AggregatorV3Interface_$263_to_t_address": {
"entryPoint": 9629,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"convert_t_contract$_ERC20_$1936_to_t_address": {
"entryPoint": 9689,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"convert_t_contract$_IBondStorage_$218_to_t_address": {
"entryPoint": 9121,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"convert_t_contract$_Staking_$1228_to_t_address": {
"entryPoint": 9462,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"convert_t_uint160_to_t_address": {
"entryPoint": 9103,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"convert_t_uint160_to_t_uint160": {
"entryPoint": 9069,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"copy_calldata_to_memory": {
"entryPoint": 8386,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"copy_memory_to_memory": {
"entryPoint": 9320,
"id": null,
"parameterSlots": 3,
"returnSlots": 0
},
"extract_byte_array_length": {
"entryPoint": 10679,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"finalize_allocation": {
"entryPoint": 8261,
"id": null,
"parameterSlots": 2,
"returnSlots": 0
},
"identity": {
"entryPoint": 9059,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"increment_t_uint256": {
"entryPoint": 11739,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"panic_error_0x11": {
"entryPoint": 11021,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x12": {
"entryPoint": 11244,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x22": {
"entryPoint": 10632,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"panic_error_0x41": {
"entryPoint": 8214,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d": {
"entryPoint": 8187,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae": {
"entryPoint": 8192,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": {
"entryPoint": 7989,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": {
"entryPoint": 7984,
"id": null,
"parameterSlots": 0,
"returnSlots": 0
},
"round_up_to_mul_of_32": {
"entryPoint": 8197,
"id": null,
"parameterSlots": 1,
"returnSlots": 1
},
"store_literal_in_memory_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe": {
"entryPoint": 11340,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_2e5d2f8e9272cd2eecb6ea3d5317e7a6aa81f67a89163c8b38954732ef8a4d01": {
"entryPoint": 10875,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_481ecf275e0e796614c56002f081a16fd72c039961d22e2e174ed51c0ef179db": {
"entryPoint": 10486,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_5748e990c67d250090012f060a2b894ce2f18a96f4bb4cb6892c61acfb2b043f": {
"entryPoint": 11538,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe": {
"entryPoint": 9794,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820": {
"entryPoint": 9902,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa": {
"entryPoint": 10103,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"store_literal_in_memory_fc4401988e7caf39e97c6817d9ae57218e8ab2cccfb36150e2ee117e213b50f0": {
"entryPoint": 10729,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_address": {
"entryPoint": 8143,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_address_payable": {
"entryPoint": 9540,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_bool": {
"entryPoint": 10290,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_contract$_AggregatorV3Interface_$263": {
"entryPoint": 8844,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_contract$_ERC20_$1936": {
"entryPoint": 8951,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_int256": {
"entryPoint": 12052,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint256": {
"entryPoint": 8004,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint8": {
"entryPoint": 11887,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
},
"validator_revert_t_uint80": {
"entryPoint": 11998,
"id": null,
"parameterSlots": 1,
"returnSlots": 0
}
},
"generatedSources": [
{
"ast": {
"nodeType": "YulBlock",
"src": "0:29852:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "47:35:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "57:19:1",
"value": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "73:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "67:5:1"
},
"nodeType": "YulFunctionCall",
"src": "67:9:1"
},
"variableNames": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "57:6:1"
}
]
}
]
},
"name": "allocate_unbounded",
"nodeType": "YulFunctionDefinition",
"returnVariables": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "40:6:1",
"type": ""
}
],
"src": "7:75:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "177:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "194:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "197:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "187:6:1"
},
"nodeType": "YulFunctionCall",
"src": "187:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "187:12:1"
}
]
},
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulFunctionDefinition",
"src": "88:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "300:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "317:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "320:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "310:6:1"
},
"nodeType": "YulFunctionCall",
"src": "310:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "310:12:1"
}
]
},
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulFunctionDefinition",
"src": "211:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "379:32:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "389:16:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "400:5:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "389:7:1"
}
]
}
]
},
"name": "cleanup_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "361:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "371:7:1",
"type": ""
}
],
"src": "334:77:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "460:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "517:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "526:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "529:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "519:6:1"
},
"nodeType": "YulFunctionCall",
"src": "519:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "519:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "483:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "508:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "490:17:1"
},
"nodeType": "YulFunctionCall",
"src": "490:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "480:2:1"
},
"nodeType": "YulFunctionCall",
"src": "480:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "473:6:1"
},
"nodeType": "YulFunctionCall",
"src": "473:43:1"
},
"nodeType": "YulIf",
"src": "470:63:1"
}
]
},
"name": "validator_revert_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "453:5:1",
"type": ""
}
],
"src": "417:122:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "597:87:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "607:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "629:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "616:12:1"
},
"nodeType": "YulFunctionCall",
"src": "616:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "607:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "672:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nodeType": "YulIdentifier",
"src": "645:26:1"
},
"nodeType": "YulFunctionCall",
"src": "645:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "645:33:1"
}
]
},
"name": "abi_decode_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "575:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "583:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "591:5:1",
"type": ""
}
],
"src": "545:139:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "756:263:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "802:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "804:77:1"
},
"nodeType": "YulFunctionCall",
"src": "804:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "804:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "777:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "786:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "773:3:1"
},
"nodeType": "YulFunctionCall",
"src": "773:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "798:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "769:3:1"
},
"nodeType": "YulFunctionCall",
"src": "769:32:1"
},
"nodeType": "YulIf",
"src": "766:119:1"
},
{
"nodeType": "YulBlock",
"src": "895:117:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "910:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "924:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "914:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "939:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "974:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "985:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "970:3:1"
},
"nodeType": "YulFunctionCall",
"src": "970:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "994:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256",
"nodeType": "YulIdentifier",
"src": "949:20:1"
},
"nodeType": "YulFunctionCall",
"src": "949:53:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "939:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_uint256",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "726:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "737:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "749:6:1",
"type": ""
}
],
"src": "690:329:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1070:81:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1080:65:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1095:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1102:42:1",
"type": "",
"value": "0xffffffffffffffffffffffffffffffffffffffff"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "1091:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1091:54:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1080:7:1"
}
]
}
]
},
"name": "cleanup_t_uint160",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1052:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1062:7:1",
"type": ""
}
],
"src": "1025:126:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1202:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1212:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1241:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "1223:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1223:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "1212:7:1"
}
]
}
]
},
"name": "cleanup_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1184:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "1194:7:1",
"type": ""
}
],
"src": "1157:96:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1302:79:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "1359:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1368:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1371:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1361:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1361:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1361:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1325:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1350:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "1332:17:1"
},
"nodeType": "YulFunctionCall",
"src": "1332:24:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "1322:2:1"
},
"nodeType": "YulFunctionCall",
"src": "1322:35:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "1315:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1315:43:1"
},
"nodeType": "YulIf",
"src": "1312:63:1"
}
]
},
"name": "validator_revert_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1295:5:1",
"type": ""
}
],
"src": "1259:122:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1439:87:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1449:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "1471:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "1458:12:1"
},
"nodeType": "YulFunctionCall",
"src": "1458:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1449:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1514:5:1"
}
],
"functionName": {
"name": "validator_revert_t_address",
"nodeType": "YulIdentifier",
"src": "1487:26:1"
},
"nodeType": "YulFunctionCall",
"src": "1487:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "1487:33:1"
}
]
},
"name": "abi_decode_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "1417:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "1425:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1433:5:1",
"type": ""
}
],
"src": "1387:139:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1621:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1638:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1641:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1631:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1631:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1631:12:1"
}
]
},
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nodeType": "YulFunctionDefinition",
"src": "1532:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1744:28:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1761:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1764:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "1754:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1754:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "1754:12:1"
}
]
},
"name": "revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae",
"nodeType": "YulFunctionDefinition",
"src": "1655:117:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1826:54:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "1836:38:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "1854:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1861:2:1",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "1850:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1850:14:1"
},
{
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1870:2:1",
"type": "",
"value": "31"
}
],
"functionName": {
"name": "not",
"nodeType": "YulIdentifier",
"src": "1866:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1866:7:1"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "1846:3:1"
},
"nodeType": "YulFunctionCall",
"src": "1846:28:1"
},
"variableNames": [
{
"name": "result",
"nodeType": "YulIdentifier",
"src": "1836:6:1"
}
]
}
]
},
"name": "round_up_to_mul_of_32",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "1809:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "result",
"nodeType": "YulTypedName",
"src": "1819:6:1",
"type": ""
}
],
"src": "1778:102:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "1914:152:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1931:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "1934:77:1",
"type": "",
"value": "35408467139433450592217433187231851964531694900788300625387963629091585785856"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "1924:6:1"
},
"nodeType": "YulFunctionCall",
"src": "1924:88:1"
},
"nodeType": "YulExpressionStatement",
"src": "1924:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2028:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2031:4:1",
"type": "",
"value": "0x41"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "2021:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2021:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "2021:15:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2052:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2055:4:1",
"type": "",
"value": "0x24"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "2045:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2045:15:1"
},
"nodeType": "YulExpressionStatement",
"src": "2045:15:1"
}
]
},
"name": "panic_error_0x41",
"nodeType": "YulFunctionDefinition",
"src": "1886:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2115:238:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "2125:58:1",
"value": {
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "2147:6:1"
},
{
"arguments": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "2177:4:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nodeType": "YulIdentifier",
"src": "2155:21:1"
},
"nodeType": "YulFunctionCall",
"src": "2155:27:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "2143:3:1"
},
"nodeType": "YulFunctionCall",
"src": "2143:40:1"
},
"variables": [
{
"name": "newFreePtr",
"nodeType": "YulTypedName",
"src": "2129:10:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "2294:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nodeType": "YulIdentifier",
"src": "2296:16:1"
},
"nodeType": "YulFunctionCall",
"src": "2296:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "2296:18:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "newFreePtr",
"nodeType": "YulIdentifier",
"src": "2237:10:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2249:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "2234:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2234:34:1"
},
{
"arguments": [
{
"name": "newFreePtr",
"nodeType": "YulIdentifier",
"src": "2273:10:1"
},
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "2285:6:1"
}
],
"functionName": {
"name": "lt",
"nodeType": "YulIdentifier",
"src": "2270:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2270:22:1"
}
],
"functionName": {
"name": "or",
"nodeType": "YulIdentifier",
"src": "2231:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2231:62:1"
},
"nodeType": "YulIf",
"src": "2228:88:1"
},
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2332:2:1",
"type": "",
"value": "64"
},
{
"name": "newFreePtr",
"nodeType": "YulIdentifier",
"src": "2336:10:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "2325:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2325:22:1"
},
"nodeType": "YulExpressionStatement",
"src": "2325:22:1"
}
]
},
"name": "finalize_allocation",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "2101:6:1",
"type": ""
},
{
"name": "size",
"nodeType": "YulTypedName",
"src": "2109:4:1",
"type": ""
}
],
"src": "2072:281:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2400:88:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "2410:30:1",
"value": {
"arguments": [],
"functionName": {
"name": "allocate_unbounded",
"nodeType": "YulIdentifier",
"src": "2420:18:1"
},
"nodeType": "YulFunctionCall",
"src": "2420:20:1"
},
"variableNames": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "2410:6:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "2469:6:1"
},
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "2477:4:1"
}
],
"functionName": {
"name": "finalize_allocation",
"nodeType": "YulIdentifier",
"src": "2449:19:1"
},
"nodeType": "YulFunctionCall",
"src": "2449:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "2449:33:1"
}
]
},
"name": "allocate_memory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "size",
"nodeType": "YulTypedName",
"src": "2384:4:1",
"type": ""
}
],
"returnVariables": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "2393:6:1",
"type": ""
}
],
"src": "2359:129:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2560:241:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "2665:22:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "panic_error_0x41",
"nodeType": "YulIdentifier",
"src": "2667:16:1"
},
"nodeType": "YulFunctionCall",
"src": "2667:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "2667:18:1"
}
]
},
"condition": {
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "2637:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2645:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "2634:2:1"
},
"nodeType": "YulFunctionCall",
"src": "2634:30:1"
},
"nodeType": "YulIf",
"src": "2631:56:1"
},
{
"nodeType": "YulAssignment",
"src": "2697:37:1",
"value": {
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "2727:6:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nodeType": "YulIdentifier",
"src": "2705:21:1"
},
"nodeType": "YulFunctionCall",
"src": "2705:29:1"
},
"variableNames": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "2697:4:1"
}
]
},
{
"nodeType": "YulAssignment",
"src": "2771:23:1",
"value": {
"arguments": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "2783:4:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2789:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "2779:3:1"
},
"nodeType": "YulFunctionCall",
"src": "2779:15:1"
},
"variableNames": [
{
"name": "size",
"nodeType": "YulIdentifier",
"src": "2771:4:1"
}
]
}
]
},
"name": "array_allocation_size_t_bytes_memory_ptr",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "2544:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "size",
"nodeType": "YulTypedName",
"src": "2555:4:1",
"type": ""
}
],
"src": "2494:307:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "2858:103:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "2881:3:1"
},
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "2886:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "2891:6:1"
}
],
"functionName": {
"name": "calldatacopy",
"nodeType": "YulIdentifier",
"src": "2868:12:1"
},
"nodeType": "YulFunctionCall",
"src": "2868:30:1"
},
"nodeType": "YulExpressionStatement",
"src": "2868:30:1"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "2939:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "2944:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "2935:3:1"
},
"nodeType": "YulFunctionCall",
"src": "2935:16:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "2953:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "2928:6:1"
},
"nodeType": "YulFunctionCall",
"src": "2928:27:1"
},
"nodeType": "YulExpressionStatement",
"src": "2928:27:1"
}
]
},
"name": "copy_calldata_to_memory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nodeType": "YulTypedName",
"src": "2840:3:1",
"type": ""
},
{
"name": "dst",
"nodeType": "YulTypedName",
"src": "2845:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "2850:6:1",
"type": ""
}
],
"src": "2807:154:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3050:327:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "3060:74:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "3126:6:1"
}
],
"functionName": {
"name": "array_allocation_size_t_bytes_memory_ptr",
"nodeType": "YulIdentifier",
"src": "3085:40:1"
},
"nodeType": "YulFunctionCall",
"src": "3085:48:1"
}
],
"functionName": {
"name": "allocate_memory",
"nodeType": "YulIdentifier",
"src": "3069:15:1"
},
"nodeType": "YulFunctionCall",
"src": "3069:65:1"
},
"variableNames": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "3060:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "3150:5:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "3157:6:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "3143:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3143:21:1"
},
"nodeType": "YulExpressionStatement",
"src": "3143:21:1"
},
{
"nodeType": "YulVariableDeclaration",
"src": "3173:27:1",
"value": {
"arguments": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "3188:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3195:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "3184:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3184:16:1"
},
"variables": [
{
"name": "dst",
"nodeType": "YulTypedName",
"src": "3177:3:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "3238:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae",
"nodeType": "YulIdentifier",
"src": "3240:77:1"
},
"nodeType": "YulFunctionCall",
"src": "3240:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "3240:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "3219:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "3224:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "3215:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3215:16:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "3233:3:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "3212:2:1"
},
"nodeType": "YulFunctionCall",
"src": "3212:25:1"
},
"nodeType": "YulIf",
"src": "3209:112:1"
},
{
"expression": {
"arguments": [
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "3354:3:1"
},
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "3359:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "3364:6:1"
}
],
"functionName": {
"name": "copy_calldata_to_memory",
"nodeType": "YulIdentifier",
"src": "3330:23:1"
},
"nodeType": "YulFunctionCall",
"src": "3330:41:1"
},
"nodeType": "YulExpressionStatement",
"src": "3330:41:1"
}
]
},
"name": "abi_decode_available_length_t_bytes_memory_ptr",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nodeType": "YulTypedName",
"src": "3023:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "3028:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "3036:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nodeType": "YulTypedName",
"src": "3044:5:1",
"type": ""
}
],
"src": "2967:410:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3457:277:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "3506:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d",
"nodeType": "YulIdentifier",
"src": "3508:77:1"
},
"nodeType": "YulFunctionCall",
"src": "3508:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "3508:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "3485:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3493:4:1",
"type": "",
"value": "0x1f"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "3481:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3481:17:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "3500:3:1"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "3477:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3477:27:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "3470:6:1"
},
"nodeType": "YulFunctionCall",
"src": "3470:35:1"
},
"nodeType": "YulIf",
"src": "3467:122:1"
},
{
"nodeType": "YulVariableDeclaration",
"src": "3598:34:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "3625:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "3612:12:1"
},
"nodeType": "YulFunctionCall",
"src": "3612:20:1"
},
"variables": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "3602:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "3641:87:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "3701:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3709:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "3697:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3697:17:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "3716:6:1"
},
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "3724:3:1"
}
],
"functionName": {
"name": "abi_decode_available_length_t_bytes_memory_ptr",
"nodeType": "YulIdentifier",
"src": "3650:46:1"
},
"nodeType": "YulFunctionCall",
"src": "3650:78:1"
},
"variableNames": [
{
"name": "array",
"nodeType": "YulIdentifier",
"src": "3641:5:1"
}
]
}
]
},
"name": "abi_decode_t_bytes_memory_ptr",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "3435:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "3443:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "array",
"nodeType": "YulTypedName",
"src": "3451:5:1",
"type": ""
}
],
"src": "3396:338:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "3866:817:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "3913:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "3915:77:1"
},
"nodeType": "YulFunctionCall",
"src": "3915:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "3915:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "3887:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "3896:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "3883:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3883:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "3908:3:1",
"type": "",
"value": "128"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "3879:3:1"
},
"nodeType": "YulFunctionCall",
"src": "3879:33:1"
},
"nodeType": "YulIf",
"src": "3876:120:1"
},
{
"nodeType": "YulBlock",
"src": "4006:117:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "4021:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "4035:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "4025:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "4050:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "4085:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "4096:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4081:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4081:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "4105:7:1"
}
],
"functionName": {
"name": "abi_decode_t_address",
"nodeType": "YulIdentifier",
"src": "4060:20:1"
},
"nodeType": "YulFunctionCall",
"src": "4060:53:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "4050:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "4133:118:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "4148:16:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "4162:2:1",
"type": "",
"value": "32"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "4152:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "4178:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "4213:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "4224:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4209:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4209:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "4233:7:1"
}
],
"functionName": {
"name": "abi_decode_t_address",
"nodeType": "YulIdentifier",
"src": "4188:20:1"
},
"nodeType": "YulFunctionCall",
"src": "4188:53:1"
},
"variableNames": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "4178:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "4261:118:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "4276:16:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "4290:2:1",
"type": "",
"value": "64"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "4280:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "4306:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "4341:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "4352:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4337:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4337:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "4361:7:1"
}
],
"functionName": {
"name": "abi_decode_t_uint256",
"nodeType": "YulIdentifier",
"src": "4316:20:1"
},
"nodeType": "YulFunctionCall",
"src": "4316:53:1"
},
"variableNames": [
{
"name": "value2",
"nodeType": "YulIdentifier",
"src": "4306:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "4389:287:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "4404:46:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "4435:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4446:2:1",
"type": "",
"value": "96"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4431:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4431:18:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "4418:12:1"
},
"nodeType": "YulFunctionCall",
"src": "4418:32:1"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "4408:6:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "4497:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db",
"nodeType": "YulIdentifier",
"src": "4499:77:1"
},
"nodeType": "YulFunctionCall",
"src": "4499:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "4499:79:1"
}
]
},
"condition": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "4469:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4477:18:1",
"type": "",
"value": "0xffffffffffffffff"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "4466:2:1"
},
"nodeType": "YulFunctionCall",
"src": "4466:30:1"
},
"nodeType": "YulIf",
"src": "4463:117:1"
},
{
"nodeType": "YulAssignment",
"src": "4594:72:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "4638:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "4649:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "4634:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4634:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "4658:7:1"
}
],
"functionName": {
"name": "abi_decode_t_bytes_memory_ptr",
"nodeType": "YulIdentifier",
"src": "4604:29:1"
},
"nodeType": "YulFunctionCall",
"src": "4604:62:1"
},
"variableNames": [
{
"name": "value3",
"nodeType": "YulIdentifier",
"src": "4594:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_addresst_addresst_uint256t_bytes_memory_ptr",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "3812:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "3823:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "3835:6:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "3843:6:1",
"type": ""
},
{
"name": "value2",
"nodeType": "YulTypedName",
"src": "3851:6:1",
"type": ""
},
{
"name": "value3",
"nodeType": "YulTypedName",
"src": "3859:6:1",
"type": ""
}
],
"src": "3740:943:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "4733:105:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "4743:89:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "4758:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "4765:66:1",
"type": "",
"value": "0xffffffff00000000000000000000000000000000000000000000000000000000"
}
],
"functionName": {
"name": "and",
"nodeType": "YulIdentifier",
"src": "4754:3:1"
},
"nodeType": "YulFunctionCall",
"src": "4754:78:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "4743:7:1"
}
]
}
]
},
"name": "cleanup_t_bytes4",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "4715:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "4725:7:1",
"type": ""
}
],
"src": "4689:149:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "4907:52:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "4924:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "4946:5:1"
}
],
"functionName": {
"name": "cleanup_t_bytes4",
"nodeType": "YulIdentifier",
"src": "4929:16:1"
},
"nodeType": "YulFunctionCall",
"src": "4929:23:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "4917:6:1"
},
"nodeType": "YulFunctionCall",
"src": "4917:36:1"
},
"nodeType": "YulExpressionStatement",
"src": "4917:36:1"
}
]
},
"name": "abi_encode_t_bytes4_to_t_bytes4_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "4895:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "4902:3:1",
"type": ""
}
],
"src": "4844:115:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5061:122:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "5071:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5083:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5094:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5079:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5079:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "5071:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "5149:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5162:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5173:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5158:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5158:17:1"
}
],
"functionName": {
"name": "abi_encode_t_bytes4_to_t_bytes4_fromStack",
"nodeType": "YulIdentifier",
"src": "5107:41:1"
},
"nodeType": "YulFunctionCall",
"src": "5107:69:1"
},
"nodeType": "YulExpressionStatement",
"src": "5107:69:1"
}
]
},
"name": "abi_encode_tuple_t_bytes4__to_t_bytes4__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "5033:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "5045:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "5056:4:1",
"type": ""
}
],
"src": "4965:218:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5254:53:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "5271:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "5294:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint256",
"nodeType": "YulIdentifier",
"src": "5276:17:1"
},
"nodeType": "YulFunctionCall",
"src": "5276:24:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "5264:6:1"
},
"nodeType": "YulFunctionCall",
"src": "5264:37:1"
},
"nodeType": "YulExpressionStatement",
"src": "5264:37:1"
}
]
},
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "5242:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "5249:3:1",
"type": ""
}
],
"src": "5189:118:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5411:124:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "5421:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5433:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5444:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5429:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5429:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "5421:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "5501:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5514:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5525:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5510:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5510:17:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "5457:43:1"
},
"nodeType": "YulFunctionCall",
"src": "5457:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "5457:71:1"
}
]
},
"name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "5383:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "5395:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "5406:4:1",
"type": ""
}
],
"src": "5313:222:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5583:48:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "5593:32:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "5618:5:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "5611:6:1"
},
"nodeType": "YulFunctionCall",
"src": "5611:13:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "5604:6:1"
},
"nodeType": "YulFunctionCall",
"src": "5604:21:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "5593:7:1"
}
]
}
]
},
"name": "cleanup_t_bool",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "5565:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "5575:7:1",
"type": ""
}
],
"src": "5541:90:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5696:50:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "5713:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "5733:5:1"
}
],
"functionName": {
"name": "cleanup_t_bool",
"nodeType": "YulIdentifier",
"src": "5718:14:1"
},
"nodeType": "YulFunctionCall",
"src": "5718:21:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "5706:6:1"
},
"nodeType": "YulFunctionCall",
"src": "5706:34:1"
},
"nodeType": "YulExpressionStatement",
"src": "5706:34:1"
}
]
},
"name": "abi_encode_t_bool_to_t_bool_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "5684:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "5691:3:1",
"type": ""
}
],
"src": "5637:109:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "5844:118:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "5854:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5866:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5877:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5862:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5862:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "5854:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "5928:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "5941:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "5952:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "5937:3:1"
},
"nodeType": "YulFunctionCall",
"src": "5937:17:1"
}
],
"functionName": {
"name": "abi_encode_t_bool_to_t_bool_fromStack",
"nodeType": "YulIdentifier",
"src": "5890:37:1"
},
"nodeType": "YulFunctionCall",
"src": "5890:65:1"
},
"nodeType": "YulExpressionStatement",
"src": "5890:65:1"
}
]
},
"name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "5816:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "5828:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "5839:4:1",
"type": ""
}
],
"src": "5752:210:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "6042:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "6052:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "6081:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "6063:17:1"
},
"nodeType": "YulFunctionCall",
"src": "6063:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "6052:7:1"
}
]
}
]
},
"name": "cleanup_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "6024:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "6034:7:1",
"type": ""
}
],
"src": "5968:125:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "6171:108:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "6257:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "6266:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "6269:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "6259:6:1"
},
"nodeType": "YulFunctionCall",
"src": "6259:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "6259:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "6194:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "6248:5:1"
}
],
"functionName": {
"name": "cleanup_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulIdentifier",
"src": "6201:46:1"
},
"nodeType": "YulFunctionCall",
"src": "6201:53:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "6191:2:1"
},
"nodeType": "YulFunctionCall",
"src": "6191:64:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "6184:6:1"
},
"nodeType": "YulFunctionCall",
"src": "6184:72:1"
},
"nodeType": "YulIf",
"src": "6181:92:1"
}
]
},
"name": "validator_revert_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "6164:5:1",
"type": ""
}
],
"src": "6099:180:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "6366:116:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "6376:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6398:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "6385:12:1"
},
"nodeType": "YulFunctionCall",
"src": "6385:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "6376:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "6470:5:1"
}
],
"functionName": {
"name": "validator_revert_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulIdentifier",
"src": "6414:55:1"
},
"nodeType": "YulFunctionCall",
"src": "6414:62:1"
},
"nodeType": "YulExpressionStatement",
"src": "6414:62:1"
}
]
},
"name": "abi_decode_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6344:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "6352:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "6360:5:1",
"type": ""
}
],
"src": "6285:197:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "6583:292:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "6629:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "6631:77:1"
},
"nodeType": "YulFunctionCall",
"src": "6631:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "6631:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6604:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6613:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "6600:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6600:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "6625:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "6596:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6596:32:1"
},
"nodeType": "YulIf",
"src": "6593:119:1"
},
{
"nodeType": "YulBlock",
"src": "6722:146:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "6737:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "6751:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "6741:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "6766:92:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "6830:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "6841:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "6826:3:1"
},
"nodeType": "YulFunctionCall",
"src": "6826:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "6850:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulIdentifier",
"src": "6776:49:1"
},
"nodeType": "YulFunctionCall",
"src": "6776:82:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "6766:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_contract$_AggregatorV3Interface_$263",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "6553:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "6564:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "6576:6:1",
"type": ""
}
],
"src": "6488:387:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "6940:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "6950:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "6979:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "6961:17:1"
},
"nodeType": "YulFunctionCall",
"src": "6961:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "6950:7:1"
}
]
}
]
},
"name": "cleanup_t_contract$_ERC20_$1936",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "6922:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "6932:7:1",
"type": ""
}
],
"src": "6881:110:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7054:93:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "7125:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7134:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7137:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "7127:6:1"
},
"nodeType": "YulFunctionCall",
"src": "7127:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "7127:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "7077:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "7116:5:1"
}
],
"functionName": {
"name": "cleanup_t_contract$_ERC20_$1936",
"nodeType": "YulIdentifier",
"src": "7084:31:1"
},
"nodeType": "YulFunctionCall",
"src": "7084:38:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "7074:2:1"
},
"nodeType": "YulFunctionCall",
"src": "7074:49:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "7067:6:1"
},
"nodeType": "YulFunctionCall",
"src": "7067:57:1"
},
"nodeType": "YulIf",
"src": "7064:77:1"
}
]
},
"name": "validator_revert_t_contract$_ERC20_$1936",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "7047:5:1",
"type": ""
}
],
"src": "6997:150:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7219:101:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "7229:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7251:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "7238:12:1"
},
"nodeType": "YulFunctionCall",
"src": "7238:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "7229:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "7308:5:1"
}
],
"functionName": {
"name": "validator_revert_t_contract$_ERC20_$1936",
"nodeType": "YulIdentifier",
"src": "7267:40:1"
},
"nodeType": "YulFunctionCall",
"src": "7267:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "7267:47:1"
}
]
},
"name": "abi_decode_t_contract$_ERC20_$1936",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "7197:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "7205:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "7213:5:1",
"type": ""
}
],
"src": "7153:167:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7423:405:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "7469:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "7471:77:1"
},
"nodeType": "YulFunctionCall",
"src": "7471:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "7471:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "7444:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7453:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "7440:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7440:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "7465:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "7436:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7436:32:1"
},
"nodeType": "YulIf",
"src": "7433:119:1"
},
{
"nodeType": "YulBlock",
"src": "7562:131:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "7577:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "7591:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "7581:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "7606:77:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7655:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7666:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "7651:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7651:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "7675:7:1"
}
],
"functionName": {
"name": "abi_decode_t_contract$_ERC20_$1936",
"nodeType": "YulIdentifier",
"src": "7616:34:1"
},
"nodeType": "YulFunctionCall",
"src": "7616:67:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "7606:6:1"
}
]
}
]
},
{
"nodeType": "YulBlock",
"src": "7703:118:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "7718:16:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "7732:2:1",
"type": "",
"value": "32"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "7722:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "7748:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "7783:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "7794:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "7779:3:1"
},
"nodeType": "YulFunctionCall",
"src": "7779:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "7803:7:1"
}
],
"functionName": {
"name": "abi_decode_t_address",
"nodeType": "YulIdentifier",
"src": "7758:20:1"
},
"nodeType": "YulFunctionCall",
"src": "7758:53:1"
},
"variableNames": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "7748:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_contract$_ERC20_$1936t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "7385:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "7396:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "7408:6:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "7416:6:1",
"type": ""
}
],
"src": "7326:502:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7866:28:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "7876:12:1",
"value": {
"name": "value",
"nodeType": "YulIdentifier",
"src": "7883:5:1"
},
"variableNames": [
{
"name": "ret",
"nodeType": "YulIdentifier",
"src": "7876:3:1"
}
]
}
]
},
"name": "identity",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "7852:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "ret",
"nodeType": "YulTypedName",
"src": "7862:3:1",
"type": ""
}
],
"src": "7834:60:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "7960:82:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "7970:66:1",
"value": {
"arguments": [
{
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "8028:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "8010:17:1"
},
"nodeType": "YulFunctionCall",
"src": "8010:24:1"
}
],
"functionName": {
"name": "identity",
"nodeType": "YulIdentifier",
"src": "8001:8:1"
},
"nodeType": "YulFunctionCall",
"src": "8001:34:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "7983:17:1"
},
"nodeType": "YulFunctionCall",
"src": "7983:53:1"
},
"variableNames": [
{
"name": "converted",
"nodeType": "YulIdentifier",
"src": "7970:9:1"
}
]
}
]
},
"name": "convert_t_uint160_to_t_uint160",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "7940:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "converted",
"nodeType": "YulTypedName",
"src": "7950:9:1",
"type": ""
}
],
"src": "7900:142:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "8108:66:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "8118:50:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "8162:5:1"
}
],
"functionName": {
"name": "convert_t_uint160_to_t_uint160",
"nodeType": "YulIdentifier",
"src": "8131:30:1"
},
"nodeType": "YulFunctionCall",
"src": "8131:37:1"
},
"variableNames": [
{
"name": "converted",
"nodeType": "YulIdentifier",
"src": "8118:9:1"
}
]
}
]
},
"name": "convert_t_uint160_to_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "8088:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "converted",
"nodeType": "YulTypedName",
"src": "8098:9:1",
"type": ""
}
],
"src": "8048:126:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "8260:66:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "8270:50:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "8314:5:1"
}
],
"functionName": {
"name": "convert_t_uint160_to_t_address",
"nodeType": "YulIdentifier",
"src": "8283:30:1"
},
"nodeType": "YulFunctionCall",
"src": "8283:37:1"
},
"variableNames": [
{
"name": "converted",
"nodeType": "YulIdentifier",
"src": "8270:9:1"
}
]
}
]
},
"name": "convert_t_contract$_IBondStorage_$218_to_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "8240:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "converted",
"nodeType": "YulTypedName",
"src": "8250:9:1",
"type": ""
}
],
"src": "8180:146:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "8417:86:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "8434:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "8490:5:1"
}
],
"functionName": {
"name": "convert_t_contract$_IBondStorage_$218_to_t_address",
"nodeType": "YulIdentifier",
"src": "8439:50:1"
},
"nodeType": "YulFunctionCall",
"src": "8439:57:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "8427:6:1"
},
"nodeType": "YulFunctionCall",
"src": "8427:70:1"
},
"nodeType": "YulExpressionStatement",
"src": "8427:70:1"
}
]
},
"name": "abi_encode_t_contract$_IBondStorage_$218_to_t_address_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "8405:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "8412:3:1",
"type": ""
}
],
"src": "8332:171:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "8627:144:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "8637:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "8649:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "8660:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "8645:3:1"
},
"nodeType": "YulFunctionCall",
"src": "8645:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "8637:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "8737:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "8750:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "8761:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "8746:3:1"
},
"nodeType": "YulFunctionCall",
"src": "8746:17:1"
}
],
"functionName": {
"name": "abi_encode_t_contract$_IBondStorage_$218_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "8673:63:1"
},
"nodeType": "YulFunctionCall",
"src": "8673:91:1"
},
"nodeType": "YulExpressionStatement",
"src": "8673:91:1"
}
]
},
"name": "abi_encode_tuple_t_contract$_IBondStorage_$218__to_t_address__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "8599:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "8611:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "8622:4:1",
"type": ""
}
],
"src": "8509:262:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "8953:365:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "8963:27:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "8975:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "8986:3:1",
"type": "",
"value": "128"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "8971:3:1"
},
"nodeType": "YulFunctionCall",
"src": "8971:19:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "8963:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "9038:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "9051:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9062:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9047:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9047:17:1"
}
],
"functionName": {
"name": "abi_encode_t_bool_to_t_bool_fromStack",
"nodeType": "YulIdentifier",
"src": "9000:37:1"
},
"nodeType": "YulFunctionCall",
"src": "9000:65:1"
},
"nodeType": "YulExpressionStatement",
"src": "9000:65:1"
},
{
"expression": {
"arguments": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "9119:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "9132:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9143:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9128:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9128:18:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "9075:43:1"
},
"nodeType": "YulFunctionCall",
"src": "9075:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "9075:72:1"
},
{
"expression": {
"arguments": [
{
"name": "value2",
"nodeType": "YulIdentifier",
"src": "9201:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "9214:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9225:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9210:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9210:18:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "9157:43:1"
},
"nodeType": "YulFunctionCall",
"src": "9157:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "9157:72:1"
},
{
"expression": {
"arguments": [
{
"name": "value3",
"nodeType": "YulIdentifier",
"src": "9283:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "9296:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9307:2:1",
"type": "",
"value": "96"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9292:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9292:18:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "9239:43:1"
},
"nodeType": "YulFunctionCall",
"src": "9239:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "9239:72:1"
}
]
},
"name": "abi_encode_tuple_t_bool_t_uint256_t_uint256_t_uint256__to_t_bool_t_uint256_t_uint256_t_uint256__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "8901:9:1",
"type": ""
},
{
"name": "value3",
"nodeType": "YulTypedName",
"src": "8913:6:1",
"type": ""
},
{
"name": "value2",
"nodeType": "YulTypedName",
"src": "8921:6:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "8929:6:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "8937:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "8948:4:1",
"type": ""
}
],
"src": "8777:541:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "9389:53:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "9406:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "9429:5:1"
}
],
"functionName": {
"name": "cleanup_t_address",
"nodeType": "YulIdentifier",
"src": "9411:17:1"
},
"nodeType": "YulFunctionCall",
"src": "9411:24:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "9399:6:1"
},
"nodeType": "YulFunctionCall",
"src": "9399:37:1"
},
"nodeType": "YulExpressionStatement",
"src": "9399:37:1"
}
]
},
"name": "abi_encode_t_address_to_t_address_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "9377:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "9384:3:1",
"type": ""
}
],
"src": "9324:118:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "9546:124:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "9556:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "9568:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9579:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9564:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9564:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "9556:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "9636:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "9649:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9660:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9645:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9645:17:1"
}
],
"functionName": {
"name": "abi_encode_t_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "9592:43:1"
},
"nodeType": "YulFunctionCall",
"src": "9592:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "9592:71:1"
}
]
},
"name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "9518:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "9530:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "9541:4:1",
"type": ""
}
],
"src": "9448:222:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "9735:40:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "9746:22:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "9762:5:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "9756:5:1"
},
"nodeType": "YulFunctionCall",
"src": "9756:12:1"
},
"variableNames": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "9746:6:1"
}
]
}
]
},
"name": "array_length_t_string_memory_ptr",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "9718:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "9728:6:1",
"type": ""
}
],
"src": "9676:99:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "9877:73:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "9894:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "9899:6:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "9887:6:1"
},
"nodeType": "YulFunctionCall",
"src": "9887:19:1"
},
"nodeType": "YulExpressionStatement",
"src": "9887:19:1"
},
{
"nodeType": "YulAssignment",
"src": "9915:29:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "9934:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "9939:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "9930:3:1"
},
"nodeType": "YulFunctionCall",
"src": "9930:14:1"
},
"variableNames": [
{
"name": "updated_pos",
"nodeType": "YulIdentifier",
"src": "9915:11:1"
}
]
}
]
},
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "9849:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "9854:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "updated_pos",
"nodeType": "YulTypedName",
"src": "9865:11:1",
"type": ""
}
],
"src": "9781:169:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "10005:258:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "10015:10:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "10024:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "i",
"nodeType": "YulTypedName",
"src": "10019:1:1",
"type": ""
}
]
},
{
"body": {
"nodeType": "YulBlock",
"src": "10084:63:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "10109:3:1"
},
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "10114:1:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10105:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10105:11:1"
},
{
"arguments": [
{
"arguments": [
{
"name": "src",
"nodeType": "YulIdentifier",
"src": "10128:3:1"
},
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "10133:1:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10124:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10124:11:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "10118:5:1"
},
"nodeType": "YulFunctionCall",
"src": "10118:18:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "10098:6:1"
},
"nodeType": "YulFunctionCall",
"src": "10098:39:1"
},
"nodeType": "YulExpressionStatement",
"src": "10098:39:1"
}
]
},
"condition": {
"arguments": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "10045:1:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "10048:6:1"
}
],
"functionName": {
"name": "lt",
"nodeType": "YulIdentifier",
"src": "10042:2:1"
},
"nodeType": "YulFunctionCall",
"src": "10042:13:1"
},
"nodeType": "YulForLoop",
"post": {
"nodeType": "YulBlock",
"src": "10056:19:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "10058:15:1",
"value": {
"arguments": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "10067:1:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "10070:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10063:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10063:10:1"
},
"variableNames": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "10058:1:1"
}
]
}
]
},
"pre": {
"nodeType": "YulBlock",
"src": "10038:3:1",
"statements": []
},
"src": "10034:113:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "10181:76:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "dst",
"nodeType": "YulIdentifier",
"src": "10231:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "10236:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10227:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10227:16:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "10245:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "10220:6:1"
},
"nodeType": "YulFunctionCall",
"src": "10220:27:1"
},
"nodeType": "YulExpressionStatement",
"src": "10220:27:1"
}
]
},
"condition": {
"arguments": [
{
"name": "i",
"nodeType": "YulIdentifier",
"src": "10162:1:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "10165:6:1"
}
],
"functionName": {
"name": "gt",
"nodeType": "YulIdentifier",
"src": "10159:2:1"
},
"nodeType": "YulFunctionCall",
"src": "10159:13:1"
},
"nodeType": "YulIf",
"src": "10156:101:1"
}
]
},
"name": "copy_memory_to_memory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "src",
"nodeType": "YulTypedName",
"src": "9987:3:1",
"type": ""
},
{
"name": "dst",
"nodeType": "YulTypedName",
"src": "9992:3:1",
"type": ""
},
{
"name": "length",
"nodeType": "YulTypedName",
"src": "9997:6:1",
"type": ""
}
],
"src": "9956:307:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "10361:272:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "10371:53:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "10418:5:1"
}
],
"functionName": {
"name": "array_length_t_string_memory_ptr",
"nodeType": "YulIdentifier",
"src": "10385:32:1"
},
"nodeType": "YulFunctionCall",
"src": "10385:39:1"
},
"variables": [
{
"name": "length",
"nodeType": "YulTypedName",
"src": "10375:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "10433:78:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "10499:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "10504:6:1"
}
],
"functionName": {
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "10440:58:1"
},
"nodeType": "YulFunctionCall",
"src": "10440:71:1"
},
"variableNames": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "10433:3:1"
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "10546:5:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "10553:4:1",
"type": "",
"value": "0x20"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10542:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10542:16:1"
},
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "10560:3:1"
},
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "10565:6:1"
}
],
"functionName": {
"name": "copy_memory_to_memory",
"nodeType": "YulIdentifier",
"src": "10520:21:1"
},
"nodeType": "YulFunctionCall",
"src": "10520:52:1"
},
"nodeType": "YulExpressionStatement",
"src": "10520:52:1"
},
{
"nodeType": "YulAssignment",
"src": "10581:46:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "10592:3:1"
},
{
"arguments": [
{
"name": "length",
"nodeType": "YulIdentifier",
"src": "10619:6:1"
}
],
"functionName": {
"name": "round_up_to_mul_of_32",
"nodeType": "YulIdentifier",
"src": "10597:21:1"
},
"nodeType": "YulFunctionCall",
"src": "10597:29:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10588:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10588:39:1"
},
"variableNames": [
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "10581:3:1"
}
]
}
]
},
"name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "10342:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "10349:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "end",
"nodeType": "YulTypedName",
"src": "10357:3:1",
"type": ""
}
],
"src": "10269:364:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "10757:195:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "10767:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "10779:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "10790:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10775:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10775:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "10767:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "10814:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "10825:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "10810:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10810:17:1"
},
{
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "10833:4:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "10839:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "10829:3:1"
},
"nodeType": "YulFunctionCall",
"src": "10829:20:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "10803:6:1"
},
"nodeType": "YulFunctionCall",
"src": "10803:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "10803:47:1"
},
{
"nodeType": "YulAssignment",
"src": "10859:86:1",
"value": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "10931:6:1"
},
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "10940:4:1"
}
],
"functionName": {
"name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "10867:63:1"
},
"nodeType": "YulFunctionCall",
"src": "10867:78:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "10859:4:1"
}
]
}
]
},
"name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "10729:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "10741:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "10752:4:1",
"type": ""
}
],
"src": "10639:313:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "11034:66:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "11044:50:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11088:5:1"
}
],
"functionName": {
"name": "convert_t_uint160_to_t_address",
"nodeType": "YulIdentifier",
"src": "11057:30:1"
},
"nodeType": "YulFunctionCall",
"src": "11057:37:1"
},
"variableNames": [
{
"name": "converted",
"nodeType": "YulIdentifier",
"src": "11044:9:1"
}
]
}
]
},
"name": "convert_t_contract$_Staking_$1228_to_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "11014:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "converted",
"nodeType": "YulTypedName",
"src": "11024:9:1",
"type": ""
}
],
"src": "10958:142:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "11187:82:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "11204:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11256:5:1"
}
],
"functionName": {
"name": "convert_t_contract$_Staking_$1228_to_t_address",
"nodeType": "YulIdentifier",
"src": "11209:46:1"
},
"nodeType": "YulFunctionCall",
"src": "11209:53:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "11197:6:1"
},
"nodeType": "YulFunctionCall",
"src": "11197:66:1"
},
"nodeType": "YulExpressionStatement",
"src": "11197:66:1"
}
]
},
"name": "abi_encode_t_contract$_Staking_$1228_to_t_address_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "11175:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "11182:3:1",
"type": ""
}
],
"src": "11106:163:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "11389:140:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "11399:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "11411:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "11422:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "11407:3:1"
},
"nodeType": "YulFunctionCall",
"src": "11407:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "11399:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "11495:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "11508:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "11519:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "11504:3:1"
},
"nodeType": "YulFunctionCall",
"src": "11504:17:1"
}
],
"functionName": {
"name": "abi_encode_t_contract$_Staking_$1228_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "11435:59:1"
},
"nodeType": "YulFunctionCall",
"src": "11435:87:1"
},
"nodeType": "YulExpressionStatement",
"src": "11435:87:1"
}
]
},
"name": "abi_encode_tuple_t_contract$_Staking_$1228__to_t_address__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "11361:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "11373:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "11384:4:1",
"type": ""
}
],
"src": "11275:254:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "11588:51:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "11598:35:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11627:5:1"
}
],
"functionName": {
"name": "cleanup_t_uint160",
"nodeType": "YulIdentifier",
"src": "11609:17:1"
},
"nodeType": "YulFunctionCall",
"src": "11609:24:1"
},
"variableNames": [
{
"name": "cleaned",
"nodeType": "YulIdentifier",
"src": "11598:7:1"
}
]
}
]
},
"name": "cleanup_t_address_payable",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "11570:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "cleaned",
"nodeType": "YulTypedName",
"src": "11580:7:1",
"type": ""
}
],
"src": "11535:104:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "11696:87:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "11761:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "11770:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "11773:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "11763:6:1"
},
"nodeType": "YulFunctionCall",
"src": "11763:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "11763:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11719:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11752:5:1"
}
],
"functionName": {
"name": "cleanup_t_address_payable",
"nodeType": "YulIdentifier",
"src": "11726:25:1"
},
"nodeType": "YulFunctionCall",
"src": "11726:32:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "11716:2:1"
},
"nodeType": "YulFunctionCall",
"src": "11716:43:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "11709:6:1"
},
"nodeType": "YulFunctionCall",
"src": "11709:51:1"
},
"nodeType": "YulIf",
"src": "11706:71:1"
}
]
},
"name": "validator_revert_t_address_payable",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "11689:5:1",
"type": ""
}
],
"src": "11645:138:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "11849:95:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "11859:29:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "11881:6:1"
}
],
"functionName": {
"name": "calldataload",
"nodeType": "YulIdentifier",
"src": "11868:12:1"
},
"nodeType": "YulFunctionCall",
"src": "11868:20:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11859:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "11932:5:1"
}
],
"functionName": {
"name": "validator_revert_t_address_payable",
"nodeType": "YulIdentifier",
"src": "11897:34:1"
},
"nodeType": "YulFunctionCall",
"src": "11897:41:1"
},
"nodeType": "YulExpressionStatement",
"src": "11897:41:1"
}
]
},
"name": "abi_decode_t_address_payable",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "11827:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "11835:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "11843:5:1",
"type": ""
}
],
"src": "11789:155:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "12024:271:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "12070:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "12072:77:1"
},
"nodeType": "YulFunctionCall",
"src": "12072:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "12072:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "12045:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "12054:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "12041:3:1"
},
"nodeType": "YulFunctionCall",
"src": "12041:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "12066:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "12037:3:1"
},
"nodeType": "YulFunctionCall",
"src": "12037:32:1"
},
"nodeType": "YulIf",
"src": "12034:119:1"
},
{
"nodeType": "YulBlock",
"src": "12163:125:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "12178:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "12192:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "12182:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "12207:71:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "12250:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "12261:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "12246:3:1"
},
"nodeType": "YulFunctionCall",
"src": "12246:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "12270:7:1"
}
],
"functionName": {
"name": "abi_decode_t_address_payable",
"nodeType": "YulIdentifier",
"src": "12217:28:1"
},
"nodeType": "YulFunctionCall",
"src": "12217:61:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "12207:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_address_payable",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "11994:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "12005:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "12017:6:1",
"type": ""
}
],
"src": "11950:345:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "12390:66:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "12400:50:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "12444:5:1"
}
],
"functionName": {
"name": "convert_t_uint160_to_t_address",
"nodeType": "YulIdentifier",
"src": "12413:30:1"
},
"nodeType": "YulFunctionCall",
"src": "12413:37:1"
},
"variableNames": [
{
"name": "converted",
"nodeType": "YulIdentifier",
"src": "12400:9:1"
}
]
}
]
},
"name": "convert_t_contract$_AggregatorV3Interface_$263_to_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "12370:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "converted",
"nodeType": "YulTypedName",
"src": "12380:9:1",
"type": ""
}
],
"src": "12301:155:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "12556:95:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "12573:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "12638:5:1"
}
],
"functionName": {
"name": "convert_t_contract$_AggregatorV3Interface_$263_to_t_address",
"nodeType": "YulIdentifier",
"src": "12578:59:1"
},
"nodeType": "YulFunctionCall",
"src": "12578:66:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "12566:6:1"
},
"nodeType": "YulFunctionCall",
"src": "12566:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "12566:79:1"
}
]
},
"name": "abi_encode_t_contract$_AggregatorV3Interface_$263_to_t_address_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "12544:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "12551:3:1",
"type": ""
}
],
"src": "12462:189:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "12784:153:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "12794:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "12806:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "12817:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "12802:3:1"
},
"nodeType": "YulFunctionCall",
"src": "12802:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "12794:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "12903:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "12916:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "12927:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "12912:3:1"
},
"nodeType": "YulFunctionCall",
"src": "12912:17:1"
}
],
"functionName": {
"name": "abi_encode_t_contract$_AggregatorV3Interface_$263_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "12830:72:1"
},
"nodeType": "YulFunctionCall",
"src": "12830:100:1"
},
"nodeType": "YulExpressionStatement",
"src": "12830:100:1"
}
]
},
"name": "abi_encode_tuple_t_contract$_AggregatorV3Interface_$263__to_t_address__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "12756:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "12768:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "12779:4:1",
"type": ""
}
],
"src": "12657:280:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "13017:66:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "13027:50:1",
"value": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "13071:5:1"
}
],
"functionName": {
"name": "convert_t_uint160_to_t_address",
"nodeType": "YulIdentifier",
"src": "13040:30:1"
},
"nodeType": "YulFunctionCall",
"src": "13040:37:1"
},
"variableNames": [
{
"name": "converted",
"nodeType": "YulIdentifier",
"src": "13027:9:1"
}
]
}
]
},
"name": "convert_t_contract$_ERC20_$1936_to_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "12997:5:1",
"type": ""
}
],
"returnVariables": [
{
"name": "converted",
"nodeType": "YulTypedName",
"src": "13007:9:1",
"type": ""
}
],
"src": "12943:140:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "13168:80:1",
"statements": [
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "13185:3:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "13235:5:1"
}
],
"functionName": {
"name": "convert_t_contract$_ERC20_$1936_to_t_address",
"nodeType": "YulIdentifier",
"src": "13190:44:1"
},
"nodeType": "YulFunctionCall",
"src": "13190:51:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "13178:6:1"
},
"nodeType": "YulFunctionCall",
"src": "13178:64:1"
},
"nodeType": "YulExpressionStatement",
"src": "13178:64:1"
}
]
},
"name": "abi_encode_t_contract$_ERC20_$1936_to_t_address_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "13156:5:1",
"type": ""
},
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "13163:3:1",
"type": ""
}
],
"src": "13089:159:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "13366:138:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "13376:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "13388:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "13399:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "13384:3:1"
},
"nodeType": "YulFunctionCall",
"src": "13384:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "13376:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "13470:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "13483:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "13494:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "13479:3:1"
},
"nodeType": "YulFunctionCall",
"src": "13479:17:1"
}
],
"functionName": {
"name": "abi_encode_t_contract$_ERC20_$1936_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "13412:57:1"
},
"nodeType": "YulFunctionCall",
"src": "13412:85:1"
},
"nodeType": "YulExpressionStatement",
"src": "13412:85:1"
}
]
},
"name": "abi_encode_tuple_t_contract$_ERC20_$1936__to_t_address__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "13338:9:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "13350:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "13361:4:1",
"type": ""
}
],
"src": "13254:250:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "13576:263:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "13622:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "13624:77:1"
},
"nodeType": "YulFunctionCall",
"src": "13624:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "13624:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "13597:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "13606:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "13593:3:1"
},
"nodeType": "YulFunctionCall",
"src": "13593:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "13618:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "13589:3:1"
},
"nodeType": "YulFunctionCall",
"src": "13589:32:1"
},
"nodeType": "YulIf",
"src": "13586:119:1"
},
{
"nodeType": "YulBlock",
"src": "13715:117:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "13730:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "13744:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "13734:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "13759:63:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "13794:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "13805:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "13790:3:1"
},
"nodeType": "YulFunctionCall",
"src": "13790:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "13814:7:1"
}
],
"functionName": {
"name": "abi_decode_t_address",
"nodeType": "YulIdentifier",
"src": "13769:20:1"
},
"nodeType": "YulFunctionCall",
"src": "13769:53:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "13759:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_address",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "13546:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "13557:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "13569:6:1",
"type": ""
}
],
"src": "13510:329:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "13951:76:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "13973:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "13981:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "13969:3:1"
},
"nodeType": "YulFunctionCall",
"src": "13969:14:1"
},
{
"hexValue": "4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572",
"kind": "string",
"nodeType": "YulLiteral",
"src": "13985:34:1",
"type": "",
"value": "Ownable: caller is not the owner"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "13962:6:1"
},
"nodeType": "YulFunctionCall",
"src": "13962:58:1"
},
"nodeType": "YulExpressionStatement",
"src": "13962:58:1"
}
]
},
"name": "store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "13943:6:1",
"type": ""
}
],
"src": "13845:182:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "14179:220:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "14189:74:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "14255:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "14260:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "14196:58:1"
},
"nodeType": "YulFunctionCall",
"src": "14196:67:1"
},
"variableNames": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "14189:3:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "14361:3:1"
}
],
"functionName": {
"name": "store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe",
"nodeType": "YulIdentifier",
"src": "14272:88:1"
},
"nodeType": "YulFunctionCall",
"src": "14272:93:1"
},
"nodeType": "YulExpressionStatement",
"src": "14272:93:1"
},
{
"nodeType": "YulAssignment",
"src": "14374:19:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "14385:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "14390:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "14381:3:1"
},
"nodeType": "YulFunctionCall",
"src": "14381:12:1"
},
"variableNames": [
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "14374:3:1"
}
]
}
]
},
"name": "abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "14167:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "end",
"nodeType": "YulTypedName",
"src": "14175:3:1",
"type": ""
}
],
"src": "14033:366:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "14576:248:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "14586:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "14598:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "14609:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "14594:3:1"
},
"nodeType": "YulFunctionCall",
"src": "14594:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "14586:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "14633:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "14644:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "14629:3:1"
},
"nodeType": "YulFunctionCall",
"src": "14629:17:1"
},
{
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "14652:4:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "14658:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "14648:3:1"
},
"nodeType": "YulFunctionCall",
"src": "14648:20:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "14622:6:1"
},
"nodeType": "YulFunctionCall",
"src": "14622:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "14622:47:1"
},
{
"nodeType": "YulAssignment",
"src": "14678:139:1",
"value": {
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "14812:4:1"
}
],
"functionName": {
"name": "abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "14686:124:1"
},
"nodeType": "YulFunctionCall",
"src": "14686:131:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "14678:4:1"
}
]
}
]
},
"name": "abi_encode_tuple_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe__to_t_string_memory_ptr__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "14556:9:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "14571:4:1",
"type": ""
}
],
"src": "14405:419:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "14936:116:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "14958:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "14966:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "14954:3:1"
},
"nodeType": "YulFunctionCall",
"src": "14954:14:1"
},
{
"hexValue": "426f6e64696e673a2043616e6e6f7420636c61696d20696e6163746976652062",
"kind": "string",
"nodeType": "YulLiteral",
"src": "14970:34:1",
"type": "",
"value": "Bonding: Cannot claim inactive b"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "14947:6:1"
},
"nodeType": "YulFunctionCall",
"src": "14947:58:1"
},
"nodeType": "YulExpressionStatement",
"src": "14947:58:1"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "15026:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "15034:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "15022:3:1"
},
"nodeType": "YulFunctionCall",
"src": "15022:15:1"
},
{
"hexValue": "6f6e64",
"kind": "string",
"nodeType": "YulLiteral",
"src": "15039:5:1",
"type": "",
"value": "ond"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "15015:6:1"
},
"nodeType": "YulFunctionCall",
"src": "15015:30:1"
},
"nodeType": "YulExpressionStatement",
"src": "15015:30:1"
}
]
},
"name": "store_literal_in_memory_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "14928:6:1",
"type": ""
}
],
"src": "14830:222:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "15204:220:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "15214:74:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "15280:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "15285:2:1",
"type": "",
"value": "35"
}
],
"functionName": {
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "15221:58:1"
},
"nodeType": "YulFunctionCall",
"src": "15221:67:1"
},
"variableNames": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "15214:3:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "15386:3:1"
}
],
"functionName": {
"name": "store_literal_in_memory_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820",
"nodeType": "YulIdentifier",
"src": "15297:88:1"
},
"nodeType": "YulFunctionCall",
"src": "15297:93:1"
},
"nodeType": "YulExpressionStatement",
"src": "15297:93:1"
},
{
"nodeType": "YulAssignment",
"src": "15399:19:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "15410:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "15415:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "15406:3:1"
},
"nodeType": "YulFunctionCall",
"src": "15406:12:1"
},
"variableNames": [
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "15399:3:1"
}
]
}
]
},
"name": "abi_encode_t_stringliteral_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820_to_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "15192:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "end",
"nodeType": "YulTypedName",
"src": "15200:3:1",
"type": ""
}
],
"src": "15058:366:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "15601:248:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "15611:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "15623:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "15634:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "15619:3:1"
},
"nodeType": "YulFunctionCall",
"src": "15619:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "15611:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "15658:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "15669:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "15654:3:1"
},
"nodeType": "YulFunctionCall",
"src": "15654:17:1"
},
{
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "15677:4:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "15683:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "15673:3:1"
},
"nodeType": "YulFunctionCall",
"src": "15673:20:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "15647:6:1"
},
"nodeType": "YulFunctionCall",
"src": "15647:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "15647:47:1"
},
{
"nodeType": "YulAssignment",
"src": "15703:139:1",
"value": {
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "15837:4:1"
}
],
"functionName": {
"name": "abi_encode_t_stringliteral_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820_to_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "15711:124:1"
},
"nodeType": "YulFunctionCall",
"src": "15711:131:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "15703:4:1"
}
]
}
]
},
"name": "abi_encode_tuple_t_stringliteral_c92034f538c4268d46218b2ba9411c104ab34fca0dd7f169671c6f24a224f820__to_t_string_memory_ptr__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "15581:9:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "15596:4:1",
"type": ""
}
],
"src": "15430:419:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "16009:288:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "16019:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "16031:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16042:2:1",
"type": "",
"value": "96"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16027:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16027:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "16019:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "16099:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "16112:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16123:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16108:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16108:17:1"
}
],
"functionName": {
"name": "abi_encode_t_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "16055:43:1"
},
"nodeType": "YulFunctionCall",
"src": "16055:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "16055:71:1"
},
{
"expression": {
"arguments": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "16180:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "16193:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16204:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16189:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16189:18:1"
}
],
"functionName": {
"name": "abi_encode_t_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "16136:43:1"
},
"nodeType": "YulFunctionCall",
"src": "16136:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "16136:72:1"
},
{
"expression": {
"arguments": [
{
"name": "value2",
"nodeType": "YulIdentifier",
"src": "16262:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "16275:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16286:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16271:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16271:18:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "16218:43:1"
},
"nodeType": "YulFunctionCall",
"src": "16218:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "16218:72:1"
}
]
},
"name": "abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "15965:9:1",
"type": ""
},
{
"name": "value2",
"nodeType": "YulTypedName",
"src": "15977:6:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "15985:6:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "15993:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "16004:4:1",
"type": ""
}
],
"src": "15855:442:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "16409:117:1",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "16431:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16439:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16427:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16427:14:1"
},
{
"hexValue": "426f6e64696e673a20426f6e64206973206c6f636b656420746f20636c61696d",
"kind": "string",
"nodeType": "YulLiteral",
"src": "16443:34:1",
"type": "",
"value": "Bonding: Bond is locked to claim"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "16420:6:1"
},
"nodeType": "YulFunctionCall",
"src": "16420:58:1"
},
"nodeType": "YulExpressionStatement",
"src": "16420:58:1"
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "memPtr",
"nodeType": "YulIdentifier",
"src": "16499:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16507:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16495:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16495:15:1"
},
{
"hexValue": "206e6f77",
"kind": "string",
"nodeType": "YulLiteral",
"src": "16512:6:1",
"type": "",
"value": " now"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "16488:6:1"
},
"nodeType": "YulFunctionCall",
"src": "16488:31:1"
},
"nodeType": "YulExpressionStatement",
"src": "16488:31:1"
}
]
},
"name": "store_literal_in_memory_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "memPtr",
"nodeType": "YulTypedName",
"src": "16401:6:1",
"type": ""
}
],
"src": "16303:223:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "16678:220:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "16688:74:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "16754:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16759:2:1",
"type": "",
"value": "36"
}
],
"functionName": {
"name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "16695:58:1"
},
"nodeType": "YulFunctionCall",
"src": "16695:67:1"
},
"variableNames": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "16688:3:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "16860:3:1"
}
],
"functionName": {
"name": "store_literal_in_memory_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa",
"nodeType": "YulIdentifier",
"src": "16771:88:1"
},
"nodeType": "YulFunctionCall",
"src": "16771:93:1"
},
"nodeType": "YulExpressionStatement",
"src": "16771:93:1"
},
{
"nodeType": "YulAssignment",
"src": "16873:19:1",
"value": {
"arguments": [
{
"name": "pos",
"nodeType": "YulIdentifier",
"src": "16884:3:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "16889:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "16880:3:1"
},
"nodeType": "YulFunctionCall",
"src": "16880:12:1"
},
"variableNames": [
{
"name": "end",
"nodeType": "YulIdentifier",
"src": "16873:3:1"
}
]
}
]
},
"name": "abi_encode_t_stringliteral_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa_to_t_string_memory_ptr_fromStack",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "pos",
"nodeType": "YulTypedName",
"src": "16666:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "end",
"nodeType": "YulTypedName",
"src": "16674:3:1",
"type": ""
}
],
"src": "16532:366:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "17075:248:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "17085:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "17097:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17108:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "17093:3:1"
},
"nodeType": "YulFunctionCall",
"src": "17093:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "17085:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "17132:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17143:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "17128:3:1"
},
"nodeType": "YulFunctionCall",
"src": "17128:17:1"
},
{
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "17151:4:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "17157:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "17147:3:1"
},
"nodeType": "YulFunctionCall",
"src": "17147:20:1"
}
],
"functionName": {
"name": "mstore",
"nodeType": "YulIdentifier",
"src": "17121:6:1"
},
"nodeType": "YulFunctionCall",
"src": "17121:47:1"
},
"nodeType": "YulExpressionStatement",
"src": "17121:47:1"
},
{
"nodeType": "YulAssignment",
"src": "17177:139:1",
"value": {
"arguments": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "17311:4:1"
}
],
"functionName": {
"name": "abi_encode_t_stringliteral_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa_to_t_string_memory_ptr_fromStack",
"nodeType": "YulIdentifier",
"src": "17185:124:1"
},
"nodeType": "YulFunctionCall",
"src": "17185:131:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "17177:4:1"
}
]
}
]
},
"name": "abi_encode_tuple_t_stringliteral_de2916539b799bf7458ce62bbc3c1cc4cb7fa6e0d70fa67a33192cf00eb49caa__to_t_string_memory_ptr__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "17055:9:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "17070:4:1",
"type": ""
}
],
"src": "16904:419:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "17455:206:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "17465:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "17477:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17488:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "17473:3:1"
},
"nodeType": "YulFunctionCall",
"src": "17473:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "17465:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "17545:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "17558:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17569:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "17554:3:1"
},
"nodeType": "YulFunctionCall",
"src": "17554:17:1"
}
],
"functionName": {
"name": "abi_encode_t_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "17501:43:1"
},
"nodeType": "YulFunctionCall",
"src": "17501:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "17501:71:1"
},
{
"expression": {
"arguments": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "17626:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "17639:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17650:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "17635:3:1"
},
"nodeType": "YulFunctionCall",
"src": "17635:18:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "17582:43:1"
},
"nodeType": "YulFunctionCall",
"src": "17582:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "17582:72:1"
}
]
},
"name": "abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "17419:9:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "17431:6:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "17439:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "17450:4:1",
"type": ""
}
],
"src": "17329:332:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "17707:76:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "17761:16:1",
"statements": [
{
"expression": {
"arguments": [
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17770:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "17773:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "revert",
"nodeType": "YulIdentifier",
"src": "17763:6:1"
},
"nodeType": "YulFunctionCall",
"src": "17763:12:1"
},
"nodeType": "YulExpressionStatement",
"src": "17763:12:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "17730:5:1"
},
{
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "17752:5:1"
}
],
"functionName": {
"name": "cleanup_t_bool",
"nodeType": "YulIdentifier",
"src": "17737:14:1"
},
"nodeType": "YulFunctionCall",
"src": "17737:21:1"
}
],
"functionName": {
"name": "eq",
"nodeType": "YulIdentifier",
"src": "17727:2:1"
},
"nodeType": "YulFunctionCall",
"src": "17727:32:1"
}
],
"functionName": {
"name": "iszero",
"nodeType": "YulIdentifier",
"src": "17720:6:1"
},
"nodeType": "YulFunctionCall",
"src": "17720:40:1"
},
"nodeType": "YulIf",
"src": "17717:60:1"
}
]
},
"name": "validator_revert_t_bool",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "17700:5:1",
"type": ""
}
],
"src": "17667:116:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "17849:77:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "17859:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "17874:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "17868:5:1"
},
"nodeType": "YulFunctionCall",
"src": "17868:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "17859:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "17914:5:1"
}
],
"functionName": {
"name": "validator_revert_t_bool",
"nodeType": "YulIdentifier",
"src": "17890:23:1"
},
"nodeType": "YulFunctionCall",
"src": "17890:30:1"
},
"nodeType": "YulExpressionStatement",
"src": "17890:30:1"
}
]
},
"name": "abi_decode_t_bool_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "17827:6:1",
"type": ""
},
{
"name": "end",
"nodeType": "YulTypedName",
"src": "17835:3:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value",
"nodeType": "YulTypedName",
"src": "17843:5:1",
"type": ""
}
],
"src": "17789:137:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "18006:271:1",
"statements": [
{
"body": {
"nodeType": "YulBlock",
"src": "18052:83:1",
"statements": [
{
"expression": {
"arguments": [],
"functionName": {
"name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b",
"nodeType": "YulIdentifier",
"src": "18054:77:1"
},
"nodeType": "YulFunctionCall",
"src": "18054:79:1"
},
"nodeType": "YulExpressionStatement",
"src": "18054:79:1"
}
]
},
"condition": {
"arguments": [
{
"arguments": [
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "18027:7:1"
},
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "18036:9:1"
}
],
"functionName": {
"name": "sub",
"nodeType": "YulIdentifier",
"src": "18023:3:1"
},
"nodeType": "YulFunctionCall",
"src": "18023:23:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "18048:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "slt",
"nodeType": "YulIdentifier",
"src": "18019:3:1"
},
"nodeType": "YulFunctionCall",
"src": "18019:32:1"
},
"nodeType": "YulIf",
"src": "18016:119:1"
},
{
"nodeType": "YulBlock",
"src": "18145:125:1",
"statements": [
{
"nodeType": "YulVariableDeclaration",
"src": "18160:15:1",
"value": {
"kind": "number",
"nodeType": "YulLiteral",
"src": "18174:1:1",
"type": "",
"value": "0"
},
"variables": [
{
"name": "offset",
"nodeType": "YulTypedName",
"src": "18164:6:1",
"type": ""
}
]
},
{
"nodeType": "YulAssignment",
"src": "18189:71:1",
"value": {
"arguments": [
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "18232:9:1"
},
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "18243:6:1"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "18228:3:1"
},
"nodeType": "YulFunctionCall",
"src": "18228:22:1"
},
{
"name": "dataEnd",
"nodeType": "YulIdentifier",
"src": "18252:7:1"
}
],
"functionName": {
"name": "abi_decode_t_bool_fromMemory",
"nodeType": "YulIdentifier",
"src": "18199:28:1"
},
"nodeType": "YulFunctionCall",
"src": "18199:61:1"
},
"variableNames": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "18189:6:1"
}
]
}
]
}
]
},
"name": "abi_decode_tuple_t_bool_fromMemory",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "17976:9:1",
"type": ""
},
{
"name": "dataEnd",
"nodeType": "YulTypedName",
"src": "17987:7:1",
"type": ""
}
],
"returnVariables": [
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "17999:6:1",
"type": ""
}
],
"src": "17932:345:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "18409:206:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "18419:26:1",
"value": {
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "18431:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "18442:2:1",
"type": "",
"value": "64"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "18427:3:1"
},
"nodeType": "YulFunctionCall",
"src": "18427:18:1"
},
"variableNames": [
{
"name": "tail",
"nodeType": "YulIdentifier",
"src": "18419:4:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value0",
"nodeType": "YulIdentifier",
"src": "18499:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "18512:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "18523:1:1",
"type": "",
"value": "0"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "18508:3:1"
},
"nodeType": "YulFunctionCall",
"src": "18508:17:1"
}
],
"functionName": {
"name": "abi_encode_t_uint256_to_t_uint256_fromStack",
"nodeType": "YulIdentifier",
"src": "18455:43:1"
},
"nodeType": "YulFunctionCall",
"src": "18455:71:1"
},
"nodeType": "YulExpressionStatement",
"src": "18455:71:1"
},
{
"expression": {
"arguments": [
{
"name": "value1",
"nodeType": "YulIdentifier",
"src": "18580:6:1"
},
{
"arguments": [
{
"name": "headStart",
"nodeType": "YulIdentifier",
"src": "18593:9:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "18604:2:1",
"type": "",
"value": "32"
}
],
"functionName": {
"name": "add",
"nodeType": "YulIdentifier",
"src": "18589:3:1"
},
"nodeType": "YulFunctionCall",
"src": "18589:18:1"
}
],
"functionName": {
"name": "abi_encode_t_address_to_t_address_fromStack",
"nodeType": "YulIdentifier",
"src": "18536:43:1"
},
"nodeType": "YulFunctionCall",
"src": "18536:72:1"
},
"nodeType": "YulExpressionStatement",
"src": "18536:72:1"
}
]
},
"name": "abi_encode_tuple_t_uint256_t_address__to_t_uint256_t_address__fromStack_reversed",
"nodeType": "YulFunctionDefinition",
"parameters": [
{
"name": "headStart",
"nodeType": "YulTypedName",
"src": "18373:9:1",
"type": ""
},
{
"name": "value1",
"nodeType": "YulTypedName",
"src": "18385:6:1",
"type": ""
},
{
"name": "value0",
"nodeType": "YulTypedName",
"src": "18393:6:1",
"type": ""
}
],
"returnVariables": [
{
"name": "tail",
"nodeType": "YulTypedName",
"src": "18404:4:1",
"type": ""
}
],
"src": "18283:332:1"
},
{
"body": {
"nodeType": "YulBlock",
"src": "18684:80:1",
"statements": [
{
"nodeType": "YulAssignment",
"src": "18694:22:1",
"value": {
"arguments": [
{
"name": "offset",
"nodeType": "YulIdentifier",
"src": "18709:6:1"
}
],
"functionName": {
"name": "mload",
"nodeType": "YulIdentifier",
"src": "18703:5:1"
},
"nodeType": "YulFunctionCall",
"src": "18703:13:1"
},
"variableNames": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "18694:5:1"
}
]
},
{
"expression": {
"arguments": [
{
"name": "value",
"nodeType": "YulIdentifier",
"src": "18752:5:1"
}
],
"functionName": {
"name": "validator_revert_t_uint256",
"nodeType": "YulIdentifier",
"src": "18725:26:1"
},
"nodeType": "YulFunctionCall",
"src": "18725:33:1"
},
"nodeType": "YulExpressionStatement",
"src": "18725:33:1"
}
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment