diff --git a/deployments/base_testnet/Dummy1.json b/deployments/base_testnet/Dummy1.json index ee986834..bd02474d 100644 --- a/deployments/base_testnet/Dummy1.json +++ b/deployments/base_testnet/Dummy1.json @@ -664,4 +664,4 @@ } ], "numDeployments": 3 -} \ No newline at end of file +} diff --git a/deployments/base_testnet/Dummy2.json b/deployments/base_testnet/Dummy2.json index 0aca52f1..68862bb8 100644 --- a/deployments/base_testnet/Dummy2.json +++ b/deployments/base_testnet/Dummy2.json @@ -664,4 +664,4 @@ } ], "numDeployments": 3 -} \ No newline at end of file +} diff --git a/deployments/base_testnet/DummyERC20.json b/deployments/base_testnet/DummyERC20.json index b81ff0d6..c07df2ee 100644 --- a/deployments/base_testnet/DummyERC20.json +++ b/deployments/base_testnet/DummyERC20.json @@ -725,10 +725,7 @@ "status": 1, "byzantium": true }, - "args": [ - "FreeMintableDummyERC20_2", - "Dummy2" - ], + "args": ["FreeMintableDummyERC20_2", "Dummy2"], "numDeployments": 4, "solcInputHash": "5d7138b5466db9111ae85d9f4162357d", "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PAUSER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burnFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"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.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"burn(uint256)\":{\"details\":\"Destroys `amount` tokens from the caller. See {ERC20-_burn}.\"},\"burnFrom(address,uint256)\":{\"details\":\"Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`.\"},\"decimals()\":{\"details\":\"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}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"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`.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"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.\"},\"mint(address,uint256)\":{\"details\":\"Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"pause()\":{\"details\":\"Pauses all token transfers. See {ERC20Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"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`.\"},\"unpause()\":{\"details\":\"Unpauses all token transfers. See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/helper/DummyERC20.sol\":\"DummyERC20\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-4.7.3/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b35d8e68aeaccc685239bd9dd79b9ba01a0357930f8a3307ab85511733d9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/access/AccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlEnumerable.sol\\\";\\nimport \\\"./AccessControl.sol\\\";\\nimport \\\"../utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\\n */\\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\\n return _roleMembers[role].at(index);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\\n return _roleMembers[role].length();\\n }\\n\\n /**\\n * @dev Overload {_grantRole} to track enumerable memberships\\n */\\n function _grantRole(bytes32 role, address account) internal virtual override {\\n super._grantRole(role, account);\\n _roleMembers[role].add(account);\\n }\\n\\n /**\\n * @dev Overload {_revokeRole} to track enumerable memberships\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual override {\\n super._revokeRole(role, account);\\n _roleMembers[role].remove(account);\\n }\\n}\\n\",\"keccak256\":\"0x13f5e15f2a0650c0b6aaee2ef19e89eaf4870d6e79662d572a393334c1397247\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/access/IAccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\n\\n/**\\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\\n */\\ninterface IAccessControlEnumerable is IAccessControl {\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xba4459ab871dfa300f5212c6c30178b63898c03533a1ede28436f11546626676\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n }\\n _balances[to] += amount;\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n }\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n}\\n\",\"keccak256\":\"0x24b04b8aacaaf1a4a0719117b29c9c3647b1f479c5ac2a60f5ff1bb6d839c238\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/token/ERC20/extensions/ERC20Burnable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\\n * tokens and those that they have an allowance for, in a way that can be\\n * recognized off-chain (via event analysis).\\n */\\nabstract contract ERC20Burnable is Context, ERC20 {\\n /**\\n * @dev Destroys `amount` tokens from the caller.\\n *\\n * See {ERC20-_burn}.\\n */\\n function burn(uint256 amount) public virtual {\\n _burn(_msgSender(), amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\\n * allowance.\\n *\\n * See {ERC20-_burn} and {ERC20-allowance}.\\n *\\n * Requirements:\\n *\\n * - the caller must have allowance for ``accounts``'s tokens of at least\\n * `amount`.\\n */\\n function burnFrom(address account, uint256 amount) public virtual {\\n _spendAllowance(account, _msgSender(), amount);\\n _burn(account, amount);\\n }\\n}\\n\",\"keccak256\":\"0x0d19410453cda55960a818e02bd7c18952a5c8fe7a3036e81f0d599f34487a7b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/token/ERC20/extensions/ERC20Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../../../security/Pausable.sol\\\";\\n\\n/**\\n * @dev ERC20 token with pausable token transfers, minting and burning.\\n *\\n * Useful for scenarios such as preventing trades until the end of an evaluation\\n * period, or having an emergency switch for freezing all token transfers in the\\n * event of a large bug.\\n */\\nabstract contract ERC20Pausable is ERC20, Pausable {\\n /**\\n * @dev See {ERC20-_beforeTokenTransfer}.\\n *\\n * Requirements:\\n *\\n * - the contract must not be paused.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual override {\\n super._beforeTokenTransfer(from, to, amount);\\n\\n require(!paused(), \\\"ERC20Pausable: token transfer while paused\\\");\\n }\\n}\\n\",\"keccak256\":\"0x978847fbff92d66d27d8767402a90ba996970b1936b372406aa17f5492bd8dc5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/token/ERC20/presets/ERC20PresetMinterPauser.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC20.sol\\\";\\nimport \\\"../extensions/ERC20Burnable.sol\\\";\\nimport \\\"../extensions/ERC20Pausable.sol\\\";\\nimport \\\"../../../access/AccessControlEnumerable.sol\\\";\\nimport \\\"../../../utils/Context.sol\\\";\\n\\n/**\\n * @dev {ERC20} token, including:\\n *\\n * - ability for holders to burn (destroy) their tokens\\n * - a minter role that allows for token minting (creation)\\n * - a pauser role that allows to stop all token transfers\\n *\\n * This contract uses {AccessControl} to lock permissioned functions using the\\n * different roles - head to its documentation for details.\\n *\\n * The account that deploys the contract will be granted the minter and pauser\\n * roles, as well as the default admin role, which will let it grant both minter\\n * and pauser roles to other accounts.\\n *\\n * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._\\n */\\ncontract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {\\n bytes32 public constant MINTER_ROLE = keccak256(\\\"MINTER_ROLE\\\");\\n bytes32 public constant PAUSER_ROLE = keccak256(\\\"PAUSER_ROLE\\\");\\n\\n /**\\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\\n * account that deploys the contract.\\n *\\n * See {ERC20-constructor}.\\n */\\n constructor(string memory name, string memory symbol) ERC20(name, symbol) {\\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\\n\\n _setupRole(MINTER_ROLE, _msgSender());\\n _setupRole(PAUSER_ROLE, _msgSender());\\n }\\n\\n /**\\n * @dev Creates `amount` new tokens for `to`.\\n *\\n * See {ERC20-_mint}.\\n *\\n * Requirements:\\n *\\n * - the caller must have the `MINTER_ROLE`.\\n */\\n function mint(address to, uint256 amount) public virtual {\\n require(hasRole(MINTER_ROLE, _msgSender()), \\\"ERC20PresetMinterPauser: must have minter role to mint\\\");\\n _mint(to, amount);\\n }\\n\\n /**\\n * @dev Pauses all token transfers.\\n *\\n * See {ERC20Pausable} and {Pausable-_pause}.\\n *\\n * Requirements:\\n *\\n * - the caller must have the `PAUSER_ROLE`.\\n */\\n function pause() public virtual {\\n require(hasRole(PAUSER_ROLE, _msgSender()), \\\"ERC20PresetMinterPauser: must have pauser role to pause\\\");\\n _pause();\\n }\\n\\n /**\\n * @dev Unpauses all token transfers.\\n *\\n * See {ERC20Pausable} and {Pausable-_unpause}.\\n *\\n * Requirements:\\n *\\n * - the caller must have the `PAUSER_ROLE`.\\n */\\n function unpause() public virtual {\\n require(hasRole(PAUSER_ROLE, _msgSender()), \\\"ERC20PresetMinterPauser: must have pauser role to unpause\\\");\\n _unpause();\\n }\\n\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual override(ERC20, ERC20Pausable) {\\n super._beforeTokenTransfer(from, to, amount);\\n }\\n}\\n\",\"keccak256\":\"0x2cd54808b851c4db22f459065af0b7a952262741a85a73923e7a660767cd7baa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts-4.7.3/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/helper/DummyERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-4.7.3/token/ERC20/presets/ERC20PresetMinterPauser.sol\\\";\\n\\ncontract DummyERC20 is ERC20PresetMinterPauser {\\n constructor(string memory name, string memory symbol)\\n ERC20PresetMinterPauser(name, symbol)\\n {}\\n\\n function mint(address to, uint256 amount) public virtual override {\\n assert(amount <= 10000000000000000000);\\n _mint(to, amount);\\n }\\n}\\n\",\"keccak256\":\"0xbe1183aa0b346f91eadafdcd4666888b12481bbbda95ed37816a04f38bc1f6ce\",\"license\":\"MIT\"}},\"version\":1}", @@ -1024,4 +1021,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/MasterRegistry.json b/deployments/base_testnet/MasterRegistry.json index 29e6d33d..5f505b96 100644 --- a/deployments/base_testnet/MasterRegistry.json +++ b/deployments/base_testnet/MasterRegistry.json @@ -453,9 +453,7 @@ "status": 1, "byzantium": true }, - "args": [ - "0x5BDb37d0Ddea3A90F233c7B7F6b9394B6b2eef34" - ], + "args": ["0x5BDb37d0Ddea3A90F233c7B7F6b9394B6b2eef34"], "numDeployments": 1, "solcInputHash": "bc3a64a5cffb1e8de0dbf9fb306e4f9f", "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"registryAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"AddRegistry\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SADDLE_MANAGER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"registryName\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"registryAddress\",\"type\":\"address\"}],\"name\":\"addRegistry\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes[]\",\"name\":\"calls\",\"type\":\"bytes[]\"},{\"internalType\":\"bool\",\"name\":\"revertOnFail\",\"type\":\"bool\"}],\"name\":\"batch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"registryAddress\",\"type\":\"address\"}],\"name\":\"resolveAddressToRegistryData\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isLatest\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"version\",\"type\":\"uint256\"}],\"name\":\"resolveNameAndVersionToAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"resolveNameToAllAddresses\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"resolveNameToLatestAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"AddRegistry(bytes32,address,uint256)\":{\"params\":{\"name\":\"address of the added pool\",\"registryAddress\":\"address of the registry\",\"version\":\"version of the registry\"}}},\"kind\":\"dev\",\"methods\":{\"addRegistry(bytes32,address)\":{\"params\":{\"registryAddress\":\"address of the new registry\",\"registryName\":\"name for the registry\"}},\"batch(bytes[],bool)\":{\"params\":{\"calls\":\"An array of inputs for each call.\",\"revertOnFail\":\"If True then reverts after a failed call and stops doing further calls.\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`.\"},\"resolveAddressToRegistryData(address)\":{\"params\":{\"registryAddress\":\"address of a registry you want to resolve\"},\"returns\":{\"isLatest\":\"boolean flag of whether the given address is the latest version of the given registries with matching name\",\"name\":\"name of the resolved registry\",\"version\":\"version of the resolved registry\"}},\"resolveNameAndVersionToAddress(bytes32,uint256)\":{\"params\":{\"name\":\"address of the registry you want to resolve to\",\"version\":\"version of the registry you want to resolve to\"}},\"resolveNameToAllAddresses(bytes32)\":{\"params\":{\"name\":\"name for the registry\"},\"returns\":{\"_0\":\"address address of the latest registry with the matching name\"}},\"resolveNameToLatestAddress(bytes32)\":{\"params\":{\"name\":\"name for the registry\"},\"returns\":{\"_0\":\"address address of the latest registry with the matching name\"}},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"}},\"title\":\"MasterRegistry\",\"version\":1},\"userdoc\":{\"events\":{\"AddRegistry(bytes32,address,uint256)\":{\"notice\":\"Add a new registry entry to the master list.\"}},\"kind\":\"user\",\"methods\":{\"SADDLE_MANAGER_ROLE()\":{\"notice\":\"Role responsible for adding registries.\"},\"addRegistry(bytes32,address)\":{\"notice\":\"Add a new registry entry to the master list.\"},\"batch(bytes[],bool)\":{\"notice\":\"Allows batched call to self (this contract).\"},\"resolveAddressToRegistryData(address)\":{\"notice\":\"Resolves an address to registry entry data.\"},\"resolveNameAndVersionToAddress(bytes32,uint256)\":{\"notice\":\"Resolves a name and version to an address. Reverts if there is no registry with given name and version.\"},\"resolveNameToAllAddresses(bytes32)\":{\"notice\":\"Resolves a name to an array of all addresses. Reverts if no match is found.\"},\"resolveNameToLatestAddress(bytes32)\":{\"notice\":\"Resolves a name to the latest registry address. Reverts if no match is found.\"}},\"notice\":\"This contract holds list of other registries or contracts and its historical versions.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/registries/MasterRegistry.sol\":\"MasterRegistry\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/EnumerableSet.sol\\\";\\nimport \\\"../utils/Address.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n using Address for address;\\n\\n struct RoleData {\\n EnumerableSet.AddressSet members;\\n bytes32 adminRole;\\n }\\n\\n mapping (bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view returns (bool) {\\n return _roles[role].members.contains(account);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view returns (uint256) {\\n return _roles[role].members.length();\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view returns (address) {\\n return _roles[role].members.at(index);\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) public virtual {\\n require(hasRole(_roles[role].adminRole, _msgSender()), \\\"AccessControl: sender must be an admin to grant\\\");\\n\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) public virtual {\\n require(hasRole(_roles[role].adminRole, _msgSender()), \\\"AccessControl: sender must be an admin to revoke\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) public virtual {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);\\n _roles[role].adminRole = adminRole;\\n }\\n\\n function _grantRole(bytes32 role, address account) private {\\n if (_roles[role].members.add(account)) {\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n function _revokeRole(bytes32 role, address account) private {\\n if (_roles[role].members.remove(account)) {\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4fc155a2f7837603d69a13cfa481eb5e7f5e02cb77e2ec9edbac30986db37988\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x28911e614500ae7c607a432a709d35da25f3bc5ddc8bd12b278b66358070c0ea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping (bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) { // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs\\n // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\\n\\n bytes32 lastvalue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastvalue;\\n // Update the index for the moved value\\n set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n require(set._values.length > index, \\\"EnumerableSet: index out of bounds\\\");\\n return set._values[index];\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n}\\n\",\"keccak256\":\"0x1562cd9922fbf739edfb979f506809e2743789cbde3177515542161c3d04b164\",\"license\":\"MIT\"},\"contracts/helper/BaseBoringBatchable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.6.12;\\npragma experimental ABIEncoderV2;\\n\\n// solhint-disable avoid-low-level-calls\\n// solhint-disable no-inline-assembly\\n\\n// Audit on 5-Jan-2021 by Keno and BoringCrypto\\n// WARNING!!!\\n// Combining BoringBatchable with msg.value can cause double spending issues\\n// https://www.paradigm.xyz/2021/08/two-rights-might-make-a-wrong/\\n\\ncontract BaseBoringBatchable {\\n /// @dev Helper function to extract a useful revert message from a failed call.\\n /// If the returned data is malformed or not correctly abi encoded then this call can fail itself.\\n function _getRevertMsg(bytes memory _returnData)\\n internal\\n pure\\n returns (string memory)\\n {\\n // If the _res length is less than 68, then the transaction failed silently (without a revert message)\\n if (_returnData.length < 68) return \\\"Transaction reverted silently\\\";\\n\\n assembly {\\n // Slice the sighash.\\n _returnData := add(_returnData, 0x04)\\n }\\n return abi.decode(_returnData, (string)); // All that remains is the revert string\\n }\\n\\n /// @notice Allows batched call to self (this contract).\\n /// @param calls An array of inputs for each call.\\n /// @param revertOnFail If True then reverts after a failed call and stops doing further calls.\\n // F1: External is ok here because this is the batch function, adding it to a batch makes no sense\\n // F2: Calls in the batch may be payable, delegatecall operates in the same context, so each call in the batch has access to msg.value\\n // C3: The length of the loop is fully under user control, so can't be exploited\\n // C7: Delegatecall is only used on the same contract, so it's safe\\n function batch(bytes[] calldata calls, bool revertOnFail) external payable {\\n for (uint256 i = 0; i < calls.length; i++) {\\n (bool success, bytes memory result) = address(this).delegatecall(\\n calls[i]\\n );\\n if (!success && revertOnFail) {\\n revert(_getRevertMsg(result));\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x95f34c0ce5cd71071698709dd23eea9b6031fe973be9d6f53f9f08452a444d66\",\"license\":\"MIT\"},\"contracts/interfaces/IMasterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0;\\npragma experimental ABIEncoderV2;\\n\\ninterface IMasterRegistry {\\n /* Structs */\\n\\n struct ReverseRegistryData {\\n bytes32 name;\\n uint256 version;\\n }\\n\\n /* Functions */\\n\\n /**\\n * @notice Add a new registry entry to the master list.\\n * @param registryName name for the registry\\n * @param registryAddress address of the new registry\\n */\\n function addRegistry(bytes32 registryName, address registryAddress)\\n external\\n payable;\\n\\n /**\\n * @notice Resolves a name to the latest registry address. Reverts if no match is found.\\n * @param name name for the registry\\n * @return address address of the latest registry with the matching name\\n */\\n function resolveNameToLatestAddress(bytes32 name)\\n external\\n view\\n returns (address);\\n\\n /**\\n * @notice Resolves a name and version to an address. Reverts if there is no registry with given name and version.\\n * @param name address of the registry you want to resolve to\\n * @param version version of the registry you want to resolve to\\n */\\n function resolveNameAndVersionToAddress(bytes32 name, uint256 version)\\n external\\n view\\n returns (address);\\n\\n /**\\n * @notice Resolves a name to an array of all addresses. Reverts if no match is found.\\n * @param name name for the registry\\n * @return address address of the latest registry with the matching name\\n */\\n function resolveNameToAllAddresses(bytes32 name)\\n external\\n view\\n returns (address[] memory);\\n\\n /**\\n * @notice Resolves an address to registry entry data.\\n * @param registryAddress address of a registry you want to resolve\\n * @return name name of the resolved registry\\n * @return version version of the resolved registry\\n * @return isLatest boolean flag of whether the given address is the latest version of the given registries with\\n * matching name\\n */\\n function resolveAddressToRegistryData(address registryAddress)\\n external\\n view\\n returns (\\n bytes32 name,\\n uint256 version,\\n bool isLatest\\n );\\n}\\n\",\"keccak256\":\"0x0e403d7e259003f3826b3009ae3e39344706d7af8a0a5bd48ba45a6ca978226b\",\"license\":\"MIT\"},\"contracts/registries/MasterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport \\\"../helper/BaseBoringBatchable.sol\\\";\\nimport \\\"../interfaces/IMasterRegistry.sol\\\";\\n\\n/**\\n * @title MasterRegistry\\n * @notice This contract holds list of other registries or contracts and its historical versions.\\n */\\ncontract MasterRegistry is AccessControl, IMasterRegistry, BaseBoringBatchable {\\n /// @notice Role responsible for adding registries.\\n bytes32 public constant SADDLE_MANAGER_ROLE =\\n keccak256(\\\"SADDLE_MANAGER_ROLE\\\");\\n\\n mapping(bytes32 => address[]) private registryMap;\\n mapping(address => ReverseRegistryData) private reverseRegistry;\\n\\n /**\\n * @notice Add a new registry entry to the master list.\\n * @param name address of the added pool\\n * @param registryAddress address of the registry\\n * @param version version of the registry\\n */\\n event AddRegistry(\\n bytes32 indexed name,\\n address registryAddress,\\n uint256 version\\n );\\n\\n constructor(address admin) public {\\n _setupRole(DEFAULT_ADMIN_ROLE, admin);\\n _setupRole(SADDLE_MANAGER_ROLE, msg.sender);\\n }\\n\\n /// @inheritdoc IMasterRegistry\\n function addRegistry(bytes32 registryName, address registryAddress)\\n external\\n payable\\n override\\n {\\n require(\\n hasRole(SADDLE_MANAGER_ROLE, msg.sender),\\n \\\"MR: msg.sender is not allowed\\\"\\n );\\n require(registryName != 0, \\\"MR: name cannot be empty\\\");\\n require(registryAddress != address(0), \\\"MR: address cannot be empty\\\");\\n\\n address[] storage registry = registryMap[registryName];\\n uint256 version = registry.length;\\n registry.push(registryAddress);\\n require(\\n reverseRegistry[registryAddress].name == 0,\\n \\\"MR: duplicate registry address\\\"\\n );\\n reverseRegistry[registryAddress] = ReverseRegistryData(\\n registryName,\\n version\\n );\\n\\n emit AddRegistry(registryName, registryAddress, version);\\n }\\n\\n /// @inheritdoc IMasterRegistry\\n function resolveNameToLatestAddress(bytes32 name)\\n external\\n view\\n override\\n returns (address)\\n {\\n address[] storage registry = registryMap[name];\\n uint256 length = registry.length;\\n require(length > 0, \\\"MR: no match found for name\\\");\\n return registry[length - 1];\\n }\\n\\n /// @inheritdoc IMasterRegistry\\n function resolveNameAndVersionToAddress(bytes32 name, uint256 version)\\n external\\n view\\n override\\n returns (address)\\n {\\n address[] storage registry = registryMap[name];\\n require(\\n version < registry.length,\\n \\\"MR: no match found for name and version\\\"\\n );\\n return registry[version];\\n }\\n\\n /// @inheritdoc IMasterRegistry\\n function resolveNameToAllAddresses(bytes32 name)\\n external\\n view\\n override\\n returns (address[] memory)\\n {\\n address[] storage registry = registryMap[name];\\n require(registry.length > 0, \\\"MR: no match found for name\\\");\\n return registry;\\n }\\n\\n /// @inheritdoc IMasterRegistry\\n function resolveAddressToRegistryData(address registryAddress)\\n external\\n view\\n override\\n returns (\\n bytes32 name,\\n uint256 version,\\n bool isLatest\\n )\\n {\\n ReverseRegistryData memory data = reverseRegistry[registryAddress];\\n require(data.name != 0, \\\"MR: no match found for address\\\");\\n name = data.name;\\n version = data.version;\\n uint256 length = registryMap[name].length;\\n require(length > 0, \\\"MR: no version found for address\\\");\\n isLatest = version == length - 1;\\n }\\n}\\n\",\"keccak256\":\"0xc28c337e4486a0c1c20093655db19435bd2f0b507c23b50437bc030a8ce1af7e\",\"license\":\"MIT\"}},\"version\":1}", @@ -744,4 +742,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/MetaSwapDepositV1.json b/deployments/base_testnet/MetaSwapDepositV1.json index a6bc8dda..690737fc 100644 --- a/deployments/base_testnet/MetaSwapDepositV1.json +++ b/deployments/base_testnet/MetaSwapDepositV1.json @@ -709,4 +709,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/MetaSwapUtilsV1.json b/deployments/base_testnet/MetaSwapUtilsV1.json index 25151352..1eac31b9 100644 --- a/deployments/base_testnet/MetaSwapUtilsV1.json +++ b/deployments/base_testnet/MetaSwapUtilsV1.json @@ -440,4 +440,4 @@ "storage": [], "types": null } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/PermissionlessDeployer.json b/deployments/base_testnet/PermissionlessDeployer.json index c2d30750..9aeb7b48 100644 --- a/deployments/base_testnet/PermissionlessDeployer.json +++ b/deployments/base_testnet/PermissionlessDeployer.json @@ -1085,4 +1085,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/PermissionlessMetaSwapV1.json b/deployments/base_testnet/PermissionlessMetaSwapV1.json index e088e25c..b501d180 100644 --- a/deployments/base_testnet/PermissionlessMetaSwapV1.json +++ b/deployments/base_testnet/PermissionlessMetaSwapV1.json @@ -1143,9 +1143,7 @@ "status": 1, "byzantium": true }, - "args": [ - "0x9cDeF6e33687F438808766fC133b2E9d1A16AD57" - ], + "args": ["0x9cDeF6e33687F438808766fC133b2E9d1A16AD57"], "numDeployments": 1, "solcInputHash": "bc3a64a5cffb1e8de0dbf9fb306e4f9f", "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IMasterRegistry\",\"name\":\"_masterRegistry\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenAmounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"fees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"invariant\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"}],\"name\":\"AddLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newAdminFee\",\"type\":\"uint256\"}],\"name\":\"NewAdminFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSwapFee\",\"type\":\"uint256\"}],\"name\":\"NewSwapFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newWithdrawFee\",\"type\":\"uint256\"}],\"name\":\"NewWithdrawFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldA\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newA\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"initialTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"futureTime\",\"type\":\"uint256\"}],\"name\":\"RampA\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenAmounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"}],\"name\":\"RemoveLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenAmounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"fees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"invariant\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"}],\"name\":\"RemoveLiquidityImbalance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"boughtId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensBought\",\"type\":\"uint256\"}],\"name\":\"RemoveLiquidityOne\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"currentA\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"StopRampA\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"buyer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensSold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensBought\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"soldId\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"boughtId\",\"type\":\"uint128\"}],\"name\":\"TokenSwap\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"buyer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensSold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensBought\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"soldId\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"boughtId\",\"type\":\"uint128\"}],\"name\":\"TokenSwapUnderlying\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FEE_COLLECTOR_NAME\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MASTER_REGISTRY\",\"outputs\":[{\"internalType\":\"contract IMasterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"minToMint\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"calculateRemoveLiquidity\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndex\",\"type\":\"uint8\"}],\"name\":\"calculateRemoveLiquidityOneToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenIndexFrom\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndexTo\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dx\",\"type\":\"uint256\"}],\"name\":\"calculateSwap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenIndexFrom\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndexTo\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dx\",\"type\":\"uint256\"}],\"name\":\"calculateSwapUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"deposit\",\"type\":\"bool\"}],\"name\":\"calculateTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeCollector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getA\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAPrecise\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getAdminBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"getToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"getTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"getTokenIndex\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVirtualPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"_pooledTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint8[]\",\"name\":\"decimals\",\"type\":\"uint8[]\"},{\"internalType\":\"string\",\"name\":\"lpTokenName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"lpTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_a\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_adminFee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpTokenTargetAddress\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"_pooledTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint8[]\",\"name\":\"decimals\",\"type\":\"uint8[]\"},{\"internalType\":\"string\",\"name\":\"lpTokenName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"lpTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_a\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_adminFee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpTokenTargetAddress\",\"type\":\"address\"},{\"internalType\":\"contract ISwap\",\"name\":\"baseSwap\",\"type\":\"address\"}],\"name\":\"initializeMetaSwap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"metaSwapStorage\",\"outputs\":[{\"internalType\":\"contract ISwap\",\"name\":\"baseSwap\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"baseVirtualPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseCacheLastUpdated\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"futureA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"futureTime\",\"type\":\"uint256\"}],\"name\":\"rampA\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"minAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidity\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"maxBurnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"minAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityOneToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newAdminFee\",\"type\":\"uint256\"}],\"name\":\"setAdminFee\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newSwapFee\",\"type\":\"uint256\"}],\"name\":\"setSwapFee\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stopRampA\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenIndexFrom\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndexTo\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDy\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapStorage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"initialA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"futureA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initialATime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"futureATime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"swapFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"adminFee\",\"type\":\"uint256\"},{\"internalType\":\"contract LPToken\",\"name\":\"lpToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenIndexFrom\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndexTo\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDy\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swapUnderlying\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateFeeCollectorCache\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawAdminFees\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Most of the logic is stored as a library `MetaSwapUtils` for the sake of reducing contract's deployment size.\",\"kind\":\"dev\",\"methods\":{\"addLiquidity(uint256[],uint256,uint256)\":{\"params\":{\"amounts\":\"the amounts of each token to add, in their native precision\",\"deadline\":\"latest timestamp to accept this transaction\",\"minToMint\":\"the minimum LP tokens adding this amount of liquidity should mint, otherwise revert. Handy for front-running mitigation\"},\"returns\":{\"_0\":\"amount of LP token user minted and received\"}},\"calculateRemoveLiquidity(uint256)\":{\"params\":{\"amount\":\"the amount of LP tokens that would be burned on withdrawal\"},\"returns\":{\"_0\":\"array of token balances that the user will receive\"}},\"calculateRemoveLiquidityOneToken(uint256,uint8)\":{\"params\":{\"tokenAmount\":\"the amount of LP token to burn\",\"tokenIndex\":\"index of which token will be withdrawn\"},\"returns\":{\"_0\":\"availableTokenAmount calculated amount of underlying token available to withdraw\"}},\"calculateSwap(uint8,uint8,uint256)\":{\"params\":{\"dx\":\"the amount of tokens the user wants to sell. If the token charges a fee on transfers, use the amount that gets transferred after the fee.\",\"tokenIndexFrom\":\"the token the user wants to sell\",\"tokenIndexTo\":\"the token the user wants to buy\"},\"returns\":{\"_0\":\"amount of tokens the user will receive\"}},\"calculateSwapUnderlying(uint8,uint8,uint256)\":{\"params\":{\"dx\":\"the amount of tokens the user wants to sell. If the token charges a fee on transfers, use the amount that gets transferred after the fee.\",\"tokenIndexFrom\":\"the token the user wants to sell\",\"tokenIndexTo\":\"the token the user wants to buy\"},\"returns\":{\"_0\":\"amount of tokens the user will receive\"}},\"calculateTokenAmount(uint256[],bool)\":{\"details\":\"This shouldn't be used outside frontends for user estimates.\",\"params\":{\"amounts\":\"an array of token amounts to deposit or withdrawal, corresponding to pooledTokens. The amount should be in each pooled token's native precision. If a token charges a fee on transfers, use the amount that gets transferred after the fee.\",\"deposit\":\"whether this is a deposit or a withdrawal\"},\"returns\":{\"_0\":\"token amount the user will receive\"}},\"constructor\":{\"params\":{\"_masterRegistry\":\"address of the MasterRegistry contract\"}},\"getA()\":{\"details\":\"See the StableSwap paper for details\",\"returns\":{\"_0\":\"A parameter\"}},\"getAPrecise()\":{\"details\":\"See the StableSwap paper for details\",\"returns\":{\"_0\":\"A parameter in its raw precision form\"}},\"getAdminBalance(uint256)\":{\"params\":{\"index\":\"Index of the pooled token\"},\"returns\":{\"_0\":\"admin's token balance in the token's precision\"}},\"getToken(uint8)\":{\"params\":{\"index\":\"the index of the token\"},\"returns\":{\"_0\":\"address of the token at given index\"}},\"getTokenBalance(uint8)\":{\"params\":{\"index\":\"the index of the token\"},\"returns\":{\"_0\":\"current balance of the pooled token at given index with token's native precision\"}},\"getTokenIndex(address)\":{\"params\":{\"tokenAddress\":\"address of the token\"},\"returns\":{\"_0\":\"the index of the given token address\"}},\"getVirtualPrice()\":{\"returns\":{\"_0\":\"the virtual price, scaled to the POOL_PRECISION_DECIMALS\"}},\"initialize(address[],uint8[],string,string,uint256,uint256,uint256,address)\":{\"params\":{\"_a\":\"the amplification coefficient * n * (n - 1). See the StableSwap paper for details\",\"_adminFee\":\"default adminFee to be initialized with\",\"_fee\":\"default swap fee to be initialized with\",\"_pooledTokens\":\"an array of ERC20s this pool will accept\",\"decimals\":\"the decimals to use for each pooled token, eg 8 for WBTC. Cannot be larger than POOL_PRECISION_DECIMALS\",\"lpTokenName\":\"the long-form name of the token to be deployed\",\"lpTokenSymbol\":\"the short symbol for the token to be deployed\"}},\"initializeMetaSwap(address[],uint8[],string,string,uint256,uint256,uint256,address,address)\":{\"params\":{\"_a\":\"the amplification coefficient * n * (n - 1). See the StableSwap paper for details\",\"_adminFee\":\"default adminFee to be initialized with\",\"_fee\":\"default swap fee to be initialized with\",\"_pooledTokens\":\"an array of ERC20s this pool will accept. The last element must be an existing Swap pool's LP token's address.\",\"decimals\":\"the decimals to use for each pooled token, eg 8 for WBTC. Cannot be larger than POOL_PRECISION_DECIMALS\",\"lpTokenName\":\"the long-form name of the token to be deployed\",\"lpTokenSymbol\":\"the short symbol for the token to be deployed\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"rampA(uint256,uint256)\":{\"params\":{\"futureA\":\"the new A to ramp towards\",\"futureTime\":\"timestamp when the new A should be reached\"}},\"removeLiquidity(uint256,uint256[],uint256)\":{\"details\":\"Liquidity can always be removed, even when the pool is paused.\",\"params\":{\"amount\":\"the amount of LP tokens to burn\",\"deadline\":\"latest timestamp to accept this transaction\",\"minAmounts\":\"the minimum amounts of each token in the pool acceptable for this burn. Useful as a front-running mitigation\"},\"returns\":{\"_0\":\"amounts of tokens user received\"}},\"removeLiquidityImbalance(uint256[],uint256,uint256)\":{\"params\":{\"amounts\":\"how much of each token to withdraw\",\"deadline\":\"latest timestamp to accept this transaction\",\"maxBurnAmount\":\"the max LP token provider is willing to pay to remove liquidity. Useful as a front-running mitigation.\"},\"returns\":{\"_0\":\"amount of LP tokens burned\"}},\"removeLiquidityOneToken(uint256,uint8,uint256,uint256)\":{\"params\":{\"deadline\":\"latest timestamp to accept this transaction\",\"minAmount\":\"the minimum amount to withdraw, otherwise revert\",\"tokenAmount\":\"the amount of the token you want to receive\",\"tokenIndex\":\"the index of the token you want to receive\"},\"returns\":{\"_0\":\"amount of chosen token user received\"}},\"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.\"},\"setAdminFee(uint256)\":{\"params\":{\"newAdminFee\":\"new admin fee to be applied on future transactions\"}},\"setSwapFee(uint256)\":{\"params\":{\"newSwapFee\":\"new swap fee to be applied on future transactions\"}},\"swap(uint8,uint8,uint256,uint256,uint256)\":{\"params\":{\"deadline\":\"latest timestamp to accept this transaction\",\"dx\":\"the amount of tokens the user wants to swap from\",\"minDy\":\"the min amount the user would like to receive, or revert.\",\"tokenIndexFrom\":\"the token the user wants to swap from\",\"tokenIndexTo\":\"the token the user wants to swap to\"}},\"swapUnderlying(uint8,uint8,uint256,uint256,uint256)\":{\"params\":{\"deadline\":\"latest timestamp to accept this transaction\",\"dx\":\"the amount of tokens the user wants to swap from\",\"minDy\":\"the min amount the user would like to receive, or revert.\",\"tokenIndexFrom\":\"the token the user wants to swap from\",\"tokenIndexTo\":\"the token the user wants to swap to\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"MetaSwap - A StableSwap implementation in solidity.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addLiquidity(uint256[],uint256,uint256)\":{\"notice\":\"Add liquidity to the pool with the given amounts of tokens\"},\"calculateRemoveLiquidity(uint256)\":{\"notice\":\"A simple method to calculate amount of each underlying tokens that is returned upon burning given amount of LP tokens\"},\"calculateRemoveLiquidityOneToken(uint256,uint8)\":{\"notice\":\"Calculate the amount of underlying token available to withdraw when withdrawing via only single token\"},\"calculateSwap(uint8,uint8,uint256)\":{\"notice\":\"Calculate amount of tokens you receive on swap\"},\"calculateSwapUnderlying(uint8,uint8,uint256)\":{\"notice\":\"Calculate amount of tokens you receive on swap. For this function, the token indices are flattened out so that underlying tokens are represented.\"},\"calculateTokenAmount(uint256[],bool)\":{\"notice\":\"A simple method to calculate prices from deposits or withdrawals, excluding fees but including slippage. This is helpful as an input into the various \\\"min\\\" parameters on calls to fight front-running\"},\"constructor\":\"Constructor for the PermissionlessSwap contract.\",\"getA()\":{\"notice\":\"Return A, the amplification coefficient * n * (n - 1)\"},\"getAPrecise()\":{\"notice\":\"Return A in its raw precision form\"},\"getAdminBalance(uint256)\":{\"notice\":\"This function reads the accumulated amount of admin fees of the token with given index\"},\"getToken(uint8)\":{\"notice\":\"Return address of the pooled token at given index. Reverts if tokenIndex is out of range.\"},\"getTokenBalance(uint8)\":{\"notice\":\"Return current balance of the pooled token at given index\"},\"getTokenIndex(address)\":{\"notice\":\"Return the index of the given token address. Reverts if no matching token is found.\"},\"getVirtualPrice()\":{\"notice\":\"Get the virtual price, to help calculate profit\"},\"initialize(address[],uint8[],string,string,uint256,uint256,uint256,address)\":{\"notice\":\"This overrides Swap's initialize function to prevent initializing without the address of the base Swap contract.\"},\"initializeMetaSwap(address[],uint8[],string,string,uint256,uint256,uint256,address,address)\":{\"notice\":\"Initializes this MetaSwap contract with the given parameters. MetaSwap uses an existing Swap pool to expand the available liquidity. _pooledTokens array should contain the base Swap pool's LP token as the last element. For example, if there is a Swap pool consisting of [DAI, USDC, USDT]. Then a MetaSwap pool can be created with [sUSD, BaseSwapLPToken] as _pooledTokens. This will also deploy the LPToken that represents users' LP position. The owner of LPToken will be this contract - which means only this contract is allowed to mint new tokens.\"},\"pause()\":{\"notice\":\"Pause the contract. Revert if already paused.\"},\"rampA(uint256,uint256)\":{\"notice\":\"Start ramping up or down A parameter towards given futureA and futureTime Checks if the change is too rapid, and commits the new A value only when it falls under the limit range.\"},\"removeLiquidity(uint256,uint256[],uint256)\":{\"notice\":\"Burn LP tokens to remove liquidity from the pool. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.\"},\"removeLiquidityImbalance(uint256[],uint256,uint256)\":{\"notice\":\"Remove liquidity from the pool, weighted differently than the pool's current balances. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.\"},\"removeLiquidityOneToken(uint256,uint8,uint256,uint256)\":{\"notice\":\"Remove liquidity from the pool all in one token. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.\"},\"setAdminFee(uint256)\":{\"notice\":\"Update the admin fee. Admin fee takes portion of the swap fee.\"},\"setSwapFee(uint256)\":{\"notice\":\"Update the swap fee to be applied on swaps\"},\"stopRampA()\":{\"notice\":\"Stop ramping A immediately. Reverts if ramp A is already stopped.\"},\"swap(uint8,uint8,uint256,uint256,uint256)\":{\"notice\":\"Swap two tokens using this pool\"},\"swapUnderlying(uint8,uint8,uint256,uint256,uint256)\":{\"notice\":\"Swap two tokens using this pool and the base pool.\"},\"unpause()\":{\"notice\":\"Unpause the contract. Revert if already unpaused.\"},\"updateFeeCollectorCache()\":{\"notice\":\"Updates cached address of the fee collector\"},\"withdrawAdminFees()\":{\"notice\":\"Withdraw all admin fees to the contract owner and the fee collector\"}},\"notice\":\"This contract is responsible for custody of closely pegged assets (eg. group of stablecoins) and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens in desired ratios for an exchange of the pool token that represents their share of the pool. Users can burn pool tokens and withdraw their share of token(s). Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets distributed to the LPs. In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which stops the ratio of the tokens in the pool from changing. Users can always withdraw their tokens via multi-asset withdraws. MetaSwap is a modified version of Swap that allows Swap's LP token to be utilized in pooling with other tokens. As an example, if there is a Swap pool consisting of [DAI, USDC, USDT], then a MetaSwap pool can be created with [sUSD, BaseSwapLPToken] to allow trades between either the LP token or the underlying tokens and sUSD. Note that when interacting with MetaSwap, users cannot deposit or withdraw via underlying tokens. In that case, `MetaSwapDeposit.sol` can be additionally deployed to allow interacting with unwrapped representations of the tokens.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/permissionless/PermissionlessMetaSwap.sol\":\"PermissionlessMetaSwap\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMathUpgradeable {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0x0dd1e9b19801e3e7d900fbf4182d81e1afd23ad7be39504e33df6bbcba91d724\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"./ERC20Upgradeable.sol\\\";\\nimport \\\"../../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\\n * tokens and those that they have an allowance for, in a way that can be\\n * recognized off-chain (via event analysis).\\n */\\nabstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable {\\n function __ERC20Burnable_init() internal initializer {\\n __Context_init_unchained();\\n __ERC20Burnable_init_unchained();\\n }\\n\\n function __ERC20Burnable_init_unchained() internal initializer {\\n }\\n using SafeMathUpgradeable for uint256;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller.\\n *\\n * See {ERC20-_burn}.\\n */\\n function burn(uint256 amount) public virtual {\\n _burn(_msgSender(), amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\\n * allowance.\\n *\\n * See {ERC20-_burn} and {ERC20-allowance}.\\n *\\n * Requirements:\\n *\\n * - the caller must have allowance for ``accounts``'s tokens of at least\\n * `amount`.\\n */\\n function burnFrom(address account, uint256 amount) public virtual {\\n uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, \\\"ERC20: burn amount exceeds allowance\\\");\\n\\n _approve(account, _msgSender(), decreasedAllowance);\\n _burn(account, amount);\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xd0359e87fe2618573f49a95e13d9dbc31521ad64526b135618abb2a2dc362fbe\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"./IERC20Upgradeable.sol\\\";\\nimport \\\"../../math/SafeMathUpgradeable.sol\\\";\\nimport \\\"../../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin guidelines: functions revert instead\\n * of returning `false` on failure. This behavior is nonetheless conventional\\n * and does not conflict with the expectations of ERC20 applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable {\\n using SafeMathUpgradeable for uint256;\\n\\n mapping (address => uint256) private _balances;\\n\\n mapping (address => mapping (address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n uint8 private _decimals;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\\n * a default value of 18.\\n *\\n * To select a different value for {decimals}, use {_setupDecimals}.\\n *\\n * All three of these values are immutable: they can only be set once during\\n * construction.\\n */\\n function __ERC20_init(string memory name_, string memory symbol_) internal initializer {\\n __Context_init_unchained();\\n __ERC20_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {\\n _name = name_;\\n _symbol = symbol_;\\n _decimals = 18;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\\n * called.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \\\"ERC20: transfer amount exceeds allowance\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \\\"ERC20: decreased allowance below zero\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Moves tokens `amount` from `sender` to `recipient`.\\n *\\n * This is internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n _balances[sender] = _balances[sender].sub(amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n _balances[recipient] = _balances[recipient].add(amount);\\n emit Transfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply = _totalSupply.add(amount);\\n _balances[account] = _balances[account].add(amount);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n _balances[account] = _balances[account].sub(amount, \\\"ERC20: burn amount exceeds balance\\\");\\n _totalSupply = _totalSupply.sub(amount);\\n emit Transfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Sets {decimals} to a value other than the default one of 18.\\n *\\n * WARNING: This function should only be called from the constructor. Most\\n * applications that interact with token contracts will not expect\\n * {decimals} to ever change, and may work incorrectly if it does.\\n */\\n function _setupDecimals(uint8 decimals_) internal virtual {\\n _decimals = decimals_;\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\\n uint256[44] private __gap;\\n}\\n\",\"keccak256\":\"0x506dd0718f9ace50588c13848167df5e04ae16abb56341afb10c31ff149bc79b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xa1931c47a617014f858580db625aa0dcf343796f39acd4b5b51effc092a1f0a9\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `master`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address master) internal returns (address instance) {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, master))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\\n instance := create(0, ptr, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `master`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `master` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address master, bytes32 salt) internal returns (address instance) {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, master))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\\n instance := create2(0, ptr, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(address master, bytes32 salt, address deployer) internal pure returns (address predicted) {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, master))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)\\n mstore(add(ptr, 0x38), shl(0x60, deployer))\\n mstore(add(ptr, 0x4c), salt)\\n mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))\\n predicted := keccak256(add(ptr, 0x37), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(address master, bytes32 salt) internal view returns (address predicted) {\\n return predictDeterministicAddress(master, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x0d24348f536f928d8b42789737bf34762faee065667ab530ea20969a9d9920d1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"../../math/SafeMath.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin guidelines: functions revert instead\\n * of returning `false` on failure. This behavior is nonetheless conventional\\n * and does not conflict with the expectations of ERC20 applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20 {\\n using SafeMath for uint256;\\n\\n mapping (address => uint256) private _balances;\\n\\n mapping (address => mapping (address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n uint8 private _decimals;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\\n * a default value of 18.\\n *\\n * To select a different value for {decimals}, use {_setupDecimals}.\\n *\\n * All three of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor (string memory name_, string memory symbol_) public {\\n _name = name_;\\n _symbol = symbol_;\\n _decimals = 18;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\\n * called.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \\\"ERC20: transfer amount exceeds allowance\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \\\"ERC20: decreased allowance below zero\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Moves tokens `amount` from `sender` to `recipient`.\\n *\\n * This is internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n _balances[sender] = _balances[sender].sub(amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n _balances[recipient] = _balances[recipient].add(amount);\\n emit Transfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply = _totalSupply.add(amount);\\n _balances[account] = _balances[account].add(amount);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n _balances[account] = _balances[account].sub(amount, \\\"ERC20: burn amount exceeds balance\\\");\\n _totalSupply = _totalSupply.sub(amount);\\n emit Transfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Sets {decimals} to a value other than the default one of 18.\\n *\\n * WARNING: This function should only be called from the constructor. Most\\n * applications that interact with token contracts will not expect\\n * {decimals} to ever change, and may work incorrectly if it does.\\n */\\n function _setupDecimals(uint8 decimals_) internal virtual {\\n _decimals = decimals_;\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\\n}\\n\",\"keccak256\":\"0xca0c2396dbeb3503b51abf4248ebf77a1461edad513c01529df51850a012bee3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x5f02220344881ce43204ae4a6281145a67bc52c2bb1290a791857df3d19d78f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"../../math/SafeMath.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using SafeMath for uint256;\\n using Address for address;\\n\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n // solhint-disable-next-line max-line-length\\n require((value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) { // Return data is optional\\n // solhint-disable-next-line max-line-length\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf12dfbe97e6276980b83d2830bb0eb75e0cf4f3e626c2471137f82158ae6a0fc\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x28911e614500ae7c607a432a709d35da25f3bc5ddc8bd12b278b66358070c0ea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/AmplificationUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"./SwapUtils.sol\\\";\\n\\n/**\\n * @title AmplificationUtils library\\n * @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct.\\n * This library assumes the struct is fully validated.\\n */\\nlibrary AmplificationUtils {\\n using SafeMath for uint256;\\n\\n event RampA(\\n uint256 oldA,\\n uint256 newA,\\n uint256 initialTime,\\n uint256 futureTime\\n );\\n event StopRampA(uint256 currentA, uint256 time);\\n\\n // Constant values used in ramping A calculations\\n uint256 public constant A_PRECISION = 100;\\n uint256 public constant MAX_A = 10**6;\\n uint256 private constant MAX_A_CHANGE = 2;\\n uint256 private constant MIN_RAMP_TIME = 14 days;\\n\\n /**\\n * @notice Return A, the amplification coefficient * n * (n - 1)\\n * @dev See the StableSwap paper for details\\n * @param self Swap struct to read from\\n * @return A parameter\\n */\\n function getA(SwapUtils.Swap storage self) external view returns (uint256) {\\n return _getAPrecise(self).div(A_PRECISION);\\n }\\n\\n /**\\n * @notice Return A in its raw precision\\n * @dev See the StableSwap paper for details\\n * @param self Swap struct to read from\\n * @return A parameter in its raw precision form\\n */\\n function getAPrecise(SwapUtils.Swap storage self)\\n external\\n view\\n returns (uint256)\\n {\\n return _getAPrecise(self);\\n }\\n\\n /**\\n * @notice Return A in its raw precision\\n * @dev See the StableSwap paper for details\\n * @param self Swap struct to read from\\n * @return A parameter in its raw precision form\\n */\\n function _getAPrecise(SwapUtils.Swap storage self)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 t1 = self.futureATime; // time when ramp is finished\\n uint256 a1 = self.futureA; // final A value when ramp is finished\\n\\n if (block.timestamp < t1) {\\n uint256 t0 = self.initialATime; // time when ramp is started\\n uint256 a0 = self.initialA; // initial A value when ramp is started\\n if (a1 > a0) {\\n // a0 + (a1 - a0) * (block.timestamp - t0) / (t1 - t0)\\n return\\n a0.add(\\n a1.sub(a0).mul(block.timestamp.sub(t0)).div(t1.sub(t0))\\n );\\n } else {\\n // a0 - (a0 - a1) * (block.timestamp - t0) / (t1 - t0)\\n return\\n a0.sub(\\n a0.sub(a1).mul(block.timestamp.sub(t0)).div(t1.sub(t0))\\n );\\n }\\n } else {\\n return a1;\\n }\\n }\\n\\n /**\\n * @notice Start ramping up or down A parameter towards given futureA_ and futureTime_\\n * Checks if the change is too rapid, and commits the new A value only when it falls under\\n * the limit range.\\n * @param self Swap struct to update\\n * @param futureA_ the new A to ramp towards\\n * @param futureTime_ timestamp when the new A should be reached\\n */\\n function rampA(\\n SwapUtils.Swap storage self,\\n uint256 futureA_,\\n uint256 futureTime_\\n ) external {\\n require(\\n block.timestamp >= self.initialATime.add(1 days),\\n \\\"Wait 1 day before starting ramp\\\"\\n );\\n require(\\n futureTime_ >= block.timestamp.add(MIN_RAMP_TIME),\\n \\\"Insufficient ramp time\\\"\\n );\\n require(\\n futureA_ > 0 && futureA_ < MAX_A,\\n \\\"futureA_ must be > 0 and < MAX_A\\\"\\n );\\n\\n uint256 initialAPrecise = _getAPrecise(self);\\n uint256 futureAPrecise = futureA_.mul(A_PRECISION);\\n\\n if (futureAPrecise < initialAPrecise) {\\n require(\\n futureAPrecise.mul(MAX_A_CHANGE) >= initialAPrecise,\\n \\\"futureA_ is too small\\\"\\n );\\n } else {\\n require(\\n futureAPrecise <= initialAPrecise.mul(MAX_A_CHANGE),\\n \\\"futureA_ is too large\\\"\\n );\\n }\\n\\n self.initialA = initialAPrecise;\\n self.futureA = futureAPrecise;\\n self.initialATime = block.timestamp;\\n self.futureATime = futureTime_;\\n\\n emit RampA(\\n initialAPrecise,\\n futureAPrecise,\\n block.timestamp,\\n futureTime_\\n );\\n }\\n\\n /**\\n * @notice Stops ramping A immediately. Once this function is called, rampA()\\n * cannot be called for another 24 hours\\n * @param self Swap struct to update\\n */\\n function stopRampA(SwapUtils.Swap storage self) external {\\n require(self.futureATime > block.timestamp, \\\"Ramp is already stopped\\\");\\n\\n uint256 currentA = _getAPrecise(self);\\n self.initialA = currentA;\\n self.futureA = currentA;\\n self.initialATime = block.timestamp;\\n self.futureATime = block.timestamp;\\n\\n emit StopRampA(currentA, block.timestamp);\\n }\\n}\\n\",\"keccak256\":\"0x454f7c599a980fc449ff0f21dee10922262193134ea709f3be50c9d44a7d5385\",\"license\":\"MIT\"},\"contracts/LPToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"./interfaces/ISwap.sol\\\";\\n\\n/**\\n * @title Liquidity Provider Token\\n * @notice This token is an ERC20 detailed token with added capability to be minted by the owner.\\n * It is used to represent user's shares when providing liquidity to swap contracts.\\n * @dev Only Swap contracts should initialize and own LPToken contracts.\\n */\\ncontract LPToken is ERC20BurnableUpgradeable, OwnableUpgradeable {\\n using SafeMathUpgradeable for uint256;\\n\\n /**\\n * @notice Initializes this LPToken contract with the given name and symbol\\n * @dev The caller of this function will become the owner. A Swap contract should call this\\n * in its initializer function.\\n * @param name name of this token\\n * @param symbol symbol of this token\\n */\\n function initialize(string memory name, string memory symbol)\\n external\\n initializer\\n returns (bool)\\n {\\n __Context_init_unchained();\\n __ERC20_init_unchained(name, symbol);\\n __Ownable_init_unchained();\\n return true;\\n }\\n\\n /**\\n * @notice Mints the given amount of LPToken to the recipient.\\n * @dev only owner can call this mint function\\n * @param recipient address of account to receive the tokens\\n * @param amount amount of tokens to mint\\n */\\n function mint(address recipient, uint256 amount) external onlyOwner {\\n require(amount != 0, \\\"LPToken: cannot mint 0\\\");\\n _mint(recipient, amount);\\n }\\n\\n /**\\n * @dev Overrides ERC20._beforeTokenTransfer() which get called on every transfers including\\n * minting and burning. This ensures that Swap.updateUserWithdrawFees are called everytime.\\n * This assumes the owner is set to a Swap contract's address.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual override(ERC20Upgradeable) {\\n super._beforeTokenTransfer(from, to, amount);\\n require(to != address(this), \\\"LPToken: cannot send to itself\\\");\\n }\\n}\\n\",\"keccak256\":\"0x8b16a37e14fd2d387dac20bf1773522b7667402f27a4b301617b928d7b998ac5\",\"license\":\"MIT\"},\"contracts/MathUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\n\\n/**\\n * @title MathUtils library\\n * @notice A library to be used in conjunction with SafeMath. Contains functions for calculating\\n * differences between two uint256.\\n */\\nlibrary MathUtils {\\n /**\\n * @notice Compares a and b and returns true if the difference between a and b\\n * is less than 1 or equal to each other.\\n * @param a uint256 to compare with\\n * @param b uint256 to compare with\\n * @return True if the difference between a and b is less than 1 or equal,\\n * otherwise return false\\n */\\n function within1(uint256 a, uint256 b) internal pure returns (bool) {\\n return (difference(a, b) <= 1);\\n }\\n\\n /**\\n * @notice Calculates absolute difference between a and b\\n * @param a uint256 to compare with\\n * @param b uint256 to compare with\\n * @return Difference between a and b\\n */\\n function difference(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a > b) {\\n return a - b;\\n }\\n return b - a;\\n }\\n}\\n\",\"keccak256\":\"0x455c798b26b679dff11a4ad5d52f7fef85c42d403bd430da443948f65cf000a0\",\"license\":\"MIT\"},\"contracts/OwnerPausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\n\\n/**\\n * @title OwnerPausable\\n * @notice An ownable contract allows the owner to pause and unpause the\\n * contract without a delay.\\n * @dev Only methods using the provided modifiers will be paused.\\n */\\nabstract contract OwnerPausableUpgradeable is\\n OwnableUpgradeable,\\n PausableUpgradeable\\n{\\n function __OwnerPausable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n /**\\n * @notice Pause the contract. Revert if already paused.\\n */\\n function pause() external onlyOwner {\\n PausableUpgradeable._pause();\\n }\\n\\n /**\\n * @notice Unpause the contract. Revert if already unpaused.\\n */\\n function unpause() external onlyOwner {\\n PausableUpgradeable._unpause();\\n }\\n}\\n\",\"keccak256\":\"0xe8d79072ff7e9ec0ade50d81be8681a9fedfabe7b3d3de116e83cb7f4e1446f6\",\"license\":\"MIT\"},\"contracts/Swap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\nimport \\\"./OwnerPausableUpgradeable.sol\\\";\\nimport \\\"./SwapUtils.sol\\\";\\nimport \\\"./AmplificationUtils.sol\\\";\\n\\n/**\\n * @title Swap - A StableSwap implementation in solidity.\\n * @notice This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)\\n * and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens\\n * in desired ratios for an exchange of the pool token that represents their share of the pool.\\n * Users can burn pool tokens and withdraw their share of token(s).\\n *\\n * Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets\\n * distributed to the LPs.\\n *\\n * In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which\\n * stops the ratio of the tokens in the pool from changing.\\n * Users can always withdraw their tokens via multi-asset withdraws.\\n *\\n * @dev Most of the logic is stored as a library `SwapUtils` for the sake of reducing contract's\\n * deployment size.\\n */\\ncontract Swap is OwnerPausableUpgradeable, ReentrancyGuardUpgradeable {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n using SwapUtils for SwapUtils.Swap;\\n using AmplificationUtils for SwapUtils.Swap;\\n\\n // Struct storing data responsible for automatic market maker functionalities. In order to\\n // access this data, this contract uses SwapUtils library. For more details, see SwapUtils.sol\\n SwapUtils.Swap public swapStorage;\\n\\n // Maps token address to an index in the pool. Used to prevent duplicate tokens in the pool.\\n // getTokenIndex function also relies on this mapping to retrieve token index.\\n mapping(address => uint8) private tokenIndexes;\\n\\n /*** EVENTS ***/\\n\\n // events replicated from SwapUtils to make the ABI easier for dumb\\n // clients\\n event TokenSwap(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n event AddLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidityOne(\\n address indexed provider,\\n uint256 lpTokenAmount,\\n uint256 lpTokenSupply,\\n uint256 boughtId,\\n uint256 tokensBought\\n );\\n event RemoveLiquidityImbalance(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event NewAdminFee(uint256 newAdminFee);\\n event NewSwapFee(uint256 newSwapFee);\\n event NewWithdrawFee(uint256 newWithdrawFee);\\n event RampA(\\n uint256 oldA,\\n uint256 newA,\\n uint256 initialTime,\\n uint256 futureTime\\n );\\n event StopRampA(uint256 currentA, uint256 time);\\n\\n /**\\n * @notice Initializes this Swap contract with the given parameters.\\n * This will also clone a LPToken contract that represents users'\\n * LP positions. The owner of LPToken will be this contract - which means\\n * only this contract is allowed to mint/burn tokens.\\n *\\n * @param _pooledTokens an array of ERC20s this pool will accept\\n * @param decimals the decimals to use for each pooled token,\\n * eg 8 for WBTC. Cannot be larger than POOL_PRECISION_DECIMALS\\n * @param lpTokenName the long-form name of the token to be deployed\\n * @param lpTokenSymbol the short symbol for the token to be deployed\\n * @param _a the amplification coefficient * n * (n - 1). See the\\n * StableSwap paper for details\\n * @param _fee default swap fee to be initialized with\\n * @param _adminFee default adminFee to be initialized with\\n * @param lpTokenTargetAddress the address of an existing LPToken contract to use as a target\\n */\\n function initialize(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress\\n ) public payable virtual initializer {\\n __OwnerPausable_init();\\n __ReentrancyGuard_init();\\n // Check _pooledTokens and precisions parameter\\n require(_pooledTokens.length > 1, \\\"_pooledTokens.length <= 1\\\");\\n require(_pooledTokens.length <= 32, \\\"_pooledTokens.length > 32\\\");\\n require(\\n _pooledTokens.length == decimals.length,\\n \\\"_pooledTokens decimals mismatch\\\"\\n );\\n\\n uint256[] memory precisionMultipliers = new uint256[](decimals.length);\\n\\n for (uint8 i = 0; i < _pooledTokens.length; i++) {\\n if (i > 0) {\\n // Check if index is already used. Check if 0th element is a duplicate.\\n require(\\n tokenIndexes[address(_pooledTokens[i])] == 0 &&\\n _pooledTokens[0] != _pooledTokens[i],\\n \\\"Duplicate tokens\\\"\\n );\\n }\\n require(\\n address(_pooledTokens[i]) != address(0),\\n \\\"The 0 address isn't an ERC-20\\\"\\n );\\n require(\\n decimals[i] <= SwapUtils.POOL_PRECISION_DECIMALS,\\n \\\"Token decimals exceeds max\\\"\\n );\\n precisionMultipliers[i] =\\n 10 **\\n uint256(SwapUtils.POOL_PRECISION_DECIMALS).sub(\\n uint256(decimals[i])\\n );\\n tokenIndexes[address(_pooledTokens[i])] = i;\\n }\\n\\n // Check _a, _fee, _adminFee, _withdrawFee parameters\\n require(_a < AmplificationUtils.MAX_A, \\\"_a exceeds maximum\\\");\\n require(_fee < SwapUtils.MAX_SWAP_FEE, \\\"_fee exceeds maximum\\\");\\n require(\\n _adminFee < SwapUtils.MAX_ADMIN_FEE,\\n \\\"_adminFee exceeds maximum\\\"\\n );\\n\\n // Clone and initialize a LPToken contract\\n LPToken lpToken = LPToken(Clones.clone(lpTokenTargetAddress));\\n require(\\n lpToken.initialize(lpTokenName, lpTokenSymbol),\\n \\\"could not init lpToken clone\\\"\\n );\\n\\n // Initialize swapStorage struct\\n swapStorage.lpToken = lpToken;\\n swapStorage.pooledTokens = _pooledTokens;\\n swapStorage.tokenPrecisionMultipliers = precisionMultipliers;\\n swapStorage.balances = new uint256[](_pooledTokens.length);\\n swapStorage.initialA = _a.mul(AmplificationUtils.A_PRECISION);\\n swapStorage.futureA = _a.mul(AmplificationUtils.A_PRECISION);\\n // swapStorage.initialATime = 0;\\n // swapStorage.futureATime = 0;\\n swapStorage.swapFee = _fee;\\n swapStorage.adminFee = _adminFee;\\n }\\n\\n /*** MODIFIERS ***/\\n\\n /**\\n * @notice Modifier to check deadline against current timestamp\\n * @param deadline latest timestamp to accept this transaction\\n */\\n modifier deadlineCheck(uint256 deadline) {\\n require(block.timestamp <= deadline, \\\"Deadline not met\\\");\\n _;\\n }\\n\\n /*** VIEW FUNCTIONS ***/\\n\\n /**\\n * @notice Return A, the amplification coefficient * n * (n - 1)\\n * @dev See the StableSwap paper for details\\n * @return A parameter\\n */\\n function getA() external view virtual returns (uint256) {\\n return swapStorage.getA();\\n }\\n\\n /**\\n * @notice Return A in its raw precision form\\n * @dev See the StableSwap paper for details\\n * @return A parameter in its raw precision form\\n */\\n function getAPrecise() external view virtual returns (uint256) {\\n return swapStorage.getAPrecise();\\n }\\n\\n /**\\n * @notice Return address of the pooled token at given index. Reverts if tokenIndex is out of range.\\n * @param index the index of the token\\n * @return address of the token at given index\\n */\\n function getToken(uint8 index) public view virtual returns (IERC20) {\\n require(index < swapStorage.pooledTokens.length, \\\"Out of range\\\");\\n return swapStorage.pooledTokens[index];\\n }\\n\\n /**\\n * @notice Return the index of the given token address. Reverts if no matching\\n * token is found.\\n * @param tokenAddress address of the token\\n * @return the index of the given token address\\n */\\n function getTokenIndex(address tokenAddress)\\n public\\n view\\n virtual\\n returns (uint8)\\n {\\n uint8 index = tokenIndexes[tokenAddress];\\n require(\\n address(getToken(index)) == tokenAddress,\\n \\\"Token does not exist\\\"\\n );\\n return index;\\n }\\n\\n /**\\n * @notice Return current balance of the pooled token at given index\\n * @param index the index of the token\\n * @return current balance of the pooled token at given index with token's native precision\\n */\\n function getTokenBalance(uint8 index)\\n external\\n view\\n virtual\\n returns (uint256)\\n {\\n require(index < swapStorage.pooledTokens.length, \\\"Index out of range\\\");\\n return swapStorage.balances[index];\\n }\\n\\n /**\\n * @notice Get the virtual price, to help calculate profit\\n * @return the virtual price, scaled to the POOL_PRECISION_DECIMALS\\n */\\n function getVirtualPrice() external view virtual returns (uint256) {\\n return swapStorage.getVirtualPrice();\\n }\\n\\n /**\\n * @notice Calculate amount of tokens you receive on swap\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell. If the token charges\\n * a fee on transfers, use the amount that gets transferred after the fee.\\n * @return amount of tokens the user will receive\\n */\\n function calculateSwap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view virtual returns (uint256) {\\n return swapStorage.calculateSwap(tokenIndexFrom, tokenIndexTo, dx);\\n }\\n\\n /**\\n * @notice A simple method to calculate prices from deposits or\\n * withdrawals, excluding fees but including slippage. This is\\n * helpful as an input into the various \\\"min\\\" parameters on calls\\n * to fight front-running\\n *\\n * @dev This shouldn't be used outside frontends for user estimates.\\n *\\n * @param amounts an array of token amounts to deposit or withdrawal,\\n * corresponding to pooledTokens. The amount should be in each\\n * pooled token's native precision. If a token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param deposit whether this is a deposit or a withdrawal\\n * @return token amount the user will receive\\n */\\n function calculateTokenAmount(uint256[] calldata amounts, bool deposit)\\n external\\n view\\n virtual\\n returns (uint256)\\n {\\n return swapStorage.calculateTokenAmount(amounts, deposit);\\n }\\n\\n /**\\n * @notice A simple method to calculate amount of each underlying\\n * tokens that is returned upon burning given amount of LP tokens\\n * @param amount the amount of LP tokens that would be burned on withdrawal\\n * @return array of token balances that the user will receive\\n */\\n function calculateRemoveLiquidity(uint256 amount)\\n external\\n view\\n virtual\\n returns (uint256[] memory)\\n {\\n return swapStorage.calculateRemoveLiquidity(amount);\\n }\\n\\n /**\\n * @notice Calculate the amount of underlying token available to withdraw\\n * when withdrawing via only single token\\n * @param tokenAmount the amount of LP token to burn\\n * @param tokenIndex index of which token will be withdrawn\\n * @return availableTokenAmount calculated amount of underlying token\\n * available to withdraw\\n */\\n function calculateRemoveLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view virtual returns (uint256 availableTokenAmount) {\\n return swapStorage.calculateWithdrawOneToken(tokenAmount, tokenIndex);\\n }\\n\\n /**\\n * @notice This function reads the accumulated amount of admin fees of the token with given index\\n * @param index Index of the pooled token\\n * @return admin's token balance in the token's precision\\n */\\n function getAdminBalance(uint256 index)\\n external\\n view\\n virtual\\n returns (uint256)\\n {\\n return swapStorage.getAdminBalance(index);\\n }\\n\\n /*** STATE MODIFYING FUNCTIONS ***/\\n\\n /**\\n * @notice Swap two tokens using this pool\\n * @param tokenIndexFrom the token the user wants to swap from\\n * @param tokenIndexTo the token the user wants to swap to\\n * @param dx the amount of tokens the user wants to swap from\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @param deadline latest timestamp to accept this transaction\\n */\\n function swap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return swapStorage.swap(tokenIndexFrom, tokenIndexTo, dx, minDy);\\n }\\n\\n /**\\n * @notice Add liquidity to the pool with the given amounts of tokens\\n * @param amounts the amounts of each token to add, in their native precision\\n * @param minToMint the minimum LP tokens adding this amount of liquidity\\n * should mint, otherwise revert. Handy for front-running mitigation\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of LP token user minted and received\\n */\\n function addLiquidity(\\n uint256[] calldata amounts,\\n uint256 minToMint,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return swapStorage.addLiquidity(amounts, minToMint);\\n }\\n\\n /**\\n * @notice Burn LP tokens to remove liquidity from the pool. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @dev Liquidity can always be removed, even when the pool is paused.\\n * @param amount the amount of LP tokens to burn\\n * @param minAmounts the minimum amounts of each token in the pool\\n * acceptable for this burn. Useful as a front-running mitigation\\n * @param deadline latest timestamp to accept this transaction\\n * @return amounts of tokens user received\\n */\\n function removeLiquidity(\\n uint256 amount,\\n uint256[] calldata minAmounts,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n deadlineCheck(deadline)\\n returns (uint256[] memory)\\n {\\n return swapStorage.removeLiquidity(amount, minAmounts);\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool all in one token. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @param tokenAmount the amount of the token you want to receive\\n * @param tokenIndex the index of the token you want to receive\\n * @param minAmount the minimum amount to withdraw, otherwise revert\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of chosen token user received\\n */\\n function removeLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n swapStorage.removeLiquidityOneToken(\\n tokenAmount,\\n tokenIndex,\\n minAmount\\n );\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool, weighted differently than the\\n * pool's current balances. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @param amounts how much of each token to withdraw\\n * @param maxBurnAmount the max LP token provider is willing to pay to\\n * remove liquidity. Useful as a front-running mitigation.\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of LP tokens burned\\n */\\n function removeLiquidityImbalance(\\n uint256[] calldata amounts,\\n uint256 maxBurnAmount,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return swapStorage.removeLiquidityImbalance(amounts, maxBurnAmount);\\n }\\n\\n /*** ADMIN FUNCTIONS ***/\\n\\n /**\\n * @notice Withdraw all admin fees to the contract owner\\n */\\n function withdrawAdminFees() external payable virtual onlyOwner {\\n swapStorage.withdrawAdminFees(owner());\\n }\\n\\n /**\\n * @notice Update the admin fee. Admin fee takes portion of the swap fee.\\n * @param newAdminFee new admin fee to be applied on future transactions\\n */\\n function setAdminFee(uint256 newAdminFee) external payable onlyOwner {\\n swapStorage.setAdminFee(newAdminFee);\\n }\\n\\n /**\\n * @notice Update the swap fee to be applied on swaps\\n * @param newSwapFee new swap fee to be applied on future transactions\\n */\\n function setSwapFee(uint256 newSwapFee) external payable onlyOwner {\\n swapStorage.setSwapFee(newSwapFee);\\n }\\n\\n /**\\n * @notice Start ramping up or down A parameter towards given futureA and futureTime\\n * Checks if the change is too rapid, and commits the new A value only when it falls under\\n * the limit range.\\n * @param futureA the new A to ramp towards\\n * @param futureTime timestamp when the new A should be reached\\n */\\n function rampA(uint256 futureA, uint256 futureTime)\\n external\\n payable\\n onlyOwner\\n {\\n swapStorage.rampA(futureA, futureTime);\\n }\\n\\n /**\\n * @notice Stop ramping A immediately. Reverts if ramp A is already stopped.\\n */\\n function stopRampA() external payable onlyOwner {\\n swapStorage.stopRampA();\\n }\\n}\\n\",\"keccak256\":\"0x85aed3b11967ea0195717a6777a5e58ee9cc96f94e6992af002720f2b626840b\",\"license\":\"MIT\"},\"contracts/SwapUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"./AmplificationUtils.sol\\\";\\nimport \\\"./LPToken.sol\\\";\\nimport \\\"./MathUtils.sol\\\";\\n\\n/**\\n * @title SwapUtils library\\n * @notice A library to be used within Swap.sol. Contains functions responsible for custody and AMM functionalities.\\n * @dev Contracts relying on this library must initialize SwapUtils.Swap struct then use this library\\n * for SwapUtils.Swap struct. Note that this library contains both functions called by users and admins.\\n * Admin functions should be protected within contracts using this library.\\n */\\nlibrary SwapUtils {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n using MathUtils for uint256;\\n\\n /*** EVENTS ***/\\n\\n event TokenSwap(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n event AddLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidityOne(\\n address indexed provider,\\n uint256 lpTokenAmount,\\n uint256 lpTokenSupply,\\n uint256 boughtId,\\n uint256 tokensBought\\n );\\n event RemoveLiquidityImbalance(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event NewAdminFee(uint256 newAdminFee);\\n event NewSwapFee(uint256 newSwapFee);\\n\\n struct Swap {\\n // variables around the ramp management of A,\\n // the amplification coefficient * n * (n - 1)\\n // see https://www.curve.fi/stableswap-paper.pdf for details\\n uint256 initialA;\\n uint256 futureA;\\n uint256 initialATime;\\n uint256 futureATime;\\n // fee calculation\\n uint256 swapFee;\\n uint256 adminFee;\\n LPToken lpToken;\\n // contract references for all tokens being pooled\\n IERC20[] pooledTokens;\\n // multipliers for each pooled token's precision to get to POOL_PRECISION_DECIMALS\\n // for example, TBTC has 18 decimals, so the multiplier should be 1. WBTC\\n // has 8, so the multiplier should be 10 ** 18 / 10 ** 8 => 10 ** 10\\n uint256[] tokenPrecisionMultipliers;\\n // the pool balance of each token, in the token's precision\\n // the contract's actual token balance might differ\\n uint256[] balances;\\n }\\n\\n // Struct storing variables used in calculations in the\\n // calculateWithdrawOneTokenDY function to avoid stack too deep errors\\n struct CalculateWithdrawOneTokenDYInfo {\\n uint256 d0;\\n uint256 d1;\\n uint256 newY;\\n uint256 feePerToken;\\n uint256 preciseA;\\n }\\n\\n // Struct storing variables used in calculations in the\\n // {add,remove}Liquidity functions to avoid stack too deep errors\\n struct ManageLiquidityInfo {\\n uint256 d0;\\n uint256 d1;\\n uint256 d2;\\n uint256 preciseA;\\n LPToken lpToken;\\n uint256 totalSupply;\\n uint256[] balances;\\n uint256[] multipliers;\\n }\\n\\n // the precision all pools tokens will be converted to\\n uint8 public constant POOL_PRECISION_DECIMALS = 18;\\n\\n // the denominator used to calculate admin and LP fees. For example, an\\n // LP fee might be something like tradeAmount.mul(fee).div(FEE_DENOMINATOR)\\n uint256 private constant FEE_DENOMINATOR = 10**10;\\n\\n // Max swap fee is 1% or 100bps of each swap\\n uint256 public constant MAX_SWAP_FEE = 10**8;\\n\\n // Max adminFee is 100% of the swapFee\\n // adminFee does not add additional fee on top of swapFee\\n // Instead it takes a certain % of the swapFee. Therefore it has no impact on the\\n // users but only on the earnings of LPs\\n uint256 public constant MAX_ADMIN_FEE = 10**10;\\n\\n // Constant value used as max loop limit\\n uint256 private constant MAX_LOOP_LIMIT = 256;\\n\\n /*** VIEW & PURE FUNCTIONS ***/\\n\\n function _getAPrecise(Swap storage self) internal view returns (uint256) {\\n return AmplificationUtils._getAPrecise(self);\\n }\\n\\n /**\\n * @notice Calculate the dy, the amount of selected token that user receives and\\n * the fee of withdrawing in one token\\n * @param tokenAmount the amount to withdraw in the pool's precision\\n * @param tokenIndex which token will be withdrawn\\n * @param self Swap struct to read from\\n * @return the amount of token user will receive\\n */\\n function calculateWithdrawOneToken(\\n Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view returns (uint256) {\\n (uint256 availableTokenAmount, ) = _calculateWithdrawOneToken(\\n self,\\n tokenAmount,\\n tokenIndex,\\n self.lpToken.totalSupply()\\n );\\n return availableTokenAmount;\\n }\\n\\n function _calculateWithdrawOneToken(\\n Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 totalSupply\\n ) internal view returns (uint256, uint256) {\\n uint256 dy;\\n uint256 newY;\\n uint256 currentY;\\n\\n (dy, newY, currentY) = calculateWithdrawOneTokenDY(\\n self,\\n tokenIndex,\\n tokenAmount,\\n totalSupply\\n );\\n\\n // dy_0 (without fees)\\n // dy, dy_0 - dy\\n\\n uint256 dySwapFee = currentY\\n .sub(newY)\\n .div(self.tokenPrecisionMultipliers[tokenIndex])\\n .sub(dy);\\n\\n return (dy, dySwapFee);\\n }\\n\\n /**\\n * @notice Calculate the dy of withdrawing in one token\\n * @param self Swap struct to read from\\n * @param tokenIndex which token will be withdrawn\\n * @param tokenAmount the amount to withdraw in the pools precision\\n * @return the d and the new y after withdrawing one token\\n */\\n function calculateWithdrawOneTokenDY(\\n Swap storage self,\\n uint8 tokenIndex,\\n uint256 tokenAmount,\\n uint256 totalSupply\\n )\\n internal\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256\\n )\\n {\\n // Get the current D, then solve the stableswap invariant\\n // y_i for D - tokenAmount\\n uint256[] memory xp = _xp(self);\\n\\n require(tokenIndex < xp.length, \\\"Token index out of range\\\");\\n\\n CalculateWithdrawOneTokenDYInfo\\n memory v = CalculateWithdrawOneTokenDYInfo(0, 0, 0, 0, 0);\\n v.preciseA = _getAPrecise(self);\\n v.d0 = getD(xp, v.preciseA);\\n v.d1 = v.d0.sub(tokenAmount.mul(v.d0).div(totalSupply));\\n\\n require(tokenAmount <= xp[tokenIndex], \\\"Withdraw exceeds available\\\");\\n\\n v.newY = getYD(v.preciseA, tokenIndex, xp, v.d1);\\n\\n uint256[] memory xpReduced = new uint256[](xp.length);\\n\\n v.feePerToken = _feePerToken(self.swapFee, xp.length);\\n for (uint256 i = 0; i < xp.length; i++) {\\n uint256 xpi = xp[i];\\n // if i == tokenIndex, dxExpected = xp[i] * d1 / d0 - newY\\n // else dxExpected = xp[i] - (xp[i] * d1 / d0)\\n // xpReduced[i] -= dxExpected * fee / FEE_DENOMINATOR\\n xpReduced[i] = xpi.sub(\\n (\\n (i == tokenIndex)\\n ? xpi.mul(v.d1).div(v.d0).sub(v.newY)\\n : xpi.sub(xpi.mul(v.d1).div(v.d0))\\n ).mul(v.feePerToken).div(FEE_DENOMINATOR)\\n );\\n }\\n\\n uint256 dy = xpReduced[tokenIndex].sub(\\n getYD(v.preciseA, tokenIndex, xpReduced, v.d1)\\n );\\n dy = dy.sub(1).div(self.tokenPrecisionMultipliers[tokenIndex]);\\n\\n return (dy, v.newY, xp[tokenIndex]);\\n }\\n\\n /**\\n * @notice Calculate the price of a token in the pool with given\\n * precision-adjusted balances and a particular D.\\n *\\n * @dev This is accomplished via solving the invariant iteratively.\\n * See the StableSwap paper and Curve.fi implementation for further details.\\n *\\n * x_1**2 + x1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)\\n * x_1**2 + b*x_1 = c\\n * x_1 = (x_1**2 + c) / (2*x_1 + b)\\n *\\n * @param a the amplification coefficient * n * (n - 1). See the StableSwap paper for details.\\n * @param tokenIndex Index of token we are calculating for.\\n * @param xp a precision-adjusted set of pool balances. Array should be\\n * the same cardinality as the pool.\\n * @param d the stableswap invariant\\n * @return the price of the token, in the same precision as in xp\\n */\\n function getYD(\\n uint256 a,\\n uint8 tokenIndex,\\n uint256[] memory xp,\\n uint256 d\\n ) internal pure returns (uint256) {\\n uint256 numTokens = xp.length;\\n require(tokenIndex < numTokens, \\\"Token not found\\\");\\n\\n uint256 c = d;\\n uint256 s;\\n uint256 nA = a.mul(numTokens);\\n\\n for (uint256 i = 0; i < numTokens; i++) {\\n if (i != tokenIndex) {\\n s = s.add(xp[i]);\\n c = c.mul(d).div(xp[i].mul(numTokens));\\n // If we were to protect the division loss we would have to keep the denominator separate\\n // and divide at the end. However this leads to overflow with large numTokens or/and D.\\n // c = c * D * D * D * ... overflow!\\n }\\n }\\n c = c.mul(d).mul(AmplificationUtils.A_PRECISION).div(nA.mul(numTokens));\\n\\n uint256 b = s.add(d.mul(AmplificationUtils.A_PRECISION).div(nA));\\n uint256 yPrev;\\n uint256 y = d;\\n for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {\\n yPrev = y;\\n y = y.mul(y).add(c).div(y.mul(2).add(b).sub(d));\\n if (y.within1(yPrev)) {\\n return y;\\n }\\n }\\n revert(\\\"Approximation did not converge\\\");\\n }\\n\\n /**\\n * @notice Get D, the StableSwap invariant, based on a set of balances and a particular A.\\n * @param xp a precision-adjusted set of pool balances. Array should be the same cardinality\\n * as the pool.\\n * @param a the amplification coefficient * n * (n - 1) in A_PRECISION.\\n * See the StableSwap paper for details\\n * @return the invariant, at the precision of the pool\\n */\\n function getD(uint256[] memory xp, uint256 a)\\n internal\\n pure\\n returns (uint256)\\n {\\n uint256 numTokens = xp.length;\\n uint256 s;\\n for (uint256 i = 0; i < numTokens; i++) {\\n s = s.add(xp[i]);\\n }\\n if (s == 0) {\\n return 0;\\n }\\n\\n uint256 prevD;\\n uint256 d = s;\\n uint256 nA = a.mul(numTokens);\\n\\n for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {\\n uint256 dP = d;\\n for (uint256 j = 0; j < numTokens; j++) {\\n dP = dP.mul(d).div(xp[j].mul(numTokens));\\n // If we were to protect the division loss we would have to keep the denominator separate\\n // and divide at the end. However this leads to overflow with large numTokens or/and D.\\n // dP = dP * D * D * D * ... overflow!\\n }\\n prevD = d;\\n d = nA\\n .mul(s)\\n .div(AmplificationUtils.A_PRECISION)\\n .add(dP.mul(numTokens))\\n .mul(d)\\n .div(\\n nA\\n .sub(AmplificationUtils.A_PRECISION)\\n .mul(d)\\n .div(AmplificationUtils.A_PRECISION)\\n .add(numTokens.add(1).mul(dP))\\n );\\n if (d.within1(prevD)) {\\n return d;\\n }\\n }\\n\\n // Convergence should occur in 4 loops or less. If this is reached, there may be something wrong\\n // with the pool. If this were to occur repeatedly, LPs should withdraw via `removeLiquidity()`\\n // function which does not rely on D.\\n revert(\\\"D does not converge\\\");\\n }\\n\\n /**\\n * @notice Given a set of balances and precision multipliers, return the\\n * precision-adjusted balances.\\n *\\n * @param balances an array of token balances, in their native precisions.\\n * These should generally correspond with pooled tokens.\\n *\\n * @param precisionMultipliers an array of multipliers, corresponding to\\n * the amounts in the balances array. When multiplied together they\\n * should yield amounts at the pool's precision.\\n *\\n * @return an array of amounts \\\"scaled\\\" to the pool's precision\\n */\\n function _xp(\\n uint256[] memory balances,\\n uint256[] memory precisionMultipliers\\n ) internal pure returns (uint256[] memory) {\\n uint256 numTokens = balances.length;\\n require(\\n numTokens == precisionMultipliers.length,\\n \\\"Balances must match multipliers\\\"\\n );\\n uint256[] memory xp = new uint256[](numTokens);\\n for (uint256 i = 0; i < numTokens; i++) {\\n xp[i] = balances[i].mul(precisionMultipliers[i]);\\n }\\n return xp;\\n }\\n\\n /**\\n * @notice Return the precision-adjusted balances of all tokens in the pool\\n * @param self Swap struct to read from\\n * @return the pool balances \\\"scaled\\\" to the pool's precision, allowing\\n * them to be more easily compared.\\n */\\n function _xp(Swap storage self) internal view returns (uint256[] memory) {\\n return _xp(self.balances, self.tokenPrecisionMultipliers);\\n }\\n\\n /**\\n * @notice Get the virtual price, to help calculate profit\\n * @param self Swap struct to read from\\n * @return the virtual price, scaled to precision of POOL_PRECISION_DECIMALS\\n */\\n function getVirtualPrice(Swap storage self)\\n external\\n view\\n returns (uint256)\\n {\\n uint256 d = getD(_xp(self), _getAPrecise(self));\\n LPToken lpToken = self.lpToken;\\n uint256 supply = lpToken.totalSupply();\\n if (supply > 0) {\\n return d.mul(10**uint256(POOL_PRECISION_DECIMALS)).div(supply);\\n }\\n return 0;\\n }\\n\\n /**\\n * @notice Calculate the new balances of the tokens given the indexes of the token\\n * that is swapped from (FROM) and the token that is swapped to (TO).\\n * This function is used as a helper function to calculate how much TO token\\n * the user should receive on swap.\\n *\\n * @param preciseA precise form of amplification coefficient\\n * @param tokenIndexFrom index of FROM token\\n * @param tokenIndexTo index of TO token\\n * @param x the new total amount of FROM token\\n * @param xp balances of the tokens in the pool\\n * @return the amount of TO token that should remain in the pool\\n */\\n function getY(\\n uint256 preciseA,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 x,\\n uint256[] memory xp\\n ) internal pure returns (uint256) {\\n uint256 numTokens = xp.length;\\n require(\\n tokenIndexFrom != tokenIndexTo,\\n \\\"Can't compare token to itself\\\"\\n );\\n require(\\n tokenIndexFrom < numTokens && tokenIndexTo < numTokens,\\n \\\"Tokens must be in pool\\\"\\n );\\n\\n uint256 d = getD(xp, preciseA);\\n uint256 c = d;\\n uint256 s;\\n uint256 nA = numTokens.mul(preciseA);\\n\\n uint256 _x;\\n for (uint256 i = 0; i < numTokens; i++) {\\n if (i == tokenIndexFrom) {\\n _x = x;\\n } else if (i != tokenIndexTo) {\\n _x = xp[i];\\n } else {\\n continue;\\n }\\n s = s.add(_x);\\n c = c.mul(d).div(_x.mul(numTokens));\\n // If we were to protect the division loss we would have to keep the denominator separate\\n // and divide at the end. However this leads to overflow with large numTokens or/and D.\\n // c = c * D * D * D * ... overflow!\\n }\\n c = c.mul(d).mul(AmplificationUtils.A_PRECISION).div(nA.mul(numTokens));\\n uint256 b = s.add(d.mul(AmplificationUtils.A_PRECISION).div(nA));\\n uint256 yPrev;\\n uint256 y = d;\\n\\n // iterative approximation\\n for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {\\n yPrev = y;\\n y = y.mul(y).add(c).div(y.mul(2).add(b).sub(d));\\n if (y.within1(yPrev)) {\\n return y;\\n }\\n }\\n revert(\\\"Approximation did not converge\\\");\\n }\\n\\n /**\\n * @notice Externally calculates a swap between two tokens.\\n * @param self Swap struct to read from\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @return dy the number of tokens the user will get\\n */\\n function calculateSwap(\\n Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view returns (uint256 dy) {\\n (dy, ) = _calculateSwap(\\n self,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n self.balances\\n );\\n }\\n\\n /**\\n * @notice Internally calculates a swap between two tokens.\\n *\\n * @dev The caller is expected to transfer the actual amounts (dx and dy)\\n * using the token contracts.\\n *\\n * @param self Swap struct to read from\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @return dy the number of tokens the user will get\\n * @return dyFee the associated fee\\n */\\n function _calculateSwap(\\n Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256[] memory balances\\n ) internal view returns (uint256 dy, uint256 dyFee) {\\n uint256[] memory multipliers = self.tokenPrecisionMultipliers;\\n uint256[] memory xp = _xp(balances, multipliers);\\n require(\\n tokenIndexFrom < xp.length && tokenIndexTo < xp.length,\\n \\\"Token index out of range\\\"\\n );\\n uint256 x = dx.mul(multipliers[tokenIndexFrom]).add(xp[tokenIndexFrom]);\\n uint256 y = getY(\\n _getAPrecise(self),\\n tokenIndexFrom,\\n tokenIndexTo,\\n x,\\n xp\\n );\\n dy = xp[tokenIndexTo].sub(y).sub(1);\\n dyFee = dy.mul(self.swapFee).div(FEE_DENOMINATOR);\\n dy = dy.sub(dyFee).div(multipliers[tokenIndexTo]);\\n }\\n\\n /**\\n * @notice A simple method to calculate amount of each underlying\\n * tokens that is returned upon burning given amount of\\n * LP tokens\\n *\\n * @param amount the amount of LP tokens that would to be burned on\\n * withdrawal\\n * @return array of amounts of tokens user will receive\\n */\\n function calculateRemoveLiquidity(Swap storage self, uint256 amount)\\n external\\n view\\n returns (uint256[] memory)\\n {\\n return\\n _calculateRemoveLiquidity(\\n self.balances,\\n amount,\\n self.lpToken.totalSupply()\\n );\\n }\\n\\n function _calculateRemoveLiquidity(\\n uint256[] memory balances,\\n uint256 amount,\\n uint256 totalSupply\\n ) internal pure returns (uint256[] memory) {\\n require(amount <= totalSupply, \\\"Cannot exceed total supply\\\");\\n\\n uint256[] memory amounts = new uint256[](balances.length);\\n\\n for (uint256 i = 0; i < balances.length; i++) {\\n amounts[i] = balances[i].mul(amount).div(totalSupply);\\n }\\n return amounts;\\n }\\n\\n /**\\n * @notice A simple method to calculate prices from deposits or\\n * withdrawals, excluding fees but including slippage. This is\\n * helpful as an input into the various \\\"min\\\" parameters on calls\\n * to fight front-running\\n *\\n * @dev This shouldn't be used outside frontends for user estimates.\\n *\\n * @param self Swap struct to read from\\n * @param amounts an array of token amounts to deposit or withdrawal,\\n * corresponding to pooledTokens. The amount should be in each\\n * pooled token's native precision. If a token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param deposit whether this is a deposit or a withdrawal\\n * @return if deposit was true, total amount of lp token that will be minted and if\\n * deposit was false, total amount of lp token that will be burned\\n */\\n function calculateTokenAmount(\\n Swap storage self,\\n uint256[] calldata amounts,\\n bool deposit\\n ) external view returns (uint256) {\\n uint256 a = _getAPrecise(self);\\n uint256[] memory balances = self.balances;\\n uint256[] memory multipliers = self.tokenPrecisionMultipliers;\\n\\n uint256 d0 = getD(_xp(balances, multipliers), a);\\n for (uint256 i = 0; i < balances.length; i++) {\\n if (deposit) {\\n balances[i] = balances[i].add(amounts[i]);\\n } else {\\n balances[i] = balances[i].sub(\\n amounts[i],\\n \\\"Cannot withdraw more than available\\\"\\n );\\n }\\n }\\n uint256 d1 = getD(_xp(balances, multipliers), a);\\n uint256 totalSupply = self.lpToken.totalSupply();\\n\\n if (deposit) {\\n return d1.sub(d0).mul(totalSupply).div(d0);\\n } else {\\n return d0.sub(d1).mul(totalSupply).div(d0);\\n }\\n }\\n\\n /**\\n * @notice return accumulated amount of admin fees of the token with given index\\n * @param self Swap struct to read from\\n * @param index Index of the pooled token\\n * @return admin balance in the token's precision\\n */\\n function getAdminBalance(Swap storage self, uint256 index)\\n external\\n view\\n returns (uint256)\\n {\\n require(index < self.pooledTokens.length, \\\"Token index out of range\\\");\\n return\\n self.pooledTokens[index].balanceOf(address(this)).sub(\\n self.balances[index]\\n );\\n }\\n\\n /**\\n * @notice internal helper function to calculate fee per token multiplier used in\\n * swap fee calculations\\n * @param swapFee swap fee for the tokens\\n * @param numTokens number of tokens pooled\\n */\\n function _feePerToken(uint256 swapFee, uint256 numTokens)\\n internal\\n pure\\n returns (uint256)\\n {\\n return swapFee.mul(numTokens).div(numTokens.sub(1).mul(4));\\n }\\n\\n /*** STATE MODIFYING FUNCTIONS ***/\\n\\n /**\\n * @notice swap two tokens in the pool\\n * @param self Swap struct to read from and write to\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @return amount of token user received on swap\\n */\\n function swap(\\n Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy\\n ) external returns (uint256) {\\n {\\n IERC20 tokenFrom = self.pooledTokens[tokenIndexFrom];\\n require(\\n dx <= tokenFrom.balanceOf(msg.sender),\\n \\\"Cannot swap more than you own\\\"\\n );\\n // Transfer tokens first to see if a fee was charged on transfer\\n uint256 beforeBalance = tokenFrom.balanceOf(address(this));\\n tokenFrom.safeTransferFrom(msg.sender, address(this), dx);\\n\\n // Use the actual transferred amount for AMM math\\n dx = tokenFrom.balanceOf(address(this)).sub(beforeBalance);\\n }\\n\\n uint256 dy;\\n uint256 dyFee;\\n uint256[] memory balances = self.balances;\\n (dy, dyFee) = _calculateSwap(\\n self,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n balances\\n );\\n require(dy >= minDy, \\\"Swap didn't result in min tokens\\\");\\n\\n uint256 dyAdminFee = dyFee.mul(self.adminFee).div(FEE_DENOMINATOR).div(\\n self.tokenPrecisionMultipliers[tokenIndexTo]\\n );\\n\\n self.balances[tokenIndexFrom] = balances[tokenIndexFrom].add(dx);\\n self.balances[tokenIndexTo] = balances[tokenIndexTo].sub(dy).sub(\\n dyAdminFee\\n );\\n\\n self.pooledTokens[tokenIndexTo].safeTransfer(msg.sender, dy);\\n\\n emit TokenSwap(msg.sender, dx, dy, tokenIndexFrom, tokenIndexTo);\\n\\n return dy;\\n }\\n\\n /**\\n * @notice Add liquidity to the pool\\n * @param self Swap struct to read from and write to\\n * @param amounts the amounts of each token to add, in their native precision\\n * @param minToMint the minimum LP tokens adding this amount of liquidity\\n * should mint, otherwise revert. Handy for front-running mitigation\\n * allowed addresses. If the pool is not in the guarded launch phase, this parameter will be ignored.\\n * @return amount of LP token user received\\n */\\n function addLiquidity(\\n Swap storage self,\\n uint256[] memory amounts,\\n uint256 minToMint\\n ) external returns (uint256) {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n require(\\n amounts.length == pooledTokens.length,\\n \\\"Amounts must match pooled tokens\\\"\\n );\\n\\n // current state\\n ManageLiquidityInfo memory v = ManageLiquidityInfo(\\n 0,\\n 0,\\n 0,\\n _getAPrecise(self),\\n self.lpToken,\\n 0,\\n self.balances,\\n self.tokenPrecisionMultipliers\\n );\\n v.totalSupply = v.lpToken.totalSupply();\\n\\n if (v.totalSupply != 0) {\\n v.d0 = getD(_xp(v.balances, v.multipliers), v.preciseA);\\n }\\n\\n uint256[] memory newBalances = new uint256[](pooledTokens.length);\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n require(\\n v.totalSupply != 0 || amounts[i] > 0,\\n \\\"Must supply all tokens in pool\\\"\\n );\\n\\n // Transfer tokens first to see if a fee was charged on transfer\\n if (amounts[i] != 0) {\\n uint256 beforeBalance = pooledTokens[i].balanceOf(\\n address(this)\\n );\\n pooledTokens[i].safeTransferFrom(\\n msg.sender,\\n address(this),\\n amounts[i]\\n );\\n\\n // Update the amounts[] with actual transfer amount\\n amounts[i] = pooledTokens[i].balanceOf(address(this)).sub(\\n beforeBalance\\n );\\n }\\n\\n newBalances[i] = v.balances[i].add(amounts[i]);\\n }\\n\\n // invariant after change\\n v.d1 = getD(_xp(newBalances, v.multipliers), v.preciseA);\\n require(v.d1 > v.d0, \\\"D should increase\\\");\\n\\n // updated to reflect fees and calculate the user's LP tokens\\n v.d2 = v.d1;\\n uint256[] memory fees = new uint256[](pooledTokens.length);\\n\\n if (v.totalSupply != 0) {\\n uint256 feePerToken = _feePerToken(\\n self.swapFee,\\n pooledTokens.length\\n );\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n uint256 idealBalance = v.d1.mul(v.balances[i]).div(v.d0);\\n fees[i] = feePerToken\\n .mul(idealBalance.difference(newBalances[i]))\\n .div(FEE_DENOMINATOR);\\n self.balances[i] = newBalances[i].sub(\\n fees[i].mul(self.adminFee).div(FEE_DENOMINATOR)\\n );\\n newBalances[i] = newBalances[i].sub(fees[i]);\\n }\\n v.d2 = getD(_xp(newBalances, v.multipliers), v.preciseA);\\n } else {\\n // the initial depositor doesn't pay fees\\n self.balances = newBalances;\\n }\\n\\n uint256 toMint;\\n if (v.totalSupply == 0) {\\n toMint = v.d1;\\n } else {\\n toMint = v.d2.sub(v.d0).mul(v.totalSupply).div(v.d0);\\n }\\n\\n require(toMint >= minToMint, \\\"Couldn't mint min requested\\\");\\n\\n // mint the user's LP tokens\\n v.lpToken.mint(msg.sender, toMint);\\n\\n emit AddLiquidity(\\n msg.sender,\\n amounts,\\n fees,\\n v.d1,\\n v.totalSupply.add(toMint)\\n );\\n\\n return toMint;\\n }\\n\\n /**\\n * @notice Burn LP tokens to remove liquidity from the pool.\\n * @dev Liquidity can always be removed, even when the pool is paused.\\n * @param self Swap struct to read from and write to\\n * @param amount the amount of LP tokens to burn\\n * @param minAmounts the minimum amounts of each token in the pool\\n * acceptable for this burn. Useful as a front-running mitigation\\n * @return amounts of tokens the user received\\n */\\n function removeLiquidity(\\n Swap storage self,\\n uint256 amount,\\n uint256[] calldata minAmounts\\n ) external returns (uint256[] memory) {\\n LPToken lpToken = self.lpToken;\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n require(amount <= lpToken.balanceOf(msg.sender), \\\">LP.balanceOf\\\");\\n require(\\n minAmounts.length == pooledTokens.length,\\n \\\"minAmounts must match poolTokens\\\"\\n );\\n\\n uint256[] memory balances = self.balances;\\n uint256 totalSupply = lpToken.totalSupply();\\n\\n uint256[] memory amounts = _calculateRemoveLiquidity(\\n balances,\\n amount,\\n totalSupply\\n );\\n\\n for (uint256 i = 0; i < amounts.length; i++) {\\n require(amounts[i] >= minAmounts[i], \\\"amounts[i] < minAmounts[i]\\\");\\n self.balances[i] = balances[i].sub(amounts[i]);\\n pooledTokens[i].safeTransfer(msg.sender, amounts[i]);\\n }\\n\\n lpToken.burnFrom(msg.sender, amount);\\n\\n emit RemoveLiquidity(msg.sender, amounts, totalSupply.sub(amount));\\n\\n return amounts;\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool all in one token.\\n * @param self Swap struct to read from and write to\\n * @param tokenAmount the amount of the lp tokens to burn\\n * @param tokenIndex the index of the token you want to receive\\n * @param minAmount the minimum amount to withdraw, otherwise revert\\n * @return amount chosen token that user received\\n */\\n function removeLiquidityOneToken(\\n Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount\\n ) external returns (uint256) {\\n LPToken lpToken = self.lpToken;\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n\\n require(tokenAmount <= lpToken.balanceOf(msg.sender), \\\">LP.balanceOf\\\");\\n require(tokenIndex < pooledTokens.length, \\\"Token not found\\\");\\n\\n uint256 totalSupply = lpToken.totalSupply();\\n\\n (uint256 dy, uint256 dyFee) = _calculateWithdrawOneToken(\\n self,\\n tokenAmount,\\n tokenIndex,\\n totalSupply\\n );\\n\\n require(dy >= minAmount, \\\"dy < minAmount\\\");\\n\\n self.balances[tokenIndex] = self.balances[tokenIndex].sub(\\n dy.add(dyFee.mul(self.adminFee).div(FEE_DENOMINATOR))\\n );\\n lpToken.burnFrom(msg.sender, tokenAmount);\\n pooledTokens[tokenIndex].safeTransfer(msg.sender, dy);\\n\\n emit RemoveLiquidityOne(\\n msg.sender,\\n tokenAmount,\\n totalSupply,\\n tokenIndex,\\n dy\\n );\\n\\n return dy;\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool, weighted differently than the\\n * pool's current balances.\\n *\\n * @param self Swap struct to read from and write to\\n * @param amounts how much of each token to withdraw\\n * @param maxBurnAmount the max LP token provider is willing to pay to\\n * remove liquidity. Useful as a front-running mitigation.\\n * @return actual amount of LP tokens burned in the withdrawal\\n */\\n function removeLiquidityImbalance(\\n Swap storage self,\\n uint256[] memory amounts,\\n uint256 maxBurnAmount\\n ) public returns (uint256) {\\n ManageLiquidityInfo memory v = ManageLiquidityInfo(\\n 0,\\n 0,\\n 0,\\n _getAPrecise(self),\\n self.lpToken,\\n 0,\\n self.balances,\\n self.tokenPrecisionMultipliers\\n );\\n v.totalSupply = v.lpToken.totalSupply();\\n\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n\\n require(\\n amounts.length == pooledTokens.length,\\n \\\"Amounts should match pool tokens\\\"\\n );\\n\\n require(\\n maxBurnAmount <= v.lpToken.balanceOf(msg.sender) &&\\n maxBurnAmount != 0,\\n \\\">LP.balanceOf\\\"\\n );\\n\\n uint256 feePerToken = _feePerToken(self.swapFee, pooledTokens.length);\\n uint256[] memory fees = new uint256[](pooledTokens.length);\\n {\\n uint256[] memory balances1 = new uint256[](pooledTokens.length);\\n v.d0 = getD(_xp(v.balances, v.multipliers), v.preciseA);\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n balances1[i] = v.balances[i].sub(\\n amounts[i],\\n \\\"Cannot withdraw more than available\\\"\\n );\\n }\\n v.d1 = getD(_xp(balances1, v.multipliers), v.preciseA);\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n uint256 idealBalance = v.d1.mul(v.balances[i]).div(v.d0);\\n uint256 difference = idealBalance.difference(balances1[i]);\\n fees[i] = feePerToken.mul(difference).div(FEE_DENOMINATOR);\\n self.balances[i] = balances1[i].sub(\\n fees[i].mul(self.adminFee).div(FEE_DENOMINATOR)\\n );\\n balances1[i] = balances1[i].sub(fees[i]);\\n }\\n\\n v.d2 = getD(_xp(balances1, v.multipliers), v.preciseA);\\n }\\n uint256 tokenAmount = v.d0.sub(v.d2).mul(v.totalSupply).div(v.d0);\\n require(tokenAmount != 0, \\\"Burnt amount cannot be zero\\\");\\n tokenAmount = tokenAmount.add(1);\\n\\n require(tokenAmount <= maxBurnAmount, \\\"tokenAmount > maxBurnAmount\\\");\\n\\n v.lpToken.burnFrom(msg.sender, tokenAmount);\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n pooledTokens[i].safeTransfer(msg.sender, amounts[i]);\\n }\\n\\n emit RemoveLiquidityImbalance(\\n msg.sender,\\n amounts,\\n fees,\\n v.d1,\\n v.totalSupply.sub(tokenAmount)\\n );\\n\\n return tokenAmount;\\n }\\n\\n /**\\n * @notice withdraw all admin fees to a given address\\n * @param self Swap struct to withdraw fees from\\n * @param to Address to send the fees to\\n */\\n function withdrawAdminFees(Swap storage self, address to) external {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n IERC20 token = pooledTokens[i];\\n uint256 balance = token.balanceOf(address(this)).sub(\\n self.balances[i]\\n );\\n if (balance != 0) {\\n token.safeTransfer(to, balance);\\n }\\n }\\n }\\n\\n /**\\n * @notice Sets the admin fee\\n * @dev adminFee cannot be higher than 100% of the swap fee\\n * @param self Swap struct to update\\n * @param newAdminFee new admin fee to be applied on future transactions\\n */\\n function setAdminFee(Swap storage self, uint256 newAdminFee) external {\\n require(newAdminFee <= MAX_ADMIN_FEE, \\\"Fee is too high\\\");\\n self.adminFee = newAdminFee;\\n\\n emit NewAdminFee(newAdminFee);\\n }\\n\\n /**\\n * @notice update the swap fee\\n * @dev fee cannot be higher than 1% of each swap\\n * @param self Swap struct to update\\n * @param newSwapFee new swap fee to be applied on future transactions\\n */\\n function setSwapFee(Swap storage self, uint256 newSwapFee) external {\\n require(newSwapFee <= MAX_SWAP_FEE, \\\"Fee is too high\\\");\\n self.swapFee = newSwapFee;\\n\\n emit NewSwapFee(newSwapFee);\\n }\\n}\\n\",\"keccak256\":\"0x1571bb987f110239e647da76403b6a73b7a46a082035dc950ddc9db26eb0fbed\",\"license\":\"MIT\"},\"contracts/interfaces/IAllowlist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\ninterface IAllowlist {\\n function getPoolAccountLimit(address poolAddress)\\n external\\n view\\n returns (uint256);\\n\\n function getPoolCap(address poolAddress) external view returns (uint256);\\n\\n function verifyAddress(address account, bytes32[] calldata merkleProof)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xf55e4d678d05bc5d0e24ec5f24504d7437b885e19579f9d29152748c3c1c732e\",\"license\":\"MIT\"},\"contracts/interfaces/IMasterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0;\\npragma experimental ABIEncoderV2;\\n\\ninterface IMasterRegistry {\\n /* Structs */\\n\\n struct ReverseRegistryData {\\n bytes32 name;\\n uint256 version;\\n }\\n\\n /* Functions */\\n\\n /**\\n * @notice Add a new registry entry to the master list.\\n * @param registryName name for the registry\\n * @param registryAddress address of the new registry\\n */\\n function addRegistry(bytes32 registryName, address registryAddress)\\n external\\n payable;\\n\\n /**\\n * @notice Resolves a name to the latest registry address. Reverts if no match is found.\\n * @param name name for the registry\\n * @return address address of the latest registry with the matching name\\n */\\n function resolveNameToLatestAddress(bytes32 name)\\n external\\n view\\n returns (address);\\n\\n /**\\n * @notice Resolves a name and version to an address. Reverts if there is no registry with given name and version.\\n * @param name address of the registry you want to resolve to\\n * @param version version of the registry you want to resolve to\\n */\\n function resolveNameAndVersionToAddress(bytes32 name, uint256 version)\\n external\\n view\\n returns (address);\\n\\n /**\\n * @notice Resolves a name to an array of all addresses. Reverts if no match is found.\\n * @param name name for the registry\\n * @return address address of the latest registry with the matching name\\n */\\n function resolveNameToAllAddresses(bytes32 name)\\n external\\n view\\n returns (address[] memory);\\n\\n /**\\n * @notice Resolves an address to registry entry data.\\n * @param registryAddress address of a registry you want to resolve\\n * @return name name of the resolved registry\\n * @return version version of the resolved registry\\n * @return isLatest boolean flag of whether the given address is the latest version of the given registries with\\n * matching name\\n */\\n function resolveAddressToRegistryData(address registryAddress)\\n external\\n view\\n returns (\\n bytes32 name,\\n uint256 version,\\n bool isLatest\\n );\\n}\\n\",\"keccak256\":\"0x0e403d7e259003f3826b3009ae3e39344706d7af8a0a5bd48ba45a6ca978226b\",\"license\":\"MIT\"},\"contracts/interfaces/ISwap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./IAllowlist.sol\\\";\\n\\ninterface ISwap {\\n // pool data view functions\\n function getA() external view returns (uint256);\\n\\n function getAPrecise() external view returns (uint256);\\n\\n function getAllowlist() external view returns (IAllowlist);\\n\\n function getToken(uint8 index) external view returns (IERC20);\\n\\n function getTokenIndex(address tokenAddress) external view returns (uint8);\\n\\n function getTokenBalance(uint8 index) external view returns (uint256);\\n\\n function getVirtualPrice() external view returns (uint256);\\n\\n function owner() external view returns (address);\\n\\n function isGuarded() external view returns (bool);\\n\\n function paused() external view returns (bool);\\n\\n function swapStorage()\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n address\\n );\\n\\n // min return calculation functions\\n function calculateSwap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view returns (uint256);\\n\\n function calculateTokenAmount(uint256[] calldata amounts, bool deposit)\\n external\\n view\\n returns (uint256);\\n\\n function calculateRemoveLiquidity(uint256 amount)\\n external\\n view\\n returns (uint256[] memory);\\n\\n function calculateRemoveLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view returns (uint256 availableTokenAmount);\\n\\n // state modifying functions\\n function initialize(\\n IERC20[] memory pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 a,\\n uint256 fee,\\n uint256 adminFee,\\n address lpTokenTargetAddress\\n ) external;\\n\\n function swap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy,\\n uint256 deadline\\n ) external returns (uint256);\\n\\n function addLiquidity(\\n uint256[] calldata amounts,\\n uint256 minToMint,\\n uint256 deadline\\n ) external returns (uint256);\\n\\n function removeLiquidity(\\n uint256 amount,\\n uint256[] calldata minAmounts,\\n uint256 deadline\\n ) external returns (uint256[] memory);\\n\\n function removeLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount,\\n uint256 deadline\\n ) external returns (uint256);\\n\\n function removeLiquidityImbalance(\\n uint256[] calldata amounts,\\n uint256 maxBurnAmount,\\n uint256 deadline\\n ) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xcd26195c5e3824e7984750a05c9fcb6dde3e266022c3bd1a9dcdda9e967a6f4c\",\"license\":\"MIT\"},\"contracts/meta/MetaSwap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"../Swap.sol\\\";\\nimport \\\"./MetaSwapUtils.sol\\\";\\n\\n/**\\n * @title MetaSwap - A StableSwap implementation in solidity.\\n * @notice This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)\\n * and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens\\n * in desired ratios for an exchange of the pool token that represents their share of the pool.\\n * Users can burn pool tokens and withdraw their share of token(s).\\n *\\n * Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets\\n * distributed to the LPs.\\n *\\n * In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which\\n * stops the ratio of the tokens in the pool from changing.\\n * Users can always withdraw their tokens via multi-asset withdraws.\\n *\\n * MetaSwap is a modified version of Swap that allows Swap's LP token to be utilized in pooling with other tokens.\\n * As an example, if there is a Swap pool consisting of [DAI, USDC, USDT], then a MetaSwap pool can be created\\n * with [sUSD, BaseSwapLPToken] to allow trades between either the LP token or the underlying tokens and sUSD.\\n * Note that when interacting with MetaSwap, users cannot deposit or withdraw via underlying tokens. In that case,\\n * `MetaSwapDeposit.sol` can be additionally deployed to allow interacting with unwrapped representations of the tokens.\\n *\\n * @dev Most of the logic is stored as a library `MetaSwapUtils` for the sake of reducing contract's\\n * deployment size.\\n */\\ncontract MetaSwap is Swap {\\n using MetaSwapUtils for SwapUtils.Swap;\\n\\n MetaSwapUtils.MetaSwap public metaSwapStorage;\\n\\n uint256 constant MAX_UINT256 = 2**256 - 1;\\n\\n /*** EVENTS ***/\\n\\n // events replicated from SwapUtils to make the ABI easier for dumb\\n // clients\\n event TokenSwapUnderlying(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n\\n /**\\n * @notice Get the virtual price, to help calculate profit\\n * @return the virtual price, scaled to the POOL_PRECISION_DECIMALS\\n */\\n function getVirtualPrice()\\n external\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return MetaSwapUtils.getVirtualPrice(swapStorage, metaSwapStorage);\\n }\\n\\n /**\\n * @notice Calculate amount of tokens you receive on swap\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell. If the token charges\\n * a fee on transfers, use the amount that gets transferred after the fee.\\n * @return amount of tokens the user will receive\\n */\\n function calculateSwap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view virtual override returns (uint256) {\\n return\\n MetaSwapUtils.calculateSwap(\\n swapStorage,\\n metaSwapStorage,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx\\n );\\n }\\n\\n /**\\n * @notice Calculate amount of tokens you receive on swap. For this function,\\n * the token indices are flattened out so that underlying tokens are represented.\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell. If the token charges\\n * a fee on transfers, use the amount that gets transferred after the fee.\\n * @return amount of tokens the user will receive\\n */\\n function calculateSwapUnderlying(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view virtual returns (uint256) {\\n return\\n MetaSwapUtils.calculateSwapUnderlying(\\n swapStorage,\\n metaSwapStorage,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx\\n );\\n }\\n\\n /**\\n * @notice A simple method to calculate prices from deposits or\\n * withdrawals, excluding fees but including slippage. This is\\n * helpful as an input into the various \\\"min\\\" parameters on calls\\n * to fight front-running\\n *\\n * @dev This shouldn't be used outside frontends for user estimates.\\n *\\n * @param amounts an array of token amounts to deposit or withdrawal,\\n * corresponding to pooledTokens. The amount should be in each\\n * pooled token's native precision. If a token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param deposit whether this is a deposit or a withdrawal\\n * @return token amount the user will receive\\n */\\n function calculateTokenAmount(uint256[] calldata amounts, bool deposit)\\n external\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return\\n MetaSwapUtils.calculateTokenAmount(\\n swapStorage,\\n metaSwapStorage,\\n amounts,\\n deposit\\n );\\n }\\n\\n /**\\n * @notice Calculate the amount of underlying token available to withdraw\\n * when withdrawing via only single token\\n * @param tokenAmount the amount of LP token to burn\\n * @param tokenIndex index of which token will be withdrawn\\n * @return availableTokenAmount calculated amount of underlying token\\n * available to withdraw\\n */\\n function calculateRemoveLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view virtual override returns (uint256) {\\n return\\n MetaSwapUtils.calculateWithdrawOneToken(\\n swapStorage,\\n metaSwapStorage,\\n tokenAmount,\\n tokenIndex\\n );\\n }\\n\\n /*** STATE MODIFYING FUNCTIONS ***/\\n\\n /**\\n * @notice This overrides Swap's initialize function to prevent initializing\\n * without the address of the base Swap contract.\\n *\\n * @param _pooledTokens an array of ERC20s this pool will accept\\n * @param decimals the decimals to use for each pooled token,\\n * eg 8 for WBTC. Cannot be larger than POOL_PRECISION_DECIMALS\\n * @param lpTokenName the long-form name of the token to be deployed\\n * @param lpTokenSymbol the short symbol for the token to be deployed\\n * @param _a the amplification coefficient * n * (n - 1). See the\\n * StableSwap paper for details\\n * @param _fee default swap fee to be initialized with\\n * @param _adminFee default adminFee to be initialized with\\n */\\n function initialize(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress\\n ) public payable virtual override initializer {\\n revert(\\\"use initializeMetaSwap() instead\\\");\\n }\\n\\n /**\\n * @notice Initializes this MetaSwap contract with the given parameters.\\n * MetaSwap uses an existing Swap pool to expand the available liquidity.\\n * _pooledTokens array should contain the base Swap pool's LP token as\\n * the last element. For example, if there is a Swap pool consisting of\\n * [DAI, USDC, USDT]. Then a MetaSwap pool can be created with [sUSD, BaseSwapLPToken]\\n * as _pooledTokens.\\n *\\n * This will also deploy the LPToken that represents users'\\n * LP position. The owner of LPToken will be this contract - which means\\n * only this contract is allowed to mint new tokens.\\n *\\n * @param _pooledTokens an array of ERC20s this pool will accept. The last\\n * element must be an existing Swap pool's LP token's address.\\n * @param decimals the decimals to use for each pooled token,\\n * eg 8 for WBTC. Cannot be larger than POOL_PRECISION_DECIMALS\\n * @param lpTokenName the long-form name of the token to be deployed\\n * @param lpTokenSymbol the short symbol for the token to be deployed\\n * @param _a the amplification coefficient * n * (n - 1). See the\\n * StableSwap paper for details\\n * @param _fee default swap fee to be initialized with\\n * @param _adminFee default adminFee to be initialized with\\n */\\n function initializeMetaSwap(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress,\\n ISwap baseSwap\\n ) public payable virtual initializer {\\n Swap.initialize(\\n _pooledTokens,\\n decimals,\\n lpTokenName,\\n lpTokenSymbol,\\n _a,\\n _fee,\\n _adminFee,\\n lpTokenTargetAddress\\n );\\n\\n // MetaSwap initializer\\n metaSwapStorage.baseSwap = baseSwap;\\n metaSwapStorage.baseVirtualPrice = baseSwap.getVirtualPrice();\\n metaSwapStorage.baseCacheLastUpdated = block.timestamp;\\n\\n // Read all tokens that belong to baseSwap\\n {\\n uint8 i;\\n for (; i < 32; i++) {\\n try baseSwap.getToken(i) returns (IERC20 token) {\\n metaSwapStorage.baseTokens.push(token);\\n token.safeApprove(address(baseSwap), MAX_UINT256);\\n } catch {\\n break;\\n }\\n }\\n require(i > 1, \\\"baseSwap must pool at least 2 tokens\\\");\\n }\\n\\n // Check the last element of _pooledTokens is owned by baseSwap\\n IERC20 baseLPToken = _pooledTokens[_pooledTokens.length - 1];\\n require(\\n LPToken(address(baseLPToken)).owner() == address(baseSwap),\\n \\\"baseLPToken is not owned by baseSwap\\\"\\n );\\n\\n // Pre-approve the baseLPToken to be used by baseSwap\\n baseLPToken.safeApprove(address(baseSwap), MAX_UINT256);\\n }\\n\\n /**\\n * @notice Swap two tokens using this pool\\n * @param tokenIndexFrom the token the user wants to swap from\\n * @param tokenIndexTo the token the user wants to swap to\\n * @param dx the amount of tokens the user wants to swap from\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @param deadline latest timestamp to accept this transaction\\n */\\n function swap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n override\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n MetaSwapUtils.swap(\\n swapStorage,\\n metaSwapStorage,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n minDy\\n );\\n }\\n\\n /**\\n * @notice Swap two tokens using this pool and the base pool.\\n * @param tokenIndexFrom the token the user wants to swap from\\n * @param tokenIndexTo the token the user wants to swap to\\n * @param dx the amount of tokens the user wants to swap from\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @param deadline latest timestamp to accept this transaction\\n */\\n function swapUnderlying(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy,\\n uint256 deadline\\n )\\n external\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n MetaSwapUtils.swapUnderlying(\\n swapStorage,\\n metaSwapStorage,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n minDy\\n );\\n }\\n\\n /**\\n * @notice Add liquidity to the pool with the given amounts of tokens\\n * @param amounts the amounts of each token to add, in their native precision\\n * @param minToMint the minimum LP tokens adding this amount of liquidity\\n * should mint, otherwise revert. Handy for front-running mitigation\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of LP token user minted and received\\n */\\n function addLiquidity(\\n uint256[] calldata amounts,\\n uint256 minToMint,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n override\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n MetaSwapUtils.addLiquidity(\\n swapStorage,\\n metaSwapStorage,\\n amounts,\\n minToMint\\n );\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool all in one token. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @param tokenAmount the amount of the token you want to receive\\n * @param tokenIndex the index of the token you want to receive\\n * @param minAmount the minimum amount to withdraw, otherwise revert\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of chosen token user received\\n */\\n function removeLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n override\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n MetaSwapUtils.removeLiquidityOneToken(\\n swapStorage,\\n metaSwapStorage,\\n tokenAmount,\\n tokenIndex,\\n minAmount\\n );\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool, weighted differently than the\\n * pool's current balances. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @param amounts how much of each token to withdraw\\n * @param maxBurnAmount the max LP token provider is willing to pay to\\n * remove liquidity. Useful as a front-running mitigation.\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of LP tokens burned\\n */\\n function removeLiquidityImbalance(\\n uint256[] calldata amounts,\\n uint256 maxBurnAmount,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n override\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n MetaSwapUtils.removeLiquidityImbalance(\\n swapStorage,\\n metaSwapStorage,\\n amounts,\\n maxBurnAmount\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfec674874d89d6c8e68de333bfd167363c3e260bec7161659ae94a59a3c2ae69\",\"license\":\"MIT\"},\"contracts/meta/MetaSwapUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"../LPToken.sol\\\";\\nimport \\\"../interfaces/ISwap.sol\\\";\\nimport \\\"../MathUtils.sol\\\";\\nimport \\\"../SwapUtils.sol\\\";\\n\\n/**\\n * @title MetaSwapUtils library\\n * @notice A library to be used within MetaSwap.sol. Contains functions responsible for custody and AMM functionalities.\\n *\\n * MetaSwap is a modified version of Swap that allows Swap's LP token to be utilized in pooling with other tokens.\\n * As an example, if there is a Swap pool consisting of [DAI, USDC, USDT]. Then a MetaSwap pool can be created\\n * with [sUSD, BaseSwapLPToken] to allow trades between either the LP token or the underlying tokens and sUSD.\\n *\\n * @dev Contracts relying on this library must initialize SwapUtils.Swap struct then use this library\\n * for SwapUtils.Swap struct. Note that this library contains both functions called by users and admins.\\n * Admin functions should be protected within contracts using this library.\\n */\\nlibrary MetaSwapUtils {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n using MathUtils for uint256;\\n using AmplificationUtils for SwapUtils.Swap;\\n\\n /*** EVENTS ***/\\n\\n event TokenSwap(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n event TokenSwapUnderlying(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n event AddLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidityOne(\\n address indexed provider,\\n uint256 lpTokenAmount,\\n uint256 lpTokenSupply,\\n uint256 boughtId,\\n uint256 tokensBought\\n );\\n event RemoveLiquidityImbalance(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event NewAdminFee(uint256 newAdminFee);\\n event NewSwapFee(uint256 newSwapFee);\\n event NewWithdrawFee(uint256 newWithdrawFee);\\n\\n struct MetaSwap {\\n // Meta-Swap related parameters\\n ISwap baseSwap;\\n uint256 baseVirtualPrice;\\n uint256 baseCacheLastUpdated;\\n IERC20[] baseTokens;\\n }\\n\\n // Struct storing variables used in calculations in the\\n // calculateWithdrawOneTokenDY function to avoid stack too deep errors\\n struct CalculateWithdrawOneTokenDYInfo {\\n uint256 d0;\\n uint256 d1;\\n uint256 newY;\\n uint256 feePerToken;\\n uint256 preciseA;\\n uint256 xpi;\\n }\\n\\n // Struct storing variables used in calculation in removeLiquidityImbalance function\\n // to avoid stack too deep error\\n struct ManageLiquidityInfo {\\n uint256 d0;\\n uint256 d1;\\n uint256 d2;\\n LPToken lpToken;\\n uint256 totalSupply;\\n uint256 preciseA;\\n uint256 baseVirtualPrice;\\n uint256[] tokenPrecisionMultipliers;\\n uint256[] newBalances;\\n }\\n\\n struct SwapUnderlyingInfo {\\n uint256 x;\\n uint256 dx;\\n uint256 dy;\\n uint256[] tokenPrecisionMultipliers;\\n uint256[] oldBalances;\\n IERC20[] baseTokens;\\n IERC20 tokenFrom;\\n uint8 metaIndexFrom;\\n IERC20 tokenTo;\\n uint8 metaIndexTo;\\n uint256 baseVirtualPrice;\\n }\\n\\n struct CalculateSwapUnderlyingInfo {\\n uint256 baseVirtualPrice;\\n ISwap baseSwap;\\n uint8 baseLPTokenIndex;\\n uint8 baseTokensLength;\\n uint8 metaIndexTo;\\n uint256 x;\\n uint256 dy;\\n }\\n\\n // the denominator used to calculate admin and LP fees. For example, an\\n // LP fee might be something like tradeAmount.mul(fee).div(FEE_DENOMINATOR)\\n uint256 private constant FEE_DENOMINATOR = 10**10;\\n\\n // Cache expire time for the stored value of base Swap's virtual price\\n uint256 public constant BASE_CACHE_EXPIRE_TIME = 10 minutes;\\n uint256 public constant BASE_VIRTUAL_PRICE_PRECISION = 10**18;\\n\\n /*** VIEW & PURE FUNCTIONS ***/\\n\\n /**\\n * @notice Return the stored value of base Swap's virtual price. If\\n * value was updated past BASE_CACHE_EXPIRE_TIME, then read it directly\\n * from the base Swap contract.\\n * @param metaSwapStorage MetaSwap struct to read from\\n * @return base Swap's virtual price\\n */\\n function _getBaseVirtualPrice(MetaSwap storage metaSwapStorage)\\n internal\\n view\\n returns (uint256)\\n {\\n if (\\n block.timestamp >\\n metaSwapStorage.baseCacheLastUpdated + BASE_CACHE_EXPIRE_TIME\\n ) {\\n return metaSwapStorage.baseSwap.getVirtualPrice();\\n }\\n return metaSwapStorage.baseVirtualPrice;\\n }\\n\\n function _getBaseSwapFee(ISwap baseSwap)\\n internal\\n view\\n returns (uint256 swapFee)\\n {\\n (, , , , swapFee, , ) = baseSwap.swapStorage();\\n }\\n\\n /**\\n * @notice Calculate how much the user would receive when withdrawing via single token\\n * @param self Swap struct to read from\\n * @param metaSwapStorage MetaSwap struct to read from\\n * @param tokenAmount the amount to withdraw in the pool's precision\\n * @param tokenIndex which token will be withdrawn\\n * @return dy the amount of token user will receive\\n */\\n function calculateWithdrawOneToken(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view returns (uint256 dy) {\\n (dy, ) = _calculateWithdrawOneToken(\\n self,\\n tokenAmount,\\n tokenIndex,\\n _getBaseVirtualPrice(metaSwapStorage),\\n self.lpToken.totalSupply()\\n );\\n }\\n\\n function _calculateWithdrawOneToken(\\n SwapUtils.Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 baseVirtualPrice,\\n uint256 totalSupply\\n ) internal view returns (uint256, uint256) {\\n uint256 dy;\\n uint256 dySwapFee;\\n\\n {\\n uint256 currentY;\\n uint256 newY;\\n\\n // Calculate how much to withdraw\\n (dy, newY, currentY) = _calculateWithdrawOneTokenDY(\\n self,\\n tokenIndex,\\n tokenAmount,\\n baseVirtualPrice,\\n totalSupply\\n );\\n\\n // Calculate the associated swap fee\\n dySwapFee = currentY\\n .sub(newY)\\n .div(self.tokenPrecisionMultipliers[tokenIndex])\\n .sub(dy);\\n }\\n\\n return (dy, dySwapFee);\\n }\\n\\n /**\\n * @notice Calculate the dy of withdrawing in one token\\n * @param self Swap struct to read from\\n * @param tokenIndex which token will be withdrawn\\n * @param tokenAmount the amount to withdraw in the pools precision\\n * @param baseVirtualPrice the virtual price of the base swap's LP token\\n * @return the dy excluding swap fee, the new y after withdrawing one token, and current y\\n */\\n function _calculateWithdrawOneTokenDY(\\n SwapUtils.Swap storage self,\\n uint8 tokenIndex,\\n uint256 tokenAmount,\\n uint256 baseVirtualPrice,\\n uint256 totalSupply\\n )\\n internal\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256\\n )\\n {\\n // Get the current D, then solve the stableswap invariant\\n // y_i for D - tokenAmount\\n uint256[] memory xp = _xp(self, baseVirtualPrice);\\n require(tokenIndex < xp.length, \\\"Token index out of range\\\");\\n\\n CalculateWithdrawOneTokenDYInfo\\n memory v = CalculateWithdrawOneTokenDYInfo(\\n 0,\\n 0,\\n 0,\\n 0,\\n self._getAPrecise(),\\n 0\\n );\\n v.d0 = SwapUtils.getD(xp, v.preciseA);\\n v.d1 = v.d0.sub(tokenAmount.mul(v.d0).div(totalSupply));\\n\\n require(tokenAmount <= xp[tokenIndex], \\\"Withdraw exceeds available\\\");\\n\\n v.newY = SwapUtils.getYD(v.preciseA, tokenIndex, xp, v.d1);\\n\\n uint256[] memory xpReduced = new uint256[](xp.length);\\n\\n v.feePerToken = SwapUtils._feePerToken(self.swapFee, xp.length);\\n for (uint256 i = 0; i < xp.length; i++) {\\n v.xpi = xp[i];\\n // if i == tokenIndex, dxExpected = xp[i] * d1 / d0 - newY\\n // else dxExpected = xp[i] - (xp[i] * d1 / d0)\\n // xpReduced[i] -= dxExpected * fee / FEE_DENOMINATOR\\n xpReduced[i] = v.xpi.sub(\\n (\\n (i == tokenIndex)\\n ? v.xpi.mul(v.d1).div(v.d0).sub(v.newY)\\n : v.xpi.sub(v.xpi.mul(v.d1).div(v.d0))\\n ).mul(v.feePerToken).div(FEE_DENOMINATOR)\\n );\\n }\\n\\n uint256 dy = xpReduced[tokenIndex].sub(\\n SwapUtils.getYD(v.preciseA, tokenIndex, xpReduced, v.d1)\\n );\\n\\n if (tokenIndex == xp.length.sub(1)) {\\n dy = dy.mul(BASE_VIRTUAL_PRICE_PRECISION).div(baseVirtualPrice);\\n v.newY = v.newY.mul(BASE_VIRTUAL_PRICE_PRECISION).div(\\n baseVirtualPrice\\n );\\n xp[tokenIndex] = xp[tokenIndex]\\n .mul(BASE_VIRTUAL_PRICE_PRECISION)\\n .div(baseVirtualPrice);\\n }\\n dy = dy.sub(1).div(self.tokenPrecisionMultipliers[tokenIndex]);\\n\\n return (dy, v.newY, xp[tokenIndex]);\\n }\\n\\n /**\\n * @notice Given a set of balances and precision multipliers, return the\\n * precision-adjusted balances. The last element will also get scaled up by\\n * the given baseVirtualPrice.\\n *\\n * @param balances an array of token balances, in their native precisions.\\n * These should generally correspond with pooled tokens.\\n *\\n * @param precisionMultipliers an array of multipliers, corresponding to\\n * the amounts in the balances array. When multiplied together they\\n * should yield amounts at the pool's precision.\\n *\\n * @param baseVirtualPrice the base virtual price to scale the balance of the\\n * base Swap's LP token.\\n *\\n * @return an array of amounts \\\"scaled\\\" to the pool's precision\\n */\\n function _xp(\\n uint256[] memory balances,\\n uint256[] memory precisionMultipliers,\\n uint256 baseVirtualPrice\\n ) internal pure returns (uint256[] memory) {\\n uint256[] memory xp = SwapUtils._xp(balances, precisionMultipliers);\\n uint256 baseLPTokenIndex = balances.length.sub(1);\\n xp[baseLPTokenIndex] = xp[baseLPTokenIndex].mul(baseVirtualPrice).div(\\n BASE_VIRTUAL_PRICE_PRECISION\\n );\\n return xp;\\n }\\n\\n /**\\n * @notice Return the precision-adjusted balances of all tokens in the pool\\n * @param self Swap struct to read from\\n * @return the pool balances \\\"scaled\\\" to the pool's precision, allowing\\n * them to be more easily compared.\\n */\\n function _xp(SwapUtils.Swap storage self, uint256 baseVirtualPrice)\\n internal\\n view\\n returns (uint256[] memory)\\n {\\n return\\n _xp(\\n self.balances,\\n self.tokenPrecisionMultipliers,\\n baseVirtualPrice\\n );\\n }\\n\\n /**\\n * @notice Get the virtual price, to help calculate profit\\n * @param self Swap struct to read from\\n * @param metaSwapStorage MetaSwap struct to read from\\n * @return the virtual price, scaled to precision of BASE_VIRTUAL_PRICE_PRECISION\\n */\\n function getVirtualPrice(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage\\n ) external view returns (uint256) {\\n uint256 d = SwapUtils.getD(\\n _xp(\\n self.balances,\\n self.tokenPrecisionMultipliers,\\n _getBaseVirtualPrice(metaSwapStorage)\\n ),\\n self._getAPrecise()\\n );\\n uint256 supply = self.lpToken.totalSupply();\\n if (supply != 0) {\\n return d.mul(BASE_VIRTUAL_PRICE_PRECISION).div(supply);\\n }\\n return 0;\\n }\\n\\n /**\\n * @notice Externally calculates a swap between two tokens. The SwapUtils.Swap storage and\\n * MetaSwap storage should be from the same MetaSwap contract.\\n * @param self Swap struct to read from\\n * @param metaSwapStorage MetaSwap struct from the same contract\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @return dy the number of tokens the user will get\\n */\\n function calculateSwap(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view returns (uint256 dy) {\\n (dy, ) = _calculateSwap(\\n self,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n _getBaseVirtualPrice(metaSwapStorage)\\n );\\n }\\n\\n /**\\n * @notice Internally calculates a swap between two tokens.\\n *\\n * @dev The caller is expected to transfer the actual amounts (dx and dy)\\n * using the token contracts.\\n *\\n * @param self Swap struct to read from\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param baseVirtualPrice the virtual price of the base LP token\\n * @return dy the number of tokens the user will get and dyFee the associated fee\\n */\\n function _calculateSwap(\\n SwapUtils.Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 baseVirtualPrice\\n ) internal view returns (uint256 dy, uint256 dyFee) {\\n uint256[] memory xp = _xp(self, baseVirtualPrice);\\n require(\\n tokenIndexFrom < xp.length && tokenIndexTo < xp.length,\\n \\\"Token index out of range\\\"\\n );\\n uint256 baseLPTokenIndex = xp.length.sub(1);\\n\\n uint256 x = dx.mul(self.tokenPrecisionMultipliers[tokenIndexFrom]);\\n if (tokenIndexFrom == baseLPTokenIndex) {\\n // When swapping from a base Swap token, scale up dx by its virtual price\\n x = x.mul(baseVirtualPrice).div(BASE_VIRTUAL_PRICE_PRECISION);\\n }\\n x = x.add(xp[tokenIndexFrom]);\\n\\n uint256 y = SwapUtils.getY(\\n self._getAPrecise(),\\n tokenIndexFrom,\\n tokenIndexTo,\\n x,\\n xp\\n );\\n dy = xp[tokenIndexTo].sub(y).sub(1);\\n\\n if (tokenIndexTo == baseLPTokenIndex) {\\n // When swapping to a base Swap token, scale down dy by its virtual price\\n dy = dy.mul(BASE_VIRTUAL_PRICE_PRECISION).div(baseVirtualPrice);\\n }\\n\\n dyFee = dy.mul(self.swapFee).div(FEE_DENOMINATOR);\\n dy = dy.sub(dyFee);\\n\\n dy = dy.div(self.tokenPrecisionMultipliers[tokenIndexTo]);\\n }\\n\\n /**\\n * @notice Calculates the expected return amount from swapping between\\n * the pooled tokens and the underlying tokens of the base Swap pool.\\n *\\n * @param self Swap struct to read from\\n * @param metaSwapStorage MetaSwap struct from the same contract\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @return dy the number of tokens the user will get\\n */\\n function calculateSwapUnderlying(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view returns (uint256) {\\n CalculateSwapUnderlyingInfo memory v = CalculateSwapUnderlyingInfo(\\n _getBaseVirtualPrice(metaSwapStorage),\\n metaSwapStorage.baseSwap,\\n 0,\\n uint8(metaSwapStorage.baseTokens.length),\\n 0,\\n 0,\\n 0\\n );\\n\\n uint256[] memory xp = _xp(self, v.baseVirtualPrice);\\n v.baseLPTokenIndex = uint8(xp.length.sub(1));\\n {\\n uint8 maxRange = v.baseLPTokenIndex + v.baseTokensLength;\\n require(\\n tokenIndexFrom < maxRange && tokenIndexTo < maxRange,\\n \\\"Token index out of range\\\"\\n );\\n }\\n\\n if (tokenIndexFrom < v.baseLPTokenIndex) {\\n // tokenFrom is from this pool\\n v.x = xp[tokenIndexFrom].add(\\n dx.mul(self.tokenPrecisionMultipliers[tokenIndexFrom])\\n );\\n } else {\\n // tokenFrom is from the base pool\\n tokenIndexFrom = tokenIndexFrom - v.baseLPTokenIndex;\\n if (tokenIndexTo < v.baseLPTokenIndex) {\\n uint256[] memory baseInputs = new uint256[](v.baseTokensLength);\\n baseInputs[tokenIndexFrom] = dx;\\n v.x = v\\n .baseSwap\\n .calculateTokenAmount(baseInputs, true)\\n .mul(v.baseVirtualPrice)\\n .div(BASE_VIRTUAL_PRICE_PRECISION);\\n // when adding to the base pool,you pay approx 50% of the swap fee\\n v.x = v\\n .x\\n .sub(\\n v.x.mul(_getBaseSwapFee(metaSwapStorage.baseSwap)).div(\\n FEE_DENOMINATOR.mul(2)\\n )\\n )\\n .add(xp[v.baseLPTokenIndex]);\\n } else {\\n // both from and to are from the base pool\\n return\\n v.baseSwap.calculateSwap(\\n tokenIndexFrom,\\n tokenIndexTo - v.baseLPTokenIndex,\\n dx\\n );\\n }\\n tokenIndexFrom = v.baseLPTokenIndex;\\n }\\n\\n v.metaIndexTo = v.baseLPTokenIndex;\\n if (tokenIndexTo < v.baseLPTokenIndex) {\\n v.metaIndexTo = tokenIndexTo;\\n }\\n\\n {\\n uint256 y = SwapUtils.getY(\\n self._getAPrecise(),\\n tokenIndexFrom,\\n v.metaIndexTo,\\n v.x,\\n xp\\n );\\n v.dy = xp[v.metaIndexTo].sub(y).sub(1);\\n uint256 dyFee = v.dy.mul(self.swapFee).div(FEE_DENOMINATOR);\\n v.dy = v.dy.sub(dyFee);\\n }\\n\\n if (tokenIndexTo < v.baseLPTokenIndex) {\\n // tokenTo is from this pool\\n v.dy = v.dy.div(self.tokenPrecisionMultipliers[v.metaIndexTo]);\\n } else {\\n // tokenTo is from the base pool\\n v.dy = v.baseSwap.calculateRemoveLiquidityOneToken(\\n v.dy.mul(BASE_VIRTUAL_PRICE_PRECISION).div(v.baseVirtualPrice),\\n tokenIndexTo - v.baseLPTokenIndex\\n );\\n }\\n\\n return v.dy;\\n }\\n\\n /**\\n * @notice A simple method to calculate prices from deposits or\\n * withdrawals, excluding fees but including slippage. This is\\n * helpful as an input into the various \\\"min\\\" parameters on calls\\n * to fight front-running\\n *\\n * @dev This shouldn't be used outside frontends for user estimates.\\n *\\n * @param self Swap struct to read from\\n * @param metaSwapStorage MetaSwap struct to read from\\n * @param amounts an array of token amounts to deposit or withdrawal,\\n * corresponding to pooledTokens. The amount should be in each\\n * pooled token's native precision. If a token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param deposit whether this is a deposit or a withdrawal\\n * @return if deposit was true, total amount of lp token that will be minted and if\\n * deposit was false, total amount of lp token that will be burned\\n */\\n function calculateTokenAmount(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint256[] calldata amounts,\\n bool deposit\\n ) external view returns (uint256) {\\n uint256 a = self._getAPrecise();\\n uint256 d0;\\n uint256 d1;\\n {\\n uint256 baseVirtualPrice = _getBaseVirtualPrice(metaSwapStorage);\\n uint256[] memory balances1 = self.balances;\\n uint256[] memory tokenPrecisionMultipliers = self\\n .tokenPrecisionMultipliers;\\n uint256 numTokens = balances1.length;\\n d0 = SwapUtils.getD(\\n _xp(balances1, tokenPrecisionMultipliers, baseVirtualPrice),\\n a\\n );\\n for (uint256 i = 0; i < numTokens; i++) {\\n if (deposit) {\\n balances1[i] = balances1[i].add(amounts[i]);\\n } else {\\n balances1[i] = balances1[i].sub(\\n amounts[i],\\n \\\"Cannot withdraw more than available\\\"\\n );\\n }\\n }\\n d1 = SwapUtils.getD(\\n _xp(balances1, tokenPrecisionMultipliers, baseVirtualPrice),\\n a\\n );\\n }\\n uint256 totalSupply = self.lpToken.totalSupply();\\n\\n if (deposit) {\\n return d1.sub(d0).mul(totalSupply).div(d0);\\n } else {\\n return d0.sub(d1).mul(totalSupply).div(d0);\\n }\\n }\\n\\n /*** STATE MODIFYING FUNCTIONS ***/\\n\\n /**\\n * @notice swap two tokens in the pool\\n * @param self Swap struct to read from and write to\\n * @param metaSwapStorage MetaSwap struct to read from and write to\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @return amount of token user received on swap\\n */\\n function swap(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy\\n ) external returns (uint256) {\\n {\\n uint256 pooledTokensLength = self.pooledTokens.length;\\n require(\\n tokenIndexFrom < pooledTokensLength &&\\n tokenIndexTo < pooledTokensLength,\\n \\\"Token index is out of range\\\"\\n );\\n }\\n\\n uint256 transferredDx;\\n {\\n IERC20 tokenFrom = self.pooledTokens[tokenIndexFrom];\\n require(\\n dx <= tokenFrom.balanceOf(msg.sender),\\n \\\"Cannot swap more than you own\\\"\\n );\\n\\n {\\n // Transfer tokens first to see if a fee was charged on transfer\\n uint256 beforeBalance = tokenFrom.balanceOf(address(this));\\n tokenFrom.safeTransferFrom(msg.sender, address(this), dx);\\n\\n // Use the actual transferred amount for AMM math\\n transferredDx = tokenFrom.balanceOf(address(this)).sub(\\n beforeBalance\\n );\\n }\\n }\\n\\n (uint256 dy, uint256 dyFee) = _calculateSwap(\\n self,\\n tokenIndexFrom,\\n tokenIndexTo,\\n transferredDx,\\n _updateBaseVirtualPrice(metaSwapStorage)\\n );\\n require(dy >= minDy, \\\"Swap didn't result in min tokens\\\");\\n\\n uint256 dyAdminFee = dyFee.mul(self.adminFee).div(FEE_DENOMINATOR).div(\\n self.tokenPrecisionMultipliers[tokenIndexTo]\\n );\\n\\n self.balances[tokenIndexFrom] = self.balances[tokenIndexFrom].add(\\n transferredDx\\n );\\n self.balances[tokenIndexTo] = self.balances[tokenIndexTo].sub(dy).sub(\\n dyAdminFee\\n );\\n\\n self.pooledTokens[tokenIndexTo].safeTransfer(msg.sender, dy);\\n\\n emit TokenSwap(\\n msg.sender,\\n transferredDx,\\n dy,\\n tokenIndexFrom,\\n tokenIndexTo\\n );\\n\\n return dy;\\n }\\n\\n /**\\n * @notice Swaps with the underlying tokens of the base Swap pool. For this function,\\n * the token indices are flattened out so that underlying tokens are represented\\n * in the indices.\\n * @dev Since this calls multiple external functions during the execution,\\n * it is recommended to protect any function that depends on this with reentrancy guards.\\n * @param self Swap struct to read from and write to\\n * @param metaSwapStorage MetaSwap struct to read from and write to\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @return amount of token user received on swap\\n */\\n function swapUnderlying(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy\\n ) external returns (uint256) {\\n SwapUnderlyingInfo memory v = SwapUnderlyingInfo(\\n 0,\\n 0,\\n 0,\\n self.tokenPrecisionMultipliers,\\n self.balances,\\n metaSwapStorage.baseTokens,\\n IERC20(address(0)),\\n 0,\\n IERC20(address(0)),\\n 0,\\n _updateBaseVirtualPrice(metaSwapStorage)\\n );\\n\\n uint8 baseLPTokenIndex = uint8(v.oldBalances.length.sub(1));\\n\\n {\\n uint8 maxRange = uint8(baseLPTokenIndex + v.baseTokens.length);\\n require(\\n tokenIndexFrom < maxRange && tokenIndexTo < maxRange,\\n \\\"Token index out of range\\\"\\n );\\n }\\n\\n ISwap baseSwap = metaSwapStorage.baseSwap;\\n\\n // Find the address of the token swapping from and the index in MetaSwap's token list\\n if (tokenIndexFrom < baseLPTokenIndex) {\\n v.tokenFrom = self.pooledTokens[tokenIndexFrom];\\n v.metaIndexFrom = tokenIndexFrom;\\n } else {\\n v.tokenFrom = v.baseTokens[tokenIndexFrom - baseLPTokenIndex];\\n v.metaIndexFrom = baseLPTokenIndex;\\n }\\n\\n // Find the address of the token swapping to and the index in MetaSwap's token list\\n if (tokenIndexTo < baseLPTokenIndex) {\\n v.tokenTo = self.pooledTokens[tokenIndexTo];\\n v.metaIndexTo = tokenIndexTo;\\n } else {\\n v.tokenTo = v.baseTokens[tokenIndexTo - baseLPTokenIndex];\\n v.metaIndexTo = baseLPTokenIndex;\\n }\\n\\n // Check for possible fee on transfer\\n v.dx = v.tokenFrom.balanceOf(address(this));\\n v.tokenFrom.safeTransferFrom(msg.sender, address(this), dx);\\n v.dx = v.tokenFrom.balanceOf(address(this)).sub(v.dx); // update dx in case of fee on transfer\\n\\n if (\\n tokenIndexFrom < baseLPTokenIndex || tokenIndexTo < baseLPTokenIndex\\n ) {\\n // Either one of the tokens belongs to the MetaSwap tokens list\\n uint256[] memory xp = _xp(\\n v.oldBalances,\\n v.tokenPrecisionMultipliers,\\n v.baseVirtualPrice\\n );\\n\\n if (tokenIndexFrom < baseLPTokenIndex) {\\n // Swapping from a MetaSwap token\\n v.x = xp[tokenIndexFrom].add(\\n dx.mul(v.tokenPrecisionMultipliers[tokenIndexFrom])\\n );\\n } else {\\n // Swapping from one of the tokens hosted in the base Swap\\n // This case requires adding the underlying token to the base Swap, then\\n // using the base LP token to swap to the desired token\\n uint256[] memory baseAmounts = new uint256[](\\n v.baseTokens.length\\n );\\n baseAmounts[tokenIndexFrom - baseLPTokenIndex] = v.dx;\\n\\n // Add liquidity to the base Swap contract and receive base LP token\\n v.dx = baseSwap.addLiquidity(baseAmounts, 0, block.timestamp);\\n\\n // Calculate the value of total amount of baseLPToken we end up with\\n v.x = v\\n .dx\\n .mul(v.baseVirtualPrice)\\n .div(BASE_VIRTUAL_PRICE_PRECISION)\\n .add(xp[baseLPTokenIndex]);\\n }\\n\\n // Calculate how much to withdraw in MetaSwap level and the the associated swap fee\\n uint256 dyFee;\\n {\\n uint256 y = SwapUtils.getY(\\n self._getAPrecise(),\\n v.metaIndexFrom,\\n v.metaIndexTo,\\n v.x,\\n xp\\n );\\n v.dy = xp[v.metaIndexTo].sub(y).sub(1);\\n if (tokenIndexTo >= baseLPTokenIndex) {\\n // When swapping to a base Swap token, scale down dy by its virtual price\\n v.dy = v.dy.mul(BASE_VIRTUAL_PRICE_PRECISION).div(\\n v.baseVirtualPrice\\n );\\n }\\n dyFee = v.dy.mul(self.swapFee).div(FEE_DENOMINATOR);\\n v.dy = v.dy.sub(dyFee).div(\\n v.tokenPrecisionMultipliers[v.metaIndexTo]\\n );\\n }\\n\\n // Update the balances array according to the calculated input and output amount\\n {\\n uint256 dyAdminFee = dyFee.mul(self.adminFee).div(\\n FEE_DENOMINATOR\\n );\\n dyAdminFee = dyAdminFee.div(\\n v.tokenPrecisionMultipliers[v.metaIndexTo]\\n );\\n self.balances[v.metaIndexFrom] = v\\n .oldBalances[v.metaIndexFrom]\\n .add(v.dx);\\n self.balances[v.metaIndexTo] = v\\n .oldBalances[v.metaIndexTo]\\n .sub(v.dy)\\n .sub(dyAdminFee);\\n }\\n\\n if (tokenIndexTo >= baseLPTokenIndex) {\\n // When swapping to a token that belongs to the base Swap, burn the LP token\\n // and withdraw the desired token from the base pool\\n uint256 oldBalance = v.tokenTo.balanceOf(address(this));\\n baseSwap.removeLiquidityOneToken(\\n v.dy,\\n tokenIndexTo - baseLPTokenIndex,\\n 0,\\n block.timestamp\\n );\\n v.dy = v.tokenTo.balanceOf(address(this)) - oldBalance;\\n }\\n\\n // Check the amount of token to send meets minDy\\n require(v.dy >= minDy, \\\"Swap didn't result in min tokens\\\");\\n } else {\\n // Both tokens are from the base Swap pool\\n // Do a swap through the base Swap\\n v.dy = v.tokenTo.balanceOf(address(this));\\n baseSwap.swap(\\n tokenIndexFrom - baseLPTokenIndex,\\n tokenIndexTo - baseLPTokenIndex,\\n v.dx,\\n minDy,\\n block.timestamp\\n );\\n v.dy = v.tokenTo.balanceOf(address(this)).sub(v.dy);\\n }\\n\\n // Send the desired token to the caller\\n v.tokenTo.safeTransfer(msg.sender, v.dy);\\n\\n emit TokenSwapUnderlying(\\n msg.sender,\\n dx,\\n v.dy,\\n tokenIndexFrom,\\n tokenIndexTo\\n );\\n\\n return v.dy;\\n }\\n\\n /**\\n * @notice Add liquidity to the pool\\n * @param self Swap struct to read from and write to\\n * @param metaSwapStorage MetaSwap struct to read from and write to\\n * @param amounts the amounts of each token to add, in their native precision\\n * @param minToMint the minimum LP tokens adding this amount of liquidity\\n * should mint, otherwise revert. Handy for front-running mitigation\\n * allowed addresses. If the pool is not in the guarded launch phase, this parameter will be ignored.\\n * @return amount of LP token user received\\n */\\n function addLiquidity(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint256[] memory amounts,\\n uint256 minToMint\\n ) external returns (uint256) {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n require(\\n amounts.length == pooledTokens.length,\\n \\\"Amounts must match pooled tokens\\\"\\n );\\n\\n uint256[] memory fees = new uint256[](pooledTokens.length);\\n\\n // current state\\n ManageLiquidityInfo memory v = ManageLiquidityInfo(\\n 0,\\n 0,\\n 0,\\n self.lpToken,\\n 0,\\n self._getAPrecise(),\\n _updateBaseVirtualPrice(metaSwapStorage),\\n self.tokenPrecisionMultipliers,\\n self.balances\\n );\\n v.totalSupply = v.lpToken.totalSupply();\\n\\n if (v.totalSupply != 0) {\\n v.d0 = SwapUtils.getD(\\n _xp(\\n v.newBalances,\\n v.tokenPrecisionMultipliers,\\n v.baseVirtualPrice\\n ),\\n v.preciseA\\n );\\n }\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n require(\\n v.totalSupply != 0 || amounts[i] > 0,\\n \\\"Must supply all tokens in pool\\\"\\n );\\n\\n // Transfer tokens first to see if a fee was charged on transfer\\n if (amounts[i] != 0) {\\n uint256 beforeBalance = pooledTokens[i].balanceOf(\\n address(this)\\n );\\n pooledTokens[i].safeTransferFrom(\\n msg.sender,\\n address(this),\\n amounts[i]\\n );\\n\\n // Update the amounts[] with actual transfer amount\\n amounts[i] = pooledTokens[i].balanceOf(address(this)).sub(\\n beforeBalance\\n );\\n }\\n\\n v.newBalances[i] = v.newBalances[i].add(amounts[i]);\\n }\\n\\n // invariant after change\\n v.d1 = SwapUtils.getD(\\n _xp(v.newBalances, v.tokenPrecisionMultipliers, v.baseVirtualPrice),\\n v.preciseA\\n );\\n require(v.d1 > v.d0, \\\"D should increase\\\");\\n\\n // updated to reflect fees and calculate the user's LP tokens\\n v.d2 = v.d1;\\n uint256 toMint;\\n\\n if (v.totalSupply != 0) {\\n uint256 feePerToken = SwapUtils._feePerToken(\\n self.swapFee,\\n pooledTokens.length\\n );\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n uint256 idealBalance = v.d1.mul(self.balances[i]).div(v.d0);\\n fees[i] = feePerToken\\n .mul(idealBalance.difference(v.newBalances[i]))\\n .div(FEE_DENOMINATOR);\\n self.balances[i] = v.newBalances[i].sub(\\n fees[i].mul(self.adminFee).div(FEE_DENOMINATOR)\\n );\\n v.newBalances[i] = v.newBalances[i].sub(fees[i]);\\n }\\n v.d2 = SwapUtils.getD(\\n _xp(\\n v.newBalances,\\n v.tokenPrecisionMultipliers,\\n v.baseVirtualPrice\\n ),\\n v.preciseA\\n );\\n toMint = v.d2.sub(v.d0).mul(v.totalSupply).div(v.d0);\\n } else {\\n // the initial depositor doesn't pay fees\\n self.balances = v.newBalances;\\n toMint = v.d1;\\n }\\n\\n require(toMint >= minToMint, \\\"Couldn't mint min requested\\\");\\n\\n // mint the user's LP tokens\\n self.lpToken.mint(msg.sender, toMint);\\n\\n emit AddLiquidity(\\n msg.sender,\\n amounts,\\n fees,\\n v.d1,\\n v.totalSupply.add(toMint)\\n );\\n\\n return toMint;\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool all in one token.\\n * @param self Swap struct to read from and write to\\n * @param metaSwapStorage MetaSwap struct to read from and write to\\n * @param tokenAmount the amount of the lp tokens to burn\\n * @param tokenIndex the index of the token you want to receive\\n * @param minAmount the minimum amount to withdraw, otherwise revert\\n * @return amount chosen token that user received\\n */\\n function removeLiquidityOneToken(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount\\n ) external returns (uint256) {\\n LPToken lpToken = self.lpToken;\\n uint256 totalSupply = lpToken.totalSupply();\\n uint256 numTokens = self.pooledTokens.length;\\n require(tokenAmount <= lpToken.balanceOf(msg.sender), \\\">LP.balanceOf\\\");\\n require(tokenIndex < numTokens, \\\"Token not found\\\");\\n\\n uint256 dyFee;\\n uint256 dy;\\n\\n (dy, dyFee) = _calculateWithdrawOneToken(\\n self,\\n tokenAmount,\\n tokenIndex,\\n _updateBaseVirtualPrice(metaSwapStorage),\\n totalSupply\\n );\\n\\n require(dy >= minAmount, \\\"dy < minAmount\\\");\\n\\n // Update balances array\\n self.balances[tokenIndex] = self.balances[tokenIndex].sub(\\n dy.add(dyFee.mul(self.adminFee).div(FEE_DENOMINATOR))\\n );\\n\\n // Burn the associated LP token from the caller and send the desired token\\n lpToken.burnFrom(msg.sender, tokenAmount);\\n self.pooledTokens[tokenIndex].safeTransfer(msg.sender, dy);\\n\\n emit RemoveLiquidityOne(\\n msg.sender,\\n tokenAmount,\\n totalSupply,\\n tokenIndex,\\n dy\\n );\\n\\n return dy;\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool, weighted differently than the\\n * pool's current balances.\\n *\\n * @param self Swap struct to read from and write to\\n * @param metaSwapStorage MetaSwap struct to read from and write to\\n * @param amounts how much of each token to withdraw\\n * @param maxBurnAmount the max LP token provider is willing to pay to\\n * remove liquidity. Useful as a front-running mitigation.\\n * @return actual amount of LP tokens burned in the withdrawal\\n */\\n function removeLiquidityImbalance(\\n SwapUtils.Swap storage self,\\n MetaSwap storage metaSwapStorage,\\n uint256[] memory amounts,\\n uint256 maxBurnAmount\\n ) public returns (uint256) {\\n // Using this struct to avoid stack too deep error\\n ManageLiquidityInfo memory v = ManageLiquidityInfo(\\n 0,\\n 0,\\n 0,\\n self.lpToken,\\n 0,\\n self._getAPrecise(),\\n _updateBaseVirtualPrice(metaSwapStorage),\\n self.tokenPrecisionMultipliers,\\n self.balances\\n );\\n v.totalSupply = v.lpToken.totalSupply();\\n\\n require(\\n amounts.length == v.newBalances.length,\\n \\\"Amounts should match pool tokens\\\"\\n );\\n require(maxBurnAmount != 0, \\\"Must burn more than 0\\\");\\n\\n uint256 feePerToken = SwapUtils._feePerToken(\\n self.swapFee,\\n v.newBalances.length\\n );\\n\\n // Calculate how much LPToken should be burned\\n uint256[] memory fees = new uint256[](v.newBalances.length);\\n {\\n uint256[] memory balances1 = new uint256[](v.newBalances.length);\\n\\n v.d0 = SwapUtils.getD(\\n _xp(\\n v.newBalances,\\n v.tokenPrecisionMultipliers,\\n v.baseVirtualPrice\\n ),\\n v.preciseA\\n );\\n for (uint256 i = 0; i < v.newBalances.length; i++) {\\n balances1[i] = v.newBalances[i].sub(\\n amounts[i],\\n \\\"Cannot withdraw more than available\\\"\\n );\\n }\\n v.d1 = SwapUtils.getD(\\n _xp(balances1, v.tokenPrecisionMultipliers, v.baseVirtualPrice),\\n v.preciseA\\n );\\n\\n for (uint256 i = 0; i < v.newBalances.length; i++) {\\n uint256 idealBalance = v.d1.mul(v.newBalances[i]).div(v.d0);\\n uint256 difference = idealBalance.difference(balances1[i]);\\n fees[i] = feePerToken.mul(difference).div(FEE_DENOMINATOR);\\n self.balances[i] = balances1[i].sub(\\n fees[i].mul(self.adminFee).div(FEE_DENOMINATOR)\\n );\\n balances1[i] = balances1[i].sub(fees[i]);\\n }\\n\\n v.d2 = SwapUtils.getD(\\n _xp(balances1, v.tokenPrecisionMultipliers, v.baseVirtualPrice),\\n v.preciseA\\n );\\n }\\n\\n uint256 tokenAmount = v.d0.sub(v.d2).mul(v.totalSupply).div(v.d0);\\n require(tokenAmount != 0, \\\"Burnt amount cannot be zero\\\");\\n\\n // Scale up by withdraw fee\\n tokenAmount = tokenAmount.add(1);\\n\\n // Check for max burn amount\\n require(tokenAmount <= maxBurnAmount, \\\"tokenAmount > maxBurnAmount\\\");\\n\\n // Burn the calculated amount of LPToken from the caller and send the desired tokens\\n v.lpToken.burnFrom(msg.sender, tokenAmount);\\n for (uint256 i = 0; i < v.newBalances.length; i++) {\\n self.pooledTokens[i].safeTransfer(msg.sender, amounts[i]);\\n }\\n\\n emit RemoveLiquidityImbalance(\\n msg.sender,\\n amounts,\\n fees,\\n v.d1,\\n v.totalSupply.sub(tokenAmount)\\n );\\n\\n return tokenAmount;\\n }\\n\\n /**\\n * @notice Determines if the stored value of base Swap's virtual price is expired.\\n * If the last update was past the BASE_CACHE_EXPIRE_TIME, then update the stored value.\\n *\\n * @param metaSwapStorage MetaSwap struct to read from and write to\\n * @return base Swap's virtual price\\n */\\n function _updateBaseVirtualPrice(MetaSwap storage metaSwapStorage)\\n internal\\n returns (uint256)\\n {\\n if (\\n block.timestamp >\\n metaSwapStorage.baseCacheLastUpdated + BASE_CACHE_EXPIRE_TIME\\n ) {\\n // When the cache is expired, update it\\n uint256 baseVirtualPrice = ISwap(metaSwapStorage.baseSwap)\\n .getVirtualPrice();\\n metaSwapStorage.baseVirtualPrice = baseVirtualPrice;\\n metaSwapStorage.baseCacheLastUpdated = block.timestamp;\\n return baseVirtualPrice;\\n } else {\\n return metaSwapStorage.baseVirtualPrice;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb64b855d7c6af37c3ccd1713e9079e61baf14b4c8f984b7ef77ba33ceab87e7d\",\"license\":\"MIT\"},\"contracts/permissionless/PermissionlessMetaSwap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"./PermissionlessSwap.sol\\\";\\nimport \\\"./ShareProtocolFee.sol\\\";\\nimport \\\"../meta/MetaSwapUtils.sol\\\";\\nimport \\\"../meta/MetaSwap.sol\\\";\\n\\n/**\\n * @title MetaSwap - A StableSwap implementation in solidity.\\n * @notice This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)\\n * and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens\\n * in desired ratios for an exchange of the pool token that represents their share of the pool.\\n * Users can burn pool tokens and withdraw their share of token(s).\\n *\\n * Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets\\n * distributed to the LPs.\\n *\\n * In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which\\n * stops the ratio of the tokens in the pool from changing.\\n * Users can always withdraw their tokens via multi-asset withdraws.\\n *\\n * MetaSwap is a modified version of Swap that allows Swap's LP token to be utilized in pooling with other tokens.\\n * As an example, if there is a Swap pool consisting of [DAI, USDC, USDT], then a MetaSwap pool can be created\\n * with [sUSD, BaseSwapLPToken] to allow trades between either the LP token or the underlying tokens and sUSD.\\n * Note that when interacting with MetaSwap, users cannot deposit or withdraw via underlying tokens. In that case,\\n * `MetaSwapDeposit.sol` can be additionally deployed to allow interacting with unwrapped representations of the tokens.\\n *\\n * @dev Most of the logic is stored as a library `MetaSwapUtils` for the sake of reducing contract's\\n * deployment size.\\n */\\ncontract PermissionlessMetaSwap is MetaSwap, ShareProtocolFee {\\n using PermissionlessSwapUtils for SwapUtils.Swap;\\n\\n /**\\n * @notice Constructor for the PermissionlessSwap contract.\\n * @param _masterRegistry address of the MasterRegistry contract\\n */\\n constructor(IMasterRegistry _masterRegistry)\\n public\\n ShareProtocolFee(_masterRegistry)\\n {}\\n\\n /*** ADMIN FUNCTIONS ***/\\n\\n function initializeMetaSwap(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress,\\n ISwap baseSwap\\n ) public payable virtual override initializer {\\n MetaSwap.initializeMetaSwap(\\n _pooledTokens,\\n decimals,\\n lpTokenName,\\n lpTokenSymbol,\\n _a,\\n _fee,\\n _adminFee,\\n lpTokenTargetAddress,\\n baseSwap\\n );\\n _updateFeeCollectorCache(MASTER_REGISTRY);\\n }\\n\\n /**\\n * @notice Withdraw all admin fees to the contract owner and the fee collector\\n */\\n function withdrawAdminFees()\\n external\\n payable\\n virtual\\n override(ShareProtocolFee, Swap)\\n {\\n require(\\n msg.sender == owner() || msg.sender == feeCollector,\\n \\\"Caller is not authorized\\\"\\n );\\n PermissionlessSwapUtils.withdrawAdminFees(\\n swapStorage,\\n owner(),\\n feeCollector\\n );\\n }\\n}\\n\",\"keccak256\":\"0x9157d2035911577e56740f874bf237dfcd5245de8e80faca443adf7fd1fd1937\",\"license\":\"MIT\"},\"contracts/permissionless/PermissionlessSwap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"../Swap.sol\\\";\\nimport \\\"../interfaces/IMasterRegistry.sol\\\";\\nimport \\\"./PermissionlessSwapUtils.sol\\\";\\nimport \\\"./ShareProtocolFee.sol\\\";\\n\\n/**\\n * @title Swap - A StableSwap implementation in solidity.\\n * @notice This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)\\n * and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens\\n * in desired ratios for an exchange of the pool token that represents their share of the pool.\\n * Users can burn pool tokens and withdraw their share of token(s).\\n *\\n * Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets\\n * distributed to the LPs. Part of this fee is given to the creator of the pool as an Admin fee,\\n * the amount of which is set when the pool is created. Saddle will collect to 50% of these Admin fees.\\n *\\n * In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which\\n * stops the ratio of the tokens in the pool from changing.\\n * Users can always withdraw their tokens via multi-asset withdraws.\\n *\\n * @dev Most of the logic is stored as a library `PermissionlessSwapUtils` for the sake of reducing\\n * contract's deployment size.\\n */\\ncontract PermissionlessSwap is Swap, ShareProtocolFee {\\n using PermissionlessSwapUtils for SwapUtils.Swap;\\n\\n /**\\n * @notice Constructor for the PermissionlessSwap contract.\\n * @param _masterRegistry address of the MasterRegistry contract\\n */\\n constructor(IMasterRegistry _masterRegistry)\\n public\\n ShareProtocolFee(_masterRegistry)\\n {}\\n\\n /*** ADMIN FUNCTIONS ***/\\n\\n /**\\n * @notice Updates cached address of the fee collector\\n */\\n function initialize(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress\\n ) public payable virtual override initializer {\\n Swap.initialize(\\n _pooledTokens,\\n decimals,\\n lpTokenName,\\n lpTokenSymbol,\\n _a,\\n _fee,\\n _adminFee,\\n lpTokenTargetAddress\\n );\\n _updateFeeCollectorCache(MASTER_REGISTRY);\\n }\\n\\n /**\\n * @notice Withdraw all admin fees to the contract owner and the fee collector.\\n */\\n function withdrawAdminFees()\\n external\\n payable\\n virtual\\n override(Swap, ShareProtocolFee)\\n {\\n require(\\n msg.sender == owner() || msg.sender == feeCollector,\\n \\\"Caller is not authorized\\\"\\n );\\n PermissionlessSwapUtils.withdrawAdminFees(\\n swapStorage,\\n owner(),\\n feeCollector\\n );\\n }\\n}\\n\",\"keccak256\":\"0x36bb4e9bb6cfea001cb6d44018f5297c0552dddd1958e06232b529e4fe6deb58\",\"license\":\"MIT\"},\"contracts/permissionless/PermissionlessSwapUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"../SwapUtils.sol\\\";\\n\\n/**\\n * @title PermissionlessSwapUtils library\\n * @notice A library to be used within Swap.sol. Contains functions responsible for custody and AMM functionalities.\\n * @dev Contracts relying on this library must initialize SwapUtils.Swap struct then use this library\\n * for SwapUtils.Swap struct. Note that this library contains both functions called by users and admins.\\n * Admin functions should be protected within contracts using this library.\\n */\\nlibrary PermissionlessSwapUtils {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n\\n /**\\n * @notice Withdraw all admin fees to two addresses evenly\\n * @param self Swap struct to withdraw fees from\\n * @param creator Address to send hald of the fees to. For the creator of the community pool.\\n * @param protocol Address to send the half of the fees to. For the protocol fee collection.\\n */\\n function withdrawAdminFees(\\n SwapUtils.Swap storage self,\\n address creator,\\n address protocol\\n ) internal {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n IERC20 token = pooledTokens[i];\\n uint256 balance = token.balanceOf(address(this)).sub(\\n self.balances[i]\\n ) / 2;\\n if (balance != 0) {\\n token.safeTransfer(creator, balance);\\n token.safeTransfer(protocol, balance);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1b94e14de31e95f82bf8f47aa65f4c68c7152823cac6daf2b50c3923f20f2ecc\",\"license\":\"MIT\"},\"contracts/permissionless/ShareProtocolFee.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\nimport \\\"../interfaces/IMasterRegistry.sol\\\";\\n\\nabstract contract ShareProtocolFee {\\n IMasterRegistry public immutable MASTER_REGISTRY;\\n bytes32 public constant FEE_COLLECTOR_NAME =\\n 0x466565436f6c6c6563746f720000000000000000000000000000000000000000;\\n address public feeCollector;\\n\\n constructor(IMasterRegistry _masterRegistry) public {\\n MASTER_REGISTRY = _masterRegistry;\\n _updateFeeCollectorCache(_masterRegistry);\\n }\\n\\n /**\\n * @notice Updates cached address of the fee collector\\n */\\n function updateFeeCollectorCache() public payable virtual {\\n _updateFeeCollectorCache(MASTER_REGISTRY);\\n }\\n\\n function _updateFeeCollectorCache(IMasterRegistry masterRegistry)\\n internal\\n virtual\\n {\\n address _feeCollector = masterRegistry.resolveNameToLatestAddress(\\n FEE_COLLECTOR_NAME\\n );\\n require(_feeCollector != address(0), \\\"Fee collector cannot be empty\\\");\\n feeCollector = _feeCollector;\\n }\\n\\n /**\\n * @notice Withdraws admin fees to appropriate addresses\\n */\\n function withdrawAdminFees() external payable virtual;\\n}\\n\",\"keccak256\":\"0x4af76c8dd2356c160c60f1378a11a832f0e99e9bbb36908b95d3743f3aecbc32\",\"license\":\"MIT\"}},\"version\":1}", @@ -1769,4 +1767,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/PermissionlessSwapV1.json b/deployments/base_testnet/PermissionlessSwapV1.json index 28ed68fa..7cda8e0e 100644 --- a/deployments/base_testnet/PermissionlessSwapV1.json +++ b/deployments/base_testnet/PermissionlessSwapV1.json @@ -962,9 +962,7 @@ "status": 1, "byzantium": true }, - "args": [ - "0x9cDeF6e33687F438808766fC133b2E9d1A16AD57" - ], + "args": ["0x9cDeF6e33687F438808766fC133b2E9d1A16AD57"], "numDeployments": 1, "solcInputHash": "bc3a64a5cffb1e8de0dbf9fb306e4f9f", "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IMasterRegistry\",\"name\":\"_masterRegistry\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenAmounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"fees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"invariant\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"}],\"name\":\"AddLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newAdminFee\",\"type\":\"uint256\"}],\"name\":\"NewAdminFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSwapFee\",\"type\":\"uint256\"}],\"name\":\"NewSwapFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newWithdrawFee\",\"type\":\"uint256\"}],\"name\":\"NewWithdrawFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldA\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newA\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"initialTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"futureTime\",\"type\":\"uint256\"}],\"name\":\"RampA\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenAmounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"}],\"name\":\"RemoveLiquidity\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenAmounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"fees\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"invariant\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"}],\"name\":\"RemoveLiquidityImbalance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lpTokenSupply\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"boughtId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensBought\",\"type\":\"uint256\"}],\"name\":\"RemoveLiquidityOne\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"currentA\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"StopRampA\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"buyer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensSold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokensBought\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"soldId\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"boughtId\",\"type\":\"uint128\"}],\"name\":\"TokenSwap\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"FEE_COLLECTOR_NAME\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MASTER_REGISTRY\",\"outputs\":[{\"internalType\":\"contract IMasterRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"minToMint\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"calculateRemoveLiquidity\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndex\",\"type\":\"uint8\"}],\"name\":\"calculateRemoveLiquidityOneToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"availableTokenAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenIndexFrom\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndexTo\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dx\",\"type\":\"uint256\"}],\"name\":\"calculateSwap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bool\",\"name\":\"deposit\",\"type\":\"bool\"}],\"name\":\"calculateTokenAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeCollector\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getA\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAPrecise\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getAdminBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"getToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"getTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"getTokenIndex\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVirtualPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"_pooledTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint8[]\",\"name\":\"decimals\",\"type\":\"uint8[]\"},{\"internalType\":\"string\",\"name\":\"lpTokenName\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"lpTokenSymbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_a\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_adminFee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"lpTokenTargetAddress\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"futureA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"futureTime\",\"type\":\"uint256\"}],\"name\":\"rampA\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"minAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidity\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"maxBurnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityImbalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndex\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"minAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidityOneToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newAdminFee\",\"type\":\"uint256\"}],\"name\":\"setAdminFee\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newSwapFee\",\"type\":\"uint256\"}],\"name\":\"setSwapFee\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stopRampA\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"tokenIndexFrom\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"tokenIndexTo\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"dx\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDy\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"swap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapStorage\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"initialA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"futureA\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initialATime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"futureATime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"swapFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"adminFee\",\"type\":\"uint256\"},{\"internalType\":\"contract LPToken\",\"name\":\"lpToken\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"updateFeeCollectorCache\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawAdminFees\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Most of the logic is stored as a library `PermissionlessSwapUtils` for the sake of reducing contract's deployment size.\",\"kind\":\"dev\",\"methods\":{\"addLiquidity(uint256[],uint256,uint256)\":{\"params\":{\"amounts\":\"the amounts of each token to add, in their native precision\",\"deadline\":\"latest timestamp to accept this transaction\",\"minToMint\":\"the minimum LP tokens adding this amount of liquidity should mint, otherwise revert. Handy for front-running mitigation\"},\"returns\":{\"_0\":\"amount of LP token user minted and received\"}},\"calculateRemoveLiquidity(uint256)\":{\"params\":{\"amount\":\"the amount of LP tokens that would be burned on withdrawal\"},\"returns\":{\"_0\":\"array of token balances that the user will receive\"}},\"calculateRemoveLiquidityOneToken(uint256,uint8)\":{\"params\":{\"tokenAmount\":\"the amount of LP token to burn\",\"tokenIndex\":\"index of which token will be withdrawn\"},\"returns\":{\"availableTokenAmount\":\"calculated amount of underlying token available to withdraw\"}},\"calculateSwap(uint8,uint8,uint256)\":{\"params\":{\"dx\":\"the amount of tokens the user wants to sell. If the token charges a fee on transfers, use the amount that gets transferred after the fee.\",\"tokenIndexFrom\":\"the token the user wants to sell\",\"tokenIndexTo\":\"the token the user wants to buy\"},\"returns\":{\"_0\":\"amount of tokens the user will receive\"}},\"calculateTokenAmount(uint256[],bool)\":{\"details\":\"This shouldn't be used outside frontends for user estimates.\",\"params\":{\"amounts\":\"an array of token amounts to deposit or withdrawal, corresponding to pooledTokens. The amount should be in each pooled token's native precision. If a token charges a fee on transfers, use the amount that gets transferred after the fee.\",\"deposit\":\"whether this is a deposit or a withdrawal\"},\"returns\":{\"_0\":\"token amount the user will receive\"}},\"constructor\":{\"params\":{\"_masterRegistry\":\"address of the MasterRegistry contract\"}},\"getA()\":{\"details\":\"See the StableSwap paper for details\",\"returns\":{\"_0\":\"A parameter\"}},\"getAPrecise()\":{\"details\":\"See the StableSwap paper for details\",\"returns\":{\"_0\":\"A parameter in its raw precision form\"}},\"getAdminBalance(uint256)\":{\"params\":{\"index\":\"Index of the pooled token\"},\"returns\":{\"_0\":\"admin's token balance in the token's precision\"}},\"getToken(uint8)\":{\"params\":{\"index\":\"the index of the token\"},\"returns\":{\"_0\":\"address of the token at given index\"}},\"getTokenBalance(uint8)\":{\"params\":{\"index\":\"the index of the token\"},\"returns\":{\"_0\":\"current balance of the pooled token at given index with token's native precision\"}},\"getTokenIndex(address)\":{\"params\":{\"tokenAddress\":\"address of the token\"},\"returns\":{\"_0\":\"the index of the given token address\"}},\"getVirtualPrice()\":{\"returns\":{\"_0\":\"the virtual price, scaled to the POOL_PRECISION_DECIMALS\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"rampA(uint256,uint256)\":{\"params\":{\"futureA\":\"the new A to ramp towards\",\"futureTime\":\"timestamp when the new A should be reached\"}},\"removeLiquidity(uint256,uint256[],uint256)\":{\"details\":\"Liquidity can always be removed, even when the pool is paused.\",\"params\":{\"amount\":\"the amount of LP tokens to burn\",\"deadline\":\"latest timestamp to accept this transaction\",\"minAmounts\":\"the minimum amounts of each token in the pool acceptable for this burn. Useful as a front-running mitigation\"},\"returns\":{\"_0\":\"amounts of tokens user received\"}},\"removeLiquidityImbalance(uint256[],uint256,uint256)\":{\"params\":{\"amounts\":\"how much of each token to withdraw\",\"deadline\":\"latest timestamp to accept this transaction\",\"maxBurnAmount\":\"the max LP token provider is willing to pay to remove liquidity. Useful as a front-running mitigation.\"},\"returns\":{\"_0\":\"amount of LP tokens burned\"}},\"removeLiquidityOneToken(uint256,uint8,uint256,uint256)\":{\"params\":{\"deadline\":\"latest timestamp to accept this transaction\",\"minAmount\":\"the minimum amount to withdraw, otherwise revert\",\"tokenAmount\":\"the amount of the token you want to receive\",\"tokenIndex\":\"the index of the token you want to receive\"},\"returns\":{\"_0\":\"amount of chosen token user received\"}},\"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.\"},\"setAdminFee(uint256)\":{\"params\":{\"newAdminFee\":\"new admin fee to be applied on future transactions\"}},\"setSwapFee(uint256)\":{\"params\":{\"newSwapFee\":\"new swap fee to be applied on future transactions\"}},\"swap(uint8,uint8,uint256,uint256,uint256)\":{\"params\":{\"deadline\":\"latest timestamp to accept this transaction\",\"dx\":\"the amount of tokens the user wants to swap from\",\"minDy\":\"the min amount the user would like to receive, or revert.\",\"tokenIndexFrom\":\"the token the user wants to swap from\",\"tokenIndexTo\":\"the token the user wants to swap to\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Swap - A StableSwap implementation in solidity.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"addLiquidity(uint256[],uint256,uint256)\":{\"notice\":\"Add liquidity to the pool with the given amounts of tokens\"},\"calculateRemoveLiquidity(uint256)\":{\"notice\":\"A simple method to calculate amount of each underlying tokens that is returned upon burning given amount of LP tokens\"},\"calculateRemoveLiquidityOneToken(uint256,uint8)\":{\"notice\":\"Calculate the amount of underlying token available to withdraw when withdrawing via only single token\"},\"calculateSwap(uint8,uint8,uint256)\":{\"notice\":\"Calculate amount of tokens you receive on swap\"},\"calculateTokenAmount(uint256[],bool)\":{\"notice\":\"A simple method to calculate prices from deposits or withdrawals, excluding fees but including slippage. This is helpful as an input into the various \\\"min\\\" parameters on calls to fight front-running\"},\"constructor\":\"Constructor for the PermissionlessSwap contract.\",\"getA()\":{\"notice\":\"Return A, the amplification coefficient * n * (n - 1)\"},\"getAPrecise()\":{\"notice\":\"Return A in its raw precision form\"},\"getAdminBalance(uint256)\":{\"notice\":\"This function reads the accumulated amount of admin fees of the token with given index\"},\"getToken(uint8)\":{\"notice\":\"Return address of the pooled token at given index. Reverts if tokenIndex is out of range.\"},\"getTokenBalance(uint8)\":{\"notice\":\"Return current balance of the pooled token at given index\"},\"getTokenIndex(address)\":{\"notice\":\"Return the index of the given token address. Reverts if no matching token is found.\"},\"getVirtualPrice()\":{\"notice\":\"Get the virtual price, to help calculate profit\"},\"initialize(address[],uint8[],string,string,uint256,uint256,uint256,address)\":{\"notice\":\"Updates cached address of the fee collector\"},\"pause()\":{\"notice\":\"Pause the contract. Revert if already paused.\"},\"rampA(uint256,uint256)\":{\"notice\":\"Start ramping up or down A parameter towards given futureA and futureTime Checks if the change is too rapid, and commits the new A value only when it falls under the limit range.\"},\"removeLiquidity(uint256,uint256[],uint256)\":{\"notice\":\"Burn LP tokens to remove liquidity from the pool. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.\"},\"removeLiquidityImbalance(uint256[],uint256,uint256)\":{\"notice\":\"Remove liquidity from the pool, weighted differently than the pool's current balances. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.\"},\"removeLiquidityOneToken(uint256,uint8,uint256,uint256)\":{\"notice\":\"Remove liquidity from the pool all in one token. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.\"},\"setAdminFee(uint256)\":{\"notice\":\"Update the admin fee. Admin fee takes portion of the swap fee.\"},\"setSwapFee(uint256)\":{\"notice\":\"Update the swap fee to be applied on swaps\"},\"stopRampA()\":{\"notice\":\"Stop ramping A immediately. Reverts if ramp A is already stopped.\"},\"swap(uint8,uint8,uint256,uint256,uint256)\":{\"notice\":\"Swap two tokens using this pool\"},\"unpause()\":{\"notice\":\"Unpause the contract. Revert if already unpaused.\"},\"updateFeeCollectorCache()\":{\"notice\":\"Updates cached address of the fee collector\"},\"withdrawAdminFees()\":{\"notice\":\"Withdraw all admin fees to the contract owner and the fee collector.\"}},\"notice\":\"This contract is responsible for custody of closely pegged assets (eg. group of stablecoins) and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens in desired ratios for an exchange of the pool token that represents their share of the pool. Users can burn pool tokens and withdraw their share of token(s). Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets distributed to the LPs. Part of this fee is given to the creator of the pool as an Admin fee, the amount of which is set when the pool is created. Saddle will collect to 50% of these Admin fees. In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which stops the ratio of the tokens in the pool from changing. Users can always withdraw their tokens via multi-asset withdraws.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/permissionless/PermissionlessSwap.sol\":\"PermissionlessSwap\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0xb419e68addcb82ecda3ad3974b0d2db76435ce9b08435a04d5b119a0c5d45ea5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMathUpgradeable {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0x0dd1e9b19801e3e7d900fbf4182d81e1afd23ad7be39504e33df6bbcba91d724\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity >=0.4.24 <0.8.0;\\n\\nimport \\\"../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || _isConstructor() || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n\\n /// @dev Returns true if and only if the function is running in the constructor\\n function _isConstructor() private view returns (bool) {\\n return !AddressUpgradeable.isContract(address(this));\\n }\\n}\\n\",\"keccak256\":\"0xd8e4eb08dcc1d1860fb347ba5ffd595242b9a1b66d49a47f2b4cb51c3f35017e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"./ERC20Upgradeable.sol\\\";\\nimport \\\"../../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\\n * tokens and those that they have an allowance for, in a way that can be\\n * recognized off-chain (via event analysis).\\n */\\nabstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable {\\n function __ERC20Burnable_init() internal initializer {\\n __Context_init_unchained();\\n __ERC20Burnable_init_unchained();\\n }\\n\\n function __ERC20Burnable_init_unchained() internal initializer {\\n }\\n using SafeMathUpgradeable for uint256;\\n\\n /**\\n * @dev Destroys `amount` tokens from the caller.\\n *\\n * See {ERC20-_burn}.\\n */\\n function burn(uint256 amount) public virtual {\\n _burn(_msgSender(), amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\\n * allowance.\\n *\\n * See {ERC20-_burn} and {ERC20-allowance}.\\n *\\n * Requirements:\\n *\\n * - the caller must have allowance for ``accounts``'s tokens of at least\\n * `amount`.\\n */\\n function burnFrom(address account, uint256 amount) public virtual {\\n uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, \\\"ERC20: burn amount exceeds allowance\\\");\\n\\n _approve(account, _msgSender(), decreasedAllowance);\\n _burn(account, amount);\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xd0359e87fe2618573f49a95e13d9dbc31521ad64526b135618abb2a2dc362fbe\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"./IERC20Upgradeable.sol\\\";\\nimport \\\"../../math/SafeMathUpgradeable.sol\\\";\\nimport \\\"../../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin guidelines: functions revert instead\\n * of returning `false` on failure. This behavior is nonetheless conventional\\n * and does not conflict with the expectations of ERC20 applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable {\\n using SafeMathUpgradeable for uint256;\\n\\n mapping (address => uint256) private _balances;\\n\\n mapping (address => mapping (address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n uint8 private _decimals;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\\n * a default value of 18.\\n *\\n * To select a different value for {decimals}, use {_setupDecimals}.\\n *\\n * All three of these values are immutable: they can only be set once during\\n * construction.\\n */\\n function __ERC20_init(string memory name_, string memory symbol_) internal initializer {\\n __Context_init_unchained();\\n __ERC20_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {\\n _name = name_;\\n _symbol = symbol_;\\n _decimals = 18;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\\n * called.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \\\"ERC20: transfer amount exceeds allowance\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \\\"ERC20: decreased allowance below zero\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Moves tokens `amount` from `sender` to `recipient`.\\n *\\n * This is internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n _balances[sender] = _balances[sender].sub(amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n _balances[recipient] = _balances[recipient].add(amount);\\n emit Transfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply = _totalSupply.add(amount);\\n _balances[account] = _balances[account].add(amount);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n _balances[account] = _balances[account].sub(amount, \\\"ERC20: burn amount exceeds balance\\\");\\n _totalSupply = _totalSupply.sub(amount);\\n emit Transfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Sets {decimals} to a value other than the default one of 18.\\n *\\n * WARNING: This function should only be called from the constructor. Most\\n * applications that interact with token contracts will not expect\\n * {decimals} to ever change, and may work incorrectly if it does.\\n */\\n function _setupDecimals(uint8 decimals_) internal virtual {\\n _decimals = decimals_;\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\\n uint256[44] private __gap;\\n}\\n\",\"keccak256\":\"0x506dd0718f9ace50588c13848167df5e04ae16abb56341afb10c31ff149bc79b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xa1931c47a617014f858580db625aa0dcf343796f39acd4b5b51effc092a1f0a9\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfc5ea91fa9ceb1961023b2a6c978b902888c52b90847ac7813fe3b79524165f6\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0xbbf8a21b9a66c48d45ff771b8563c6df19ba451d63dfb8380a865c1e1f29d1a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal initializer {\\n __Context_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal initializer {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n require(!paused(), \\\"Pausable: paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n require(paused(), \\\"Pausable: not paused\\\");\\n _;\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x73bef0a5dec3efde8183c4858d90f683ed2771656c4329647b4d5b0f89498fd5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\nimport \\\"../proxy/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x46034cd5cca740f636345c8f7aebae0f78adfd4b70e31e6f888cccbe1086586e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the substraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b <= a, \\\"SafeMath: subtraction overflow\\\");\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) return 0;\\n uint256 c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: division by zero\\\");\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n require(b > 0, \\\"SafeMath: modulo by zero\\\");\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryDiv}.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0xcc78a17dd88fa5a2edc60c8489e2f405c0913b377216a5b26b35656b2d0dab52\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Clones.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\\n * deploying minimal proxy contracts, also known as \\\"clones\\\".\\n *\\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\\n *\\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\\n * deterministic method.\\n *\\n * _Available since v3.4._\\n */\\nlibrary Clones {\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `master`.\\n *\\n * This function uses the create opcode, which should never revert.\\n */\\n function clone(address master) internal returns (address instance) {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, master))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\\n instance := create(0, ptr, 0x37)\\n }\\n require(instance != address(0), \\\"ERC1167: create failed\\\");\\n }\\n\\n /**\\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `master`.\\n *\\n * This function uses the create2 opcode and a `salt` to deterministically deploy\\n * the clone. Using the same `master` and `salt` multiple time will revert, since\\n * the clones cannot be deployed twice at the same address.\\n */\\n function cloneDeterministic(address master, bytes32 salt) internal returns (address instance) {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, master))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)\\n instance := create2(0, ptr, 0x37, salt)\\n }\\n require(instance != address(0), \\\"ERC1167: create2 failed\\\");\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(address master, bytes32 salt, address deployer) internal pure returns (address predicted) {\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)\\n mstore(add(ptr, 0x14), shl(0x60, master))\\n mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)\\n mstore(add(ptr, 0x38), shl(0x60, deployer))\\n mstore(add(ptr, 0x4c), salt)\\n mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))\\n predicted := keccak256(add(ptr, 0x37), 0x55)\\n }\\n }\\n\\n /**\\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\\n */\\n function predictDeterministicAddress(address master, bytes32 salt) internal view returns (address predicted) {\\n return predictDeterministicAddress(master, salt, address(this));\\n }\\n}\\n\",\"keccak256\":\"0x0d24348f536f928d8b42789737bf34762faee065667ab530ea20969a9d9920d1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"../../utils/Context.sol\\\";\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"../../math/SafeMath.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin guidelines: functions revert instead\\n * of returning `false` on failure. This behavior is nonetheless conventional\\n * and does not conflict with the expectations of ERC20 applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20 {\\n using SafeMath for uint256;\\n\\n mapping (address => uint256) private _balances;\\n\\n mapping (address => mapping (address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n uint8 private _decimals;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\\n * a default value of 18.\\n *\\n * To select a different value for {decimals}, use {_setupDecimals}.\\n *\\n * All three of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor (string memory name_, string memory symbol_) public {\\n _name = name_;\\n _symbol = symbol_;\\n _decimals = 18;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\\n * called.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual returns (uint8) {\\n return _decimals;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \\\"ERC20: transfer amount exceeds allowance\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \\\"ERC20: decreased allowance below zero\\\"));\\n return true;\\n }\\n\\n /**\\n * @dev Moves tokens `amount` from `sender` to `recipient`.\\n *\\n * This is internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n _balances[sender] = _balances[sender].sub(amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n _balances[recipient] = _balances[recipient].add(amount);\\n emit Transfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply = _totalSupply.add(amount);\\n _balances[account] = _balances[account].add(amount);\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n _balances[account] = _balances[account].sub(amount, \\\"ERC20: burn amount exceeds balance\\\");\\n _totalSupply = _totalSupply.sub(amount);\\n emit Transfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Sets {decimals} to a value other than the default one of 18.\\n *\\n * WARNING: This function should only be called from the constructor. Most\\n * applications that interact with token contracts will not expect\\n * {decimals} to ever change, and may work incorrectly if it does.\\n */\\n function _setupDecimals(uint8 decimals_) internal virtual {\\n _decimals = decimals_;\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\\n}\\n\",\"keccak256\":\"0xca0c2396dbeb3503b51abf4248ebf77a1461edad513c01529df51850a012bee3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x5f02220344881ce43204ae4a6281145a67bc52c2bb1290a791857df3d19d78f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"../../math/SafeMath.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using SafeMath for uint256;\\n using Address for address;\\n\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n // solhint-disable-next-line max-line-length\\n require((value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \\\"SafeERC20: decreased allowance below zero\\\");\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) { // Return data is optional\\n // solhint-disable-next-line max-line-length\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf12dfbe97e6276980b83d2830bb0eb75e0cf4f3e626c2471137f82158ae6a0fc\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.2 <0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x28911e614500ae7c607a432a709d35da25f3bc5ddc8bd12b278b66358070c0ea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0 <0.8.0;\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with GSN meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address payable) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes memory) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\"},\"contracts/AmplificationUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"./SwapUtils.sol\\\";\\n\\n/**\\n * @title AmplificationUtils library\\n * @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct.\\n * This library assumes the struct is fully validated.\\n */\\nlibrary AmplificationUtils {\\n using SafeMath for uint256;\\n\\n event RampA(\\n uint256 oldA,\\n uint256 newA,\\n uint256 initialTime,\\n uint256 futureTime\\n );\\n event StopRampA(uint256 currentA, uint256 time);\\n\\n // Constant values used in ramping A calculations\\n uint256 public constant A_PRECISION = 100;\\n uint256 public constant MAX_A = 10**6;\\n uint256 private constant MAX_A_CHANGE = 2;\\n uint256 private constant MIN_RAMP_TIME = 14 days;\\n\\n /**\\n * @notice Return A, the amplification coefficient * n * (n - 1)\\n * @dev See the StableSwap paper for details\\n * @param self Swap struct to read from\\n * @return A parameter\\n */\\n function getA(SwapUtils.Swap storage self) external view returns (uint256) {\\n return _getAPrecise(self).div(A_PRECISION);\\n }\\n\\n /**\\n * @notice Return A in its raw precision\\n * @dev See the StableSwap paper for details\\n * @param self Swap struct to read from\\n * @return A parameter in its raw precision form\\n */\\n function getAPrecise(SwapUtils.Swap storage self)\\n external\\n view\\n returns (uint256)\\n {\\n return _getAPrecise(self);\\n }\\n\\n /**\\n * @notice Return A in its raw precision\\n * @dev See the StableSwap paper for details\\n * @param self Swap struct to read from\\n * @return A parameter in its raw precision form\\n */\\n function _getAPrecise(SwapUtils.Swap storage self)\\n internal\\n view\\n returns (uint256)\\n {\\n uint256 t1 = self.futureATime; // time when ramp is finished\\n uint256 a1 = self.futureA; // final A value when ramp is finished\\n\\n if (block.timestamp < t1) {\\n uint256 t0 = self.initialATime; // time when ramp is started\\n uint256 a0 = self.initialA; // initial A value when ramp is started\\n if (a1 > a0) {\\n // a0 + (a1 - a0) * (block.timestamp - t0) / (t1 - t0)\\n return\\n a0.add(\\n a1.sub(a0).mul(block.timestamp.sub(t0)).div(t1.sub(t0))\\n );\\n } else {\\n // a0 - (a0 - a1) * (block.timestamp - t0) / (t1 - t0)\\n return\\n a0.sub(\\n a0.sub(a1).mul(block.timestamp.sub(t0)).div(t1.sub(t0))\\n );\\n }\\n } else {\\n return a1;\\n }\\n }\\n\\n /**\\n * @notice Start ramping up or down A parameter towards given futureA_ and futureTime_\\n * Checks if the change is too rapid, and commits the new A value only when it falls under\\n * the limit range.\\n * @param self Swap struct to update\\n * @param futureA_ the new A to ramp towards\\n * @param futureTime_ timestamp when the new A should be reached\\n */\\n function rampA(\\n SwapUtils.Swap storage self,\\n uint256 futureA_,\\n uint256 futureTime_\\n ) external {\\n require(\\n block.timestamp >= self.initialATime.add(1 days),\\n \\\"Wait 1 day before starting ramp\\\"\\n );\\n require(\\n futureTime_ >= block.timestamp.add(MIN_RAMP_TIME),\\n \\\"Insufficient ramp time\\\"\\n );\\n require(\\n futureA_ > 0 && futureA_ < MAX_A,\\n \\\"futureA_ must be > 0 and < MAX_A\\\"\\n );\\n\\n uint256 initialAPrecise = _getAPrecise(self);\\n uint256 futureAPrecise = futureA_.mul(A_PRECISION);\\n\\n if (futureAPrecise < initialAPrecise) {\\n require(\\n futureAPrecise.mul(MAX_A_CHANGE) >= initialAPrecise,\\n \\\"futureA_ is too small\\\"\\n );\\n } else {\\n require(\\n futureAPrecise <= initialAPrecise.mul(MAX_A_CHANGE),\\n \\\"futureA_ is too large\\\"\\n );\\n }\\n\\n self.initialA = initialAPrecise;\\n self.futureA = futureAPrecise;\\n self.initialATime = block.timestamp;\\n self.futureATime = futureTime_;\\n\\n emit RampA(\\n initialAPrecise,\\n futureAPrecise,\\n block.timestamp,\\n futureTime_\\n );\\n }\\n\\n /**\\n * @notice Stops ramping A immediately. Once this function is called, rampA()\\n * cannot be called for another 24 hours\\n * @param self Swap struct to update\\n */\\n function stopRampA(SwapUtils.Swap storage self) external {\\n require(self.futureATime > block.timestamp, \\\"Ramp is already stopped\\\");\\n\\n uint256 currentA = _getAPrecise(self);\\n self.initialA = currentA;\\n self.futureA = currentA;\\n self.initialATime = block.timestamp;\\n self.futureATime = block.timestamp;\\n\\n emit StopRampA(currentA, block.timestamp);\\n }\\n}\\n\",\"keccak256\":\"0x454f7c599a980fc449ff0f21dee10922262193134ea709f3be50c9d44a7d5385\",\"license\":\"MIT\"},\"contracts/LPToken.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"./interfaces/ISwap.sol\\\";\\n\\n/**\\n * @title Liquidity Provider Token\\n * @notice This token is an ERC20 detailed token with added capability to be minted by the owner.\\n * It is used to represent user's shares when providing liquidity to swap contracts.\\n * @dev Only Swap contracts should initialize and own LPToken contracts.\\n */\\ncontract LPToken is ERC20BurnableUpgradeable, OwnableUpgradeable {\\n using SafeMathUpgradeable for uint256;\\n\\n /**\\n * @notice Initializes this LPToken contract with the given name and symbol\\n * @dev The caller of this function will become the owner. A Swap contract should call this\\n * in its initializer function.\\n * @param name name of this token\\n * @param symbol symbol of this token\\n */\\n function initialize(string memory name, string memory symbol)\\n external\\n initializer\\n returns (bool)\\n {\\n __Context_init_unchained();\\n __ERC20_init_unchained(name, symbol);\\n __Ownable_init_unchained();\\n return true;\\n }\\n\\n /**\\n * @notice Mints the given amount of LPToken to the recipient.\\n * @dev only owner can call this mint function\\n * @param recipient address of account to receive the tokens\\n * @param amount amount of tokens to mint\\n */\\n function mint(address recipient, uint256 amount) external onlyOwner {\\n require(amount != 0, \\\"LPToken: cannot mint 0\\\");\\n _mint(recipient, amount);\\n }\\n\\n /**\\n * @dev Overrides ERC20._beforeTokenTransfer() which get called on every transfers including\\n * minting and burning. This ensures that Swap.updateUserWithdrawFees are called everytime.\\n * This assumes the owner is set to a Swap contract's address.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual override(ERC20Upgradeable) {\\n super._beforeTokenTransfer(from, to, amount);\\n require(to != address(this), \\\"LPToken: cannot send to itself\\\");\\n }\\n}\\n\",\"keccak256\":\"0x8b16a37e14fd2d387dac20bf1773522b7667402f27a4b301617b928d7b998ac5\",\"license\":\"MIT\"},\"contracts/MathUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\n\\n/**\\n * @title MathUtils library\\n * @notice A library to be used in conjunction with SafeMath. Contains functions for calculating\\n * differences between two uint256.\\n */\\nlibrary MathUtils {\\n /**\\n * @notice Compares a and b and returns true if the difference between a and b\\n * is less than 1 or equal to each other.\\n * @param a uint256 to compare with\\n * @param b uint256 to compare with\\n * @return True if the difference between a and b is less than 1 or equal,\\n * otherwise return false\\n */\\n function within1(uint256 a, uint256 b) internal pure returns (bool) {\\n return (difference(a, b) <= 1);\\n }\\n\\n /**\\n * @notice Calculates absolute difference between a and b\\n * @param a uint256 to compare with\\n * @param b uint256 to compare with\\n * @return Difference between a and b\\n */\\n function difference(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a > b) {\\n return a - b;\\n }\\n return b - a;\\n }\\n}\\n\",\"keccak256\":\"0x455c798b26b679dff11a4ad5d52f7fef85c42d403bd430da443948f65cf000a0\",\"license\":\"MIT\"},\"contracts/OwnerPausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\\\";\\n\\n/**\\n * @title OwnerPausable\\n * @notice An ownable contract allows the owner to pause and unpause the\\n * contract without a delay.\\n * @dev Only methods using the provided modifiers will be paused.\\n */\\nabstract contract OwnerPausableUpgradeable is\\n OwnableUpgradeable,\\n PausableUpgradeable\\n{\\n function __OwnerPausable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n __Pausable_init_unchained();\\n }\\n\\n /**\\n * @notice Pause the contract. Revert if already paused.\\n */\\n function pause() external onlyOwner {\\n PausableUpgradeable._pause();\\n }\\n\\n /**\\n * @notice Unpause the contract. Revert if already unpaused.\\n */\\n function unpause() external onlyOwner {\\n PausableUpgradeable._unpause();\\n }\\n}\\n\",\"keccak256\":\"0xe8d79072ff7e9ec0ade50d81be8681a9fedfabe7b3d3de116e83cb7f4e1446f6\",\"license\":\"MIT\"},\"contracts/Swap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/Clones.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol\\\";\\nimport \\\"./OwnerPausableUpgradeable.sol\\\";\\nimport \\\"./SwapUtils.sol\\\";\\nimport \\\"./AmplificationUtils.sol\\\";\\n\\n/**\\n * @title Swap - A StableSwap implementation in solidity.\\n * @notice This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)\\n * and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens\\n * in desired ratios for an exchange of the pool token that represents their share of the pool.\\n * Users can burn pool tokens and withdraw their share of token(s).\\n *\\n * Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets\\n * distributed to the LPs.\\n *\\n * In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which\\n * stops the ratio of the tokens in the pool from changing.\\n * Users can always withdraw their tokens via multi-asset withdraws.\\n *\\n * @dev Most of the logic is stored as a library `SwapUtils` for the sake of reducing contract's\\n * deployment size.\\n */\\ncontract Swap is OwnerPausableUpgradeable, ReentrancyGuardUpgradeable {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n using SwapUtils for SwapUtils.Swap;\\n using AmplificationUtils for SwapUtils.Swap;\\n\\n // Struct storing data responsible for automatic market maker functionalities. In order to\\n // access this data, this contract uses SwapUtils library. For more details, see SwapUtils.sol\\n SwapUtils.Swap public swapStorage;\\n\\n // Maps token address to an index in the pool. Used to prevent duplicate tokens in the pool.\\n // getTokenIndex function also relies on this mapping to retrieve token index.\\n mapping(address => uint8) private tokenIndexes;\\n\\n /*** EVENTS ***/\\n\\n // events replicated from SwapUtils to make the ABI easier for dumb\\n // clients\\n event TokenSwap(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n event AddLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidityOne(\\n address indexed provider,\\n uint256 lpTokenAmount,\\n uint256 lpTokenSupply,\\n uint256 boughtId,\\n uint256 tokensBought\\n );\\n event RemoveLiquidityImbalance(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event NewAdminFee(uint256 newAdminFee);\\n event NewSwapFee(uint256 newSwapFee);\\n event NewWithdrawFee(uint256 newWithdrawFee);\\n event RampA(\\n uint256 oldA,\\n uint256 newA,\\n uint256 initialTime,\\n uint256 futureTime\\n );\\n event StopRampA(uint256 currentA, uint256 time);\\n\\n /**\\n * @notice Initializes this Swap contract with the given parameters.\\n * This will also clone a LPToken contract that represents users'\\n * LP positions. The owner of LPToken will be this contract - which means\\n * only this contract is allowed to mint/burn tokens.\\n *\\n * @param _pooledTokens an array of ERC20s this pool will accept\\n * @param decimals the decimals to use for each pooled token,\\n * eg 8 for WBTC. Cannot be larger than POOL_PRECISION_DECIMALS\\n * @param lpTokenName the long-form name of the token to be deployed\\n * @param lpTokenSymbol the short symbol for the token to be deployed\\n * @param _a the amplification coefficient * n * (n - 1). See the\\n * StableSwap paper for details\\n * @param _fee default swap fee to be initialized with\\n * @param _adminFee default adminFee to be initialized with\\n * @param lpTokenTargetAddress the address of an existing LPToken contract to use as a target\\n */\\n function initialize(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress\\n ) public payable virtual initializer {\\n __OwnerPausable_init();\\n __ReentrancyGuard_init();\\n // Check _pooledTokens and precisions parameter\\n require(_pooledTokens.length > 1, \\\"_pooledTokens.length <= 1\\\");\\n require(_pooledTokens.length <= 32, \\\"_pooledTokens.length > 32\\\");\\n require(\\n _pooledTokens.length == decimals.length,\\n \\\"_pooledTokens decimals mismatch\\\"\\n );\\n\\n uint256[] memory precisionMultipliers = new uint256[](decimals.length);\\n\\n for (uint8 i = 0; i < _pooledTokens.length; i++) {\\n if (i > 0) {\\n // Check if index is already used. Check if 0th element is a duplicate.\\n require(\\n tokenIndexes[address(_pooledTokens[i])] == 0 &&\\n _pooledTokens[0] != _pooledTokens[i],\\n \\\"Duplicate tokens\\\"\\n );\\n }\\n require(\\n address(_pooledTokens[i]) != address(0),\\n \\\"The 0 address isn't an ERC-20\\\"\\n );\\n require(\\n decimals[i] <= SwapUtils.POOL_PRECISION_DECIMALS,\\n \\\"Token decimals exceeds max\\\"\\n );\\n precisionMultipliers[i] =\\n 10 **\\n uint256(SwapUtils.POOL_PRECISION_DECIMALS).sub(\\n uint256(decimals[i])\\n );\\n tokenIndexes[address(_pooledTokens[i])] = i;\\n }\\n\\n // Check _a, _fee, _adminFee, _withdrawFee parameters\\n require(_a < AmplificationUtils.MAX_A, \\\"_a exceeds maximum\\\");\\n require(_fee < SwapUtils.MAX_SWAP_FEE, \\\"_fee exceeds maximum\\\");\\n require(\\n _adminFee < SwapUtils.MAX_ADMIN_FEE,\\n \\\"_adminFee exceeds maximum\\\"\\n );\\n\\n // Clone and initialize a LPToken contract\\n LPToken lpToken = LPToken(Clones.clone(lpTokenTargetAddress));\\n require(\\n lpToken.initialize(lpTokenName, lpTokenSymbol),\\n \\\"could not init lpToken clone\\\"\\n );\\n\\n // Initialize swapStorage struct\\n swapStorage.lpToken = lpToken;\\n swapStorage.pooledTokens = _pooledTokens;\\n swapStorage.tokenPrecisionMultipliers = precisionMultipliers;\\n swapStorage.balances = new uint256[](_pooledTokens.length);\\n swapStorage.initialA = _a.mul(AmplificationUtils.A_PRECISION);\\n swapStorage.futureA = _a.mul(AmplificationUtils.A_PRECISION);\\n // swapStorage.initialATime = 0;\\n // swapStorage.futureATime = 0;\\n swapStorage.swapFee = _fee;\\n swapStorage.adminFee = _adminFee;\\n }\\n\\n /*** MODIFIERS ***/\\n\\n /**\\n * @notice Modifier to check deadline against current timestamp\\n * @param deadline latest timestamp to accept this transaction\\n */\\n modifier deadlineCheck(uint256 deadline) {\\n require(block.timestamp <= deadline, \\\"Deadline not met\\\");\\n _;\\n }\\n\\n /*** VIEW FUNCTIONS ***/\\n\\n /**\\n * @notice Return A, the amplification coefficient * n * (n - 1)\\n * @dev See the StableSwap paper for details\\n * @return A parameter\\n */\\n function getA() external view virtual returns (uint256) {\\n return swapStorage.getA();\\n }\\n\\n /**\\n * @notice Return A in its raw precision form\\n * @dev See the StableSwap paper for details\\n * @return A parameter in its raw precision form\\n */\\n function getAPrecise() external view virtual returns (uint256) {\\n return swapStorage.getAPrecise();\\n }\\n\\n /**\\n * @notice Return address of the pooled token at given index. Reverts if tokenIndex is out of range.\\n * @param index the index of the token\\n * @return address of the token at given index\\n */\\n function getToken(uint8 index) public view virtual returns (IERC20) {\\n require(index < swapStorage.pooledTokens.length, \\\"Out of range\\\");\\n return swapStorage.pooledTokens[index];\\n }\\n\\n /**\\n * @notice Return the index of the given token address. Reverts if no matching\\n * token is found.\\n * @param tokenAddress address of the token\\n * @return the index of the given token address\\n */\\n function getTokenIndex(address tokenAddress)\\n public\\n view\\n virtual\\n returns (uint8)\\n {\\n uint8 index = tokenIndexes[tokenAddress];\\n require(\\n address(getToken(index)) == tokenAddress,\\n \\\"Token does not exist\\\"\\n );\\n return index;\\n }\\n\\n /**\\n * @notice Return current balance of the pooled token at given index\\n * @param index the index of the token\\n * @return current balance of the pooled token at given index with token's native precision\\n */\\n function getTokenBalance(uint8 index)\\n external\\n view\\n virtual\\n returns (uint256)\\n {\\n require(index < swapStorage.pooledTokens.length, \\\"Index out of range\\\");\\n return swapStorage.balances[index];\\n }\\n\\n /**\\n * @notice Get the virtual price, to help calculate profit\\n * @return the virtual price, scaled to the POOL_PRECISION_DECIMALS\\n */\\n function getVirtualPrice() external view virtual returns (uint256) {\\n return swapStorage.getVirtualPrice();\\n }\\n\\n /**\\n * @notice Calculate amount of tokens you receive on swap\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell. If the token charges\\n * a fee on transfers, use the amount that gets transferred after the fee.\\n * @return amount of tokens the user will receive\\n */\\n function calculateSwap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view virtual returns (uint256) {\\n return swapStorage.calculateSwap(tokenIndexFrom, tokenIndexTo, dx);\\n }\\n\\n /**\\n * @notice A simple method to calculate prices from deposits or\\n * withdrawals, excluding fees but including slippage. This is\\n * helpful as an input into the various \\\"min\\\" parameters on calls\\n * to fight front-running\\n *\\n * @dev This shouldn't be used outside frontends for user estimates.\\n *\\n * @param amounts an array of token amounts to deposit or withdrawal,\\n * corresponding to pooledTokens. The amount should be in each\\n * pooled token's native precision. If a token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param deposit whether this is a deposit or a withdrawal\\n * @return token amount the user will receive\\n */\\n function calculateTokenAmount(uint256[] calldata amounts, bool deposit)\\n external\\n view\\n virtual\\n returns (uint256)\\n {\\n return swapStorage.calculateTokenAmount(amounts, deposit);\\n }\\n\\n /**\\n * @notice A simple method to calculate amount of each underlying\\n * tokens that is returned upon burning given amount of LP tokens\\n * @param amount the amount of LP tokens that would be burned on withdrawal\\n * @return array of token balances that the user will receive\\n */\\n function calculateRemoveLiquidity(uint256 amount)\\n external\\n view\\n virtual\\n returns (uint256[] memory)\\n {\\n return swapStorage.calculateRemoveLiquidity(amount);\\n }\\n\\n /**\\n * @notice Calculate the amount of underlying token available to withdraw\\n * when withdrawing via only single token\\n * @param tokenAmount the amount of LP token to burn\\n * @param tokenIndex index of which token will be withdrawn\\n * @return availableTokenAmount calculated amount of underlying token\\n * available to withdraw\\n */\\n function calculateRemoveLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view virtual returns (uint256 availableTokenAmount) {\\n return swapStorage.calculateWithdrawOneToken(tokenAmount, tokenIndex);\\n }\\n\\n /**\\n * @notice This function reads the accumulated amount of admin fees of the token with given index\\n * @param index Index of the pooled token\\n * @return admin's token balance in the token's precision\\n */\\n function getAdminBalance(uint256 index)\\n external\\n view\\n virtual\\n returns (uint256)\\n {\\n return swapStorage.getAdminBalance(index);\\n }\\n\\n /*** STATE MODIFYING FUNCTIONS ***/\\n\\n /**\\n * @notice Swap two tokens using this pool\\n * @param tokenIndexFrom the token the user wants to swap from\\n * @param tokenIndexTo the token the user wants to swap to\\n * @param dx the amount of tokens the user wants to swap from\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @param deadline latest timestamp to accept this transaction\\n */\\n function swap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return swapStorage.swap(tokenIndexFrom, tokenIndexTo, dx, minDy);\\n }\\n\\n /**\\n * @notice Add liquidity to the pool with the given amounts of tokens\\n * @param amounts the amounts of each token to add, in their native precision\\n * @param minToMint the minimum LP tokens adding this amount of liquidity\\n * should mint, otherwise revert. Handy for front-running mitigation\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of LP token user minted and received\\n */\\n function addLiquidity(\\n uint256[] calldata amounts,\\n uint256 minToMint,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return swapStorage.addLiquidity(amounts, minToMint);\\n }\\n\\n /**\\n * @notice Burn LP tokens to remove liquidity from the pool. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @dev Liquidity can always be removed, even when the pool is paused.\\n * @param amount the amount of LP tokens to burn\\n * @param minAmounts the minimum amounts of each token in the pool\\n * acceptable for this burn. Useful as a front-running mitigation\\n * @param deadline latest timestamp to accept this transaction\\n * @return amounts of tokens user received\\n */\\n function removeLiquidity(\\n uint256 amount,\\n uint256[] calldata minAmounts,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n deadlineCheck(deadline)\\n returns (uint256[] memory)\\n {\\n return swapStorage.removeLiquidity(amount, minAmounts);\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool all in one token. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @param tokenAmount the amount of the token you want to receive\\n * @param tokenIndex the index of the token you want to receive\\n * @param minAmount the minimum amount to withdraw, otherwise revert\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of chosen token user received\\n */\\n function removeLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return\\n swapStorage.removeLiquidityOneToken(\\n tokenAmount,\\n tokenIndex,\\n minAmount\\n );\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool, weighted differently than the\\n * pool's current balances. Withdraw fee that decays linearly\\n * over period of 4 weeks since last deposit will apply.\\n * @param amounts how much of each token to withdraw\\n * @param maxBurnAmount the max LP token provider is willing to pay to\\n * remove liquidity. Useful as a front-running mitigation.\\n * @param deadline latest timestamp to accept this transaction\\n * @return amount of LP tokens burned\\n */\\n function removeLiquidityImbalance(\\n uint256[] calldata amounts,\\n uint256 maxBurnAmount,\\n uint256 deadline\\n )\\n external\\n payable\\n virtual\\n nonReentrant\\n whenNotPaused\\n deadlineCheck(deadline)\\n returns (uint256)\\n {\\n return swapStorage.removeLiquidityImbalance(amounts, maxBurnAmount);\\n }\\n\\n /*** ADMIN FUNCTIONS ***/\\n\\n /**\\n * @notice Withdraw all admin fees to the contract owner\\n */\\n function withdrawAdminFees() external payable virtual onlyOwner {\\n swapStorage.withdrawAdminFees(owner());\\n }\\n\\n /**\\n * @notice Update the admin fee. Admin fee takes portion of the swap fee.\\n * @param newAdminFee new admin fee to be applied on future transactions\\n */\\n function setAdminFee(uint256 newAdminFee) external payable onlyOwner {\\n swapStorage.setAdminFee(newAdminFee);\\n }\\n\\n /**\\n * @notice Update the swap fee to be applied on swaps\\n * @param newSwapFee new swap fee to be applied on future transactions\\n */\\n function setSwapFee(uint256 newSwapFee) external payable onlyOwner {\\n swapStorage.setSwapFee(newSwapFee);\\n }\\n\\n /**\\n * @notice Start ramping up or down A parameter towards given futureA and futureTime\\n * Checks if the change is too rapid, and commits the new A value only when it falls under\\n * the limit range.\\n * @param futureA the new A to ramp towards\\n * @param futureTime timestamp when the new A should be reached\\n */\\n function rampA(uint256 futureA, uint256 futureTime)\\n external\\n payable\\n onlyOwner\\n {\\n swapStorage.rampA(futureA, futureTime);\\n }\\n\\n /**\\n * @notice Stop ramping A immediately. Reverts if ramp A is already stopped.\\n */\\n function stopRampA() external payable onlyOwner {\\n swapStorage.stopRampA();\\n }\\n}\\n\",\"keccak256\":\"0x85aed3b11967ea0195717a6777a5e58ee9cc96f94e6992af002720f2b626840b\",\"license\":\"MIT\"},\"contracts/SwapUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"./AmplificationUtils.sol\\\";\\nimport \\\"./LPToken.sol\\\";\\nimport \\\"./MathUtils.sol\\\";\\n\\n/**\\n * @title SwapUtils library\\n * @notice A library to be used within Swap.sol. Contains functions responsible for custody and AMM functionalities.\\n * @dev Contracts relying on this library must initialize SwapUtils.Swap struct then use this library\\n * for SwapUtils.Swap struct. Note that this library contains both functions called by users and admins.\\n * Admin functions should be protected within contracts using this library.\\n */\\nlibrary SwapUtils {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n using MathUtils for uint256;\\n\\n /*** EVENTS ***/\\n\\n event TokenSwap(\\n address indexed buyer,\\n uint256 tokensSold,\\n uint256 tokensBought,\\n uint128 soldId,\\n uint128 boughtId\\n );\\n event AddLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidity(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256 lpTokenSupply\\n );\\n event RemoveLiquidityOne(\\n address indexed provider,\\n uint256 lpTokenAmount,\\n uint256 lpTokenSupply,\\n uint256 boughtId,\\n uint256 tokensBought\\n );\\n event RemoveLiquidityImbalance(\\n address indexed provider,\\n uint256[] tokenAmounts,\\n uint256[] fees,\\n uint256 invariant,\\n uint256 lpTokenSupply\\n );\\n event NewAdminFee(uint256 newAdminFee);\\n event NewSwapFee(uint256 newSwapFee);\\n\\n struct Swap {\\n // variables around the ramp management of A,\\n // the amplification coefficient * n * (n - 1)\\n // see https://www.curve.fi/stableswap-paper.pdf for details\\n uint256 initialA;\\n uint256 futureA;\\n uint256 initialATime;\\n uint256 futureATime;\\n // fee calculation\\n uint256 swapFee;\\n uint256 adminFee;\\n LPToken lpToken;\\n // contract references for all tokens being pooled\\n IERC20[] pooledTokens;\\n // multipliers for each pooled token's precision to get to POOL_PRECISION_DECIMALS\\n // for example, TBTC has 18 decimals, so the multiplier should be 1. WBTC\\n // has 8, so the multiplier should be 10 ** 18 / 10 ** 8 => 10 ** 10\\n uint256[] tokenPrecisionMultipliers;\\n // the pool balance of each token, in the token's precision\\n // the contract's actual token balance might differ\\n uint256[] balances;\\n }\\n\\n // Struct storing variables used in calculations in the\\n // calculateWithdrawOneTokenDY function to avoid stack too deep errors\\n struct CalculateWithdrawOneTokenDYInfo {\\n uint256 d0;\\n uint256 d1;\\n uint256 newY;\\n uint256 feePerToken;\\n uint256 preciseA;\\n }\\n\\n // Struct storing variables used in calculations in the\\n // {add,remove}Liquidity functions to avoid stack too deep errors\\n struct ManageLiquidityInfo {\\n uint256 d0;\\n uint256 d1;\\n uint256 d2;\\n uint256 preciseA;\\n LPToken lpToken;\\n uint256 totalSupply;\\n uint256[] balances;\\n uint256[] multipliers;\\n }\\n\\n // the precision all pools tokens will be converted to\\n uint8 public constant POOL_PRECISION_DECIMALS = 18;\\n\\n // the denominator used to calculate admin and LP fees. For example, an\\n // LP fee might be something like tradeAmount.mul(fee).div(FEE_DENOMINATOR)\\n uint256 private constant FEE_DENOMINATOR = 10**10;\\n\\n // Max swap fee is 1% or 100bps of each swap\\n uint256 public constant MAX_SWAP_FEE = 10**8;\\n\\n // Max adminFee is 100% of the swapFee\\n // adminFee does not add additional fee on top of swapFee\\n // Instead it takes a certain % of the swapFee. Therefore it has no impact on the\\n // users but only on the earnings of LPs\\n uint256 public constant MAX_ADMIN_FEE = 10**10;\\n\\n // Constant value used as max loop limit\\n uint256 private constant MAX_LOOP_LIMIT = 256;\\n\\n /*** VIEW & PURE FUNCTIONS ***/\\n\\n function _getAPrecise(Swap storage self) internal view returns (uint256) {\\n return AmplificationUtils._getAPrecise(self);\\n }\\n\\n /**\\n * @notice Calculate the dy, the amount of selected token that user receives and\\n * the fee of withdrawing in one token\\n * @param tokenAmount the amount to withdraw in the pool's precision\\n * @param tokenIndex which token will be withdrawn\\n * @param self Swap struct to read from\\n * @return the amount of token user will receive\\n */\\n function calculateWithdrawOneToken(\\n Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view returns (uint256) {\\n (uint256 availableTokenAmount, ) = _calculateWithdrawOneToken(\\n self,\\n tokenAmount,\\n tokenIndex,\\n self.lpToken.totalSupply()\\n );\\n return availableTokenAmount;\\n }\\n\\n function _calculateWithdrawOneToken(\\n Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 totalSupply\\n ) internal view returns (uint256, uint256) {\\n uint256 dy;\\n uint256 newY;\\n uint256 currentY;\\n\\n (dy, newY, currentY) = calculateWithdrawOneTokenDY(\\n self,\\n tokenIndex,\\n tokenAmount,\\n totalSupply\\n );\\n\\n // dy_0 (without fees)\\n // dy, dy_0 - dy\\n\\n uint256 dySwapFee = currentY\\n .sub(newY)\\n .div(self.tokenPrecisionMultipliers[tokenIndex])\\n .sub(dy);\\n\\n return (dy, dySwapFee);\\n }\\n\\n /**\\n * @notice Calculate the dy of withdrawing in one token\\n * @param self Swap struct to read from\\n * @param tokenIndex which token will be withdrawn\\n * @param tokenAmount the amount to withdraw in the pools precision\\n * @return the d and the new y after withdrawing one token\\n */\\n function calculateWithdrawOneTokenDY(\\n Swap storage self,\\n uint8 tokenIndex,\\n uint256 tokenAmount,\\n uint256 totalSupply\\n )\\n internal\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256\\n )\\n {\\n // Get the current D, then solve the stableswap invariant\\n // y_i for D - tokenAmount\\n uint256[] memory xp = _xp(self);\\n\\n require(tokenIndex < xp.length, \\\"Token index out of range\\\");\\n\\n CalculateWithdrawOneTokenDYInfo\\n memory v = CalculateWithdrawOneTokenDYInfo(0, 0, 0, 0, 0);\\n v.preciseA = _getAPrecise(self);\\n v.d0 = getD(xp, v.preciseA);\\n v.d1 = v.d0.sub(tokenAmount.mul(v.d0).div(totalSupply));\\n\\n require(tokenAmount <= xp[tokenIndex], \\\"Withdraw exceeds available\\\");\\n\\n v.newY = getYD(v.preciseA, tokenIndex, xp, v.d1);\\n\\n uint256[] memory xpReduced = new uint256[](xp.length);\\n\\n v.feePerToken = _feePerToken(self.swapFee, xp.length);\\n for (uint256 i = 0; i < xp.length; i++) {\\n uint256 xpi = xp[i];\\n // if i == tokenIndex, dxExpected = xp[i] * d1 / d0 - newY\\n // else dxExpected = xp[i] - (xp[i] * d1 / d0)\\n // xpReduced[i] -= dxExpected * fee / FEE_DENOMINATOR\\n xpReduced[i] = xpi.sub(\\n (\\n (i == tokenIndex)\\n ? xpi.mul(v.d1).div(v.d0).sub(v.newY)\\n : xpi.sub(xpi.mul(v.d1).div(v.d0))\\n ).mul(v.feePerToken).div(FEE_DENOMINATOR)\\n );\\n }\\n\\n uint256 dy = xpReduced[tokenIndex].sub(\\n getYD(v.preciseA, tokenIndex, xpReduced, v.d1)\\n );\\n dy = dy.sub(1).div(self.tokenPrecisionMultipliers[tokenIndex]);\\n\\n return (dy, v.newY, xp[tokenIndex]);\\n }\\n\\n /**\\n * @notice Calculate the price of a token in the pool with given\\n * precision-adjusted balances and a particular D.\\n *\\n * @dev This is accomplished via solving the invariant iteratively.\\n * See the StableSwap paper and Curve.fi implementation for further details.\\n *\\n * x_1**2 + x1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)\\n * x_1**2 + b*x_1 = c\\n * x_1 = (x_1**2 + c) / (2*x_1 + b)\\n *\\n * @param a the amplification coefficient * n * (n - 1). See the StableSwap paper for details.\\n * @param tokenIndex Index of token we are calculating for.\\n * @param xp a precision-adjusted set of pool balances. Array should be\\n * the same cardinality as the pool.\\n * @param d the stableswap invariant\\n * @return the price of the token, in the same precision as in xp\\n */\\n function getYD(\\n uint256 a,\\n uint8 tokenIndex,\\n uint256[] memory xp,\\n uint256 d\\n ) internal pure returns (uint256) {\\n uint256 numTokens = xp.length;\\n require(tokenIndex < numTokens, \\\"Token not found\\\");\\n\\n uint256 c = d;\\n uint256 s;\\n uint256 nA = a.mul(numTokens);\\n\\n for (uint256 i = 0; i < numTokens; i++) {\\n if (i != tokenIndex) {\\n s = s.add(xp[i]);\\n c = c.mul(d).div(xp[i].mul(numTokens));\\n // If we were to protect the division loss we would have to keep the denominator separate\\n // and divide at the end. However this leads to overflow with large numTokens or/and D.\\n // c = c * D * D * D * ... overflow!\\n }\\n }\\n c = c.mul(d).mul(AmplificationUtils.A_PRECISION).div(nA.mul(numTokens));\\n\\n uint256 b = s.add(d.mul(AmplificationUtils.A_PRECISION).div(nA));\\n uint256 yPrev;\\n uint256 y = d;\\n for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {\\n yPrev = y;\\n y = y.mul(y).add(c).div(y.mul(2).add(b).sub(d));\\n if (y.within1(yPrev)) {\\n return y;\\n }\\n }\\n revert(\\\"Approximation did not converge\\\");\\n }\\n\\n /**\\n * @notice Get D, the StableSwap invariant, based on a set of balances and a particular A.\\n * @param xp a precision-adjusted set of pool balances. Array should be the same cardinality\\n * as the pool.\\n * @param a the amplification coefficient * n * (n - 1) in A_PRECISION.\\n * See the StableSwap paper for details\\n * @return the invariant, at the precision of the pool\\n */\\n function getD(uint256[] memory xp, uint256 a)\\n internal\\n pure\\n returns (uint256)\\n {\\n uint256 numTokens = xp.length;\\n uint256 s;\\n for (uint256 i = 0; i < numTokens; i++) {\\n s = s.add(xp[i]);\\n }\\n if (s == 0) {\\n return 0;\\n }\\n\\n uint256 prevD;\\n uint256 d = s;\\n uint256 nA = a.mul(numTokens);\\n\\n for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {\\n uint256 dP = d;\\n for (uint256 j = 0; j < numTokens; j++) {\\n dP = dP.mul(d).div(xp[j].mul(numTokens));\\n // If we were to protect the division loss we would have to keep the denominator separate\\n // and divide at the end. However this leads to overflow with large numTokens or/and D.\\n // dP = dP * D * D * D * ... overflow!\\n }\\n prevD = d;\\n d = nA\\n .mul(s)\\n .div(AmplificationUtils.A_PRECISION)\\n .add(dP.mul(numTokens))\\n .mul(d)\\n .div(\\n nA\\n .sub(AmplificationUtils.A_PRECISION)\\n .mul(d)\\n .div(AmplificationUtils.A_PRECISION)\\n .add(numTokens.add(1).mul(dP))\\n );\\n if (d.within1(prevD)) {\\n return d;\\n }\\n }\\n\\n // Convergence should occur in 4 loops or less. If this is reached, there may be something wrong\\n // with the pool. If this were to occur repeatedly, LPs should withdraw via `removeLiquidity()`\\n // function which does not rely on D.\\n revert(\\\"D does not converge\\\");\\n }\\n\\n /**\\n * @notice Given a set of balances and precision multipliers, return the\\n * precision-adjusted balances.\\n *\\n * @param balances an array of token balances, in their native precisions.\\n * These should generally correspond with pooled tokens.\\n *\\n * @param precisionMultipliers an array of multipliers, corresponding to\\n * the amounts in the balances array. When multiplied together they\\n * should yield amounts at the pool's precision.\\n *\\n * @return an array of amounts \\\"scaled\\\" to the pool's precision\\n */\\n function _xp(\\n uint256[] memory balances,\\n uint256[] memory precisionMultipliers\\n ) internal pure returns (uint256[] memory) {\\n uint256 numTokens = balances.length;\\n require(\\n numTokens == precisionMultipliers.length,\\n \\\"Balances must match multipliers\\\"\\n );\\n uint256[] memory xp = new uint256[](numTokens);\\n for (uint256 i = 0; i < numTokens; i++) {\\n xp[i] = balances[i].mul(precisionMultipliers[i]);\\n }\\n return xp;\\n }\\n\\n /**\\n * @notice Return the precision-adjusted balances of all tokens in the pool\\n * @param self Swap struct to read from\\n * @return the pool balances \\\"scaled\\\" to the pool's precision, allowing\\n * them to be more easily compared.\\n */\\n function _xp(Swap storage self) internal view returns (uint256[] memory) {\\n return _xp(self.balances, self.tokenPrecisionMultipliers);\\n }\\n\\n /**\\n * @notice Get the virtual price, to help calculate profit\\n * @param self Swap struct to read from\\n * @return the virtual price, scaled to precision of POOL_PRECISION_DECIMALS\\n */\\n function getVirtualPrice(Swap storage self)\\n external\\n view\\n returns (uint256)\\n {\\n uint256 d = getD(_xp(self), _getAPrecise(self));\\n LPToken lpToken = self.lpToken;\\n uint256 supply = lpToken.totalSupply();\\n if (supply > 0) {\\n return d.mul(10**uint256(POOL_PRECISION_DECIMALS)).div(supply);\\n }\\n return 0;\\n }\\n\\n /**\\n * @notice Calculate the new balances of the tokens given the indexes of the token\\n * that is swapped from (FROM) and the token that is swapped to (TO).\\n * This function is used as a helper function to calculate how much TO token\\n * the user should receive on swap.\\n *\\n * @param preciseA precise form of amplification coefficient\\n * @param tokenIndexFrom index of FROM token\\n * @param tokenIndexTo index of TO token\\n * @param x the new total amount of FROM token\\n * @param xp balances of the tokens in the pool\\n * @return the amount of TO token that should remain in the pool\\n */\\n function getY(\\n uint256 preciseA,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 x,\\n uint256[] memory xp\\n ) internal pure returns (uint256) {\\n uint256 numTokens = xp.length;\\n require(\\n tokenIndexFrom != tokenIndexTo,\\n \\\"Can't compare token to itself\\\"\\n );\\n require(\\n tokenIndexFrom < numTokens && tokenIndexTo < numTokens,\\n \\\"Tokens must be in pool\\\"\\n );\\n\\n uint256 d = getD(xp, preciseA);\\n uint256 c = d;\\n uint256 s;\\n uint256 nA = numTokens.mul(preciseA);\\n\\n uint256 _x;\\n for (uint256 i = 0; i < numTokens; i++) {\\n if (i == tokenIndexFrom) {\\n _x = x;\\n } else if (i != tokenIndexTo) {\\n _x = xp[i];\\n } else {\\n continue;\\n }\\n s = s.add(_x);\\n c = c.mul(d).div(_x.mul(numTokens));\\n // If we were to protect the division loss we would have to keep the denominator separate\\n // and divide at the end. However this leads to overflow with large numTokens or/and D.\\n // c = c * D * D * D * ... overflow!\\n }\\n c = c.mul(d).mul(AmplificationUtils.A_PRECISION).div(nA.mul(numTokens));\\n uint256 b = s.add(d.mul(AmplificationUtils.A_PRECISION).div(nA));\\n uint256 yPrev;\\n uint256 y = d;\\n\\n // iterative approximation\\n for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {\\n yPrev = y;\\n y = y.mul(y).add(c).div(y.mul(2).add(b).sub(d));\\n if (y.within1(yPrev)) {\\n return y;\\n }\\n }\\n revert(\\\"Approximation did not converge\\\");\\n }\\n\\n /**\\n * @notice Externally calculates a swap between two tokens.\\n * @param self Swap struct to read from\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @return dy the number of tokens the user will get\\n */\\n function calculateSwap(\\n Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view returns (uint256 dy) {\\n (dy, ) = _calculateSwap(\\n self,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n self.balances\\n );\\n }\\n\\n /**\\n * @notice Internally calculates a swap between two tokens.\\n *\\n * @dev The caller is expected to transfer the actual amounts (dx and dy)\\n * using the token contracts.\\n *\\n * @param self Swap struct to read from\\n * @param tokenIndexFrom the token to sell\\n * @param tokenIndexTo the token to buy\\n * @param dx the number of tokens to sell. If the token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @return dy the number of tokens the user will get\\n * @return dyFee the associated fee\\n */\\n function _calculateSwap(\\n Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256[] memory balances\\n ) internal view returns (uint256 dy, uint256 dyFee) {\\n uint256[] memory multipliers = self.tokenPrecisionMultipliers;\\n uint256[] memory xp = _xp(balances, multipliers);\\n require(\\n tokenIndexFrom < xp.length && tokenIndexTo < xp.length,\\n \\\"Token index out of range\\\"\\n );\\n uint256 x = dx.mul(multipliers[tokenIndexFrom]).add(xp[tokenIndexFrom]);\\n uint256 y = getY(\\n _getAPrecise(self),\\n tokenIndexFrom,\\n tokenIndexTo,\\n x,\\n xp\\n );\\n dy = xp[tokenIndexTo].sub(y).sub(1);\\n dyFee = dy.mul(self.swapFee).div(FEE_DENOMINATOR);\\n dy = dy.sub(dyFee).div(multipliers[tokenIndexTo]);\\n }\\n\\n /**\\n * @notice A simple method to calculate amount of each underlying\\n * tokens that is returned upon burning given amount of\\n * LP tokens\\n *\\n * @param amount the amount of LP tokens that would to be burned on\\n * withdrawal\\n * @return array of amounts of tokens user will receive\\n */\\n function calculateRemoveLiquidity(Swap storage self, uint256 amount)\\n external\\n view\\n returns (uint256[] memory)\\n {\\n return\\n _calculateRemoveLiquidity(\\n self.balances,\\n amount,\\n self.lpToken.totalSupply()\\n );\\n }\\n\\n function _calculateRemoveLiquidity(\\n uint256[] memory balances,\\n uint256 amount,\\n uint256 totalSupply\\n ) internal pure returns (uint256[] memory) {\\n require(amount <= totalSupply, \\\"Cannot exceed total supply\\\");\\n\\n uint256[] memory amounts = new uint256[](balances.length);\\n\\n for (uint256 i = 0; i < balances.length; i++) {\\n amounts[i] = balances[i].mul(amount).div(totalSupply);\\n }\\n return amounts;\\n }\\n\\n /**\\n * @notice A simple method to calculate prices from deposits or\\n * withdrawals, excluding fees but including slippage. This is\\n * helpful as an input into the various \\\"min\\\" parameters on calls\\n * to fight front-running\\n *\\n * @dev This shouldn't be used outside frontends for user estimates.\\n *\\n * @param self Swap struct to read from\\n * @param amounts an array of token amounts to deposit or withdrawal,\\n * corresponding to pooledTokens. The amount should be in each\\n * pooled token's native precision. If a token charges a fee on transfers,\\n * use the amount that gets transferred after the fee.\\n * @param deposit whether this is a deposit or a withdrawal\\n * @return if deposit was true, total amount of lp token that will be minted and if\\n * deposit was false, total amount of lp token that will be burned\\n */\\n function calculateTokenAmount(\\n Swap storage self,\\n uint256[] calldata amounts,\\n bool deposit\\n ) external view returns (uint256) {\\n uint256 a = _getAPrecise(self);\\n uint256[] memory balances = self.balances;\\n uint256[] memory multipliers = self.tokenPrecisionMultipliers;\\n\\n uint256 d0 = getD(_xp(balances, multipliers), a);\\n for (uint256 i = 0; i < balances.length; i++) {\\n if (deposit) {\\n balances[i] = balances[i].add(amounts[i]);\\n } else {\\n balances[i] = balances[i].sub(\\n amounts[i],\\n \\\"Cannot withdraw more than available\\\"\\n );\\n }\\n }\\n uint256 d1 = getD(_xp(balances, multipliers), a);\\n uint256 totalSupply = self.lpToken.totalSupply();\\n\\n if (deposit) {\\n return d1.sub(d0).mul(totalSupply).div(d0);\\n } else {\\n return d0.sub(d1).mul(totalSupply).div(d0);\\n }\\n }\\n\\n /**\\n * @notice return accumulated amount of admin fees of the token with given index\\n * @param self Swap struct to read from\\n * @param index Index of the pooled token\\n * @return admin balance in the token's precision\\n */\\n function getAdminBalance(Swap storage self, uint256 index)\\n external\\n view\\n returns (uint256)\\n {\\n require(index < self.pooledTokens.length, \\\"Token index out of range\\\");\\n return\\n self.pooledTokens[index].balanceOf(address(this)).sub(\\n self.balances[index]\\n );\\n }\\n\\n /**\\n * @notice internal helper function to calculate fee per token multiplier used in\\n * swap fee calculations\\n * @param swapFee swap fee for the tokens\\n * @param numTokens number of tokens pooled\\n */\\n function _feePerToken(uint256 swapFee, uint256 numTokens)\\n internal\\n pure\\n returns (uint256)\\n {\\n return swapFee.mul(numTokens).div(numTokens.sub(1).mul(4));\\n }\\n\\n /*** STATE MODIFYING FUNCTIONS ***/\\n\\n /**\\n * @notice swap two tokens in the pool\\n * @param self Swap struct to read from and write to\\n * @param tokenIndexFrom the token the user wants to sell\\n * @param tokenIndexTo the token the user wants to buy\\n * @param dx the amount of tokens the user wants to sell\\n * @param minDy the min amount the user would like to receive, or revert.\\n * @return amount of token user received on swap\\n */\\n function swap(\\n Swap storage self,\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy\\n ) external returns (uint256) {\\n {\\n IERC20 tokenFrom = self.pooledTokens[tokenIndexFrom];\\n require(\\n dx <= tokenFrom.balanceOf(msg.sender),\\n \\\"Cannot swap more than you own\\\"\\n );\\n // Transfer tokens first to see if a fee was charged on transfer\\n uint256 beforeBalance = tokenFrom.balanceOf(address(this));\\n tokenFrom.safeTransferFrom(msg.sender, address(this), dx);\\n\\n // Use the actual transferred amount for AMM math\\n dx = tokenFrom.balanceOf(address(this)).sub(beforeBalance);\\n }\\n\\n uint256 dy;\\n uint256 dyFee;\\n uint256[] memory balances = self.balances;\\n (dy, dyFee) = _calculateSwap(\\n self,\\n tokenIndexFrom,\\n tokenIndexTo,\\n dx,\\n balances\\n );\\n require(dy >= minDy, \\\"Swap didn't result in min tokens\\\");\\n\\n uint256 dyAdminFee = dyFee.mul(self.adminFee).div(FEE_DENOMINATOR).div(\\n self.tokenPrecisionMultipliers[tokenIndexTo]\\n );\\n\\n self.balances[tokenIndexFrom] = balances[tokenIndexFrom].add(dx);\\n self.balances[tokenIndexTo] = balances[tokenIndexTo].sub(dy).sub(\\n dyAdminFee\\n );\\n\\n self.pooledTokens[tokenIndexTo].safeTransfer(msg.sender, dy);\\n\\n emit TokenSwap(msg.sender, dx, dy, tokenIndexFrom, tokenIndexTo);\\n\\n return dy;\\n }\\n\\n /**\\n * @notice Add liquidity to the pool\\n * @param self Swap struct to read from and write to\\n * @param amounts the amounts of each token to add, in their native precision\\n * @param minToMint the minimum LP tokens adding this amount of liquidity\\n * should mint, otherwise revert. Handy for front-running mitigation\\n * allowed addresses. If the pool is not in the guarded launch phase, this parameter will be ignored.\\n * @return amount of LP token user received\\n */\\n function addLiquidity(\\n Swap storage self,\\n uint256[] memory amounts,\\n uint256 minToMint\\n ) external returns (uint256) {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n require(\\n amounts.length == pooledTokens.length,\\n \\\"Amounts must match pooled tokens\\\"\\n );\\n\\n // current state\\n ManageLiquidityInfo memory v = ManageLiquidityInfo(\\n 0,\\n 0,\\n 0,\\n _getAPrecise(self),\\n self.lpToken,\\n 0,\\n self.balances,\\n self.tokenPrecisionMultipliers\\n );\\n v.totalSupply = v.lpToken.totalSupply();\\n\\n if (v.totalSupply != 0) {\\n v.d0 = getD(_xp(v.balances, v.multipliers), v.preciseA);\\n }\\n\\n uint256[] memory newBalances = new uint256[](pooledTokens.length);\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n require(\\n v.totalSupply != 0 || amounts[i] > 0,\\n \\\"Must supply all tokens in pool\\\"\\n );\\n\\n // Transfer tokens first to see if a fee was charged on transfer\\n if (amounts[i] != 0) {\\n uint256 beforeBalance = pooledTokens[i].balanceOf(\\n address(this)\\n );\\n pooledTokens[i].safeTransferFrom(\\n msg.sender,\\n address(this),\\n amounts[i]\\n );\\n\\n // Update the amounts[] with actual transfer amount\\n amounts[i] = pooledTokens[i].balanceOf(address(this)).sub(\\n beforeBalance\\n );\\n }\\n\\n newBalances[i] = v.balances[i].add(amounts[i]);\\n }\\n\\n // invariant after change\\n v.d1 = getD(_xp(newBalances, v.multipliers), v.preciseA);\\n require(v.d1 > v.d0, \\\"D should increase\\\");\\n\\n // updated to reflect fees and calculate the user's LP tokens\\n v.d2 = v.d1;\\n uint256[] memory fees = new uint256[](pooledTokens.length);\\n\\n if (v.totalSupply != 0) {\\n uint256 feePerToken = _feePerToken(\\n self.swapFee,\\n pooledTokens.length\\n );\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n uint256 idealBalance = v.d1.mul(v.balances[i]).div(v.d0);\\n fees[i] = feePerToken\\n .mul(idealBalance.difference(newBalances[i]))\\n .div(FEE_DENOMINATOR);\\n self.balances[i] = newBalances[i].sub(\\n fees[i].mul(self.adminFee).div(FEE_DENOMINATOR)\\n );\\n newBalances[i] = newBalances[i].sub(fees[i]);\\n }\\n v.d2 = getD(_xp(newBalances, v.multipliers), v.preciseA);\\n } else {\\n // the initial depositor doesn't pay fees\\n self.balances = newBalances;\\n }\\n\\n uint256 toMint;\\n if (v.totalSupply == 0) {\\n toMint = v.d1;\\n } else {\\n toMint = v.d2.sub(v.d0).mul(v.totalSupply).div(v.d0);\\n }\\n\\n require(toMint >= minToMint, \\\"Couldn't mint min requested\\\");\\n\\n // mint the user's LP tokens\\n v.lpToken.mint(msg.sender, toMint);\\n\\n emit AddLiquidity(\\n msg.sender,\\n amounts,\\n fees,\\n v.d1,\\n v.totalSupply.add(toMint)\\n );\\n\\n return toMint;\\n }\\n\\n /**\\n * @notice Burn LP tokens to remove liquidity from the pool.\\n * @dev Liquidity can always be removed, even when the pool is paused.\\n * @param self Swap struct to read from and write to\\n * @param amount the amount of LP tokens to burn\\n * @param minAmounts the minimum amounts of each token in the pool\\n * acceptable for this burn. Useful as a front-running mitigation\\n * @return amounts of tokens the user received\\n */\\n function removeLiquidity(\\n Swap storage self,\\n uint256 amount,\\n uint256[] calldata minAmounts\\n ) external returns (uint256[] memory) {\\n LPToken lpToken = self.lpToken;\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n require(amount <= lpToken.balanceOf(msg.sender), \\\">LP.balanceOf\\\");\\n require(\\n minAmounts.length == pooledTokens.length,\\n \\\"minAmounts must match poolTokens\\\"\\n );\\n\\n uint256[] memory balances = self.balances;\\n uint256 totalSupply = lpToken.totalSupply();\\n\\n uint256[] memory amounts = _calculateRemoveLiquidity(\\n balances,\\n amount,\\n totalSupply\\n );\\n\\n for (uint256 i = 0; i < amounts.length; i++) {\\n require(amounts[i] >= minAmounts[i], \\\"amounts[i] < minAmounts[i]\\\");\\n self.balances[i] = balances[i].sub(amounts[i]);\\n pooledTokens[i].safeTransfer(msg.sender, amounts[i]);\\n }\\n\\n lpToken.burnFrom(msg.sender, amount);\\n\\n emit RemoveLiquidity(msg.sender, amounts, totalSupply.sub(amount));\\n\\n return amounts;\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool all in one token.\\n * @param self Swap struct to read from and write to\\n * @param tokenAmount the amount of the lp tokens to burn\\n * @param tokenIndex the index of the token you want to receive\\n * @param minAmount the minimum amount to withdraw, otherwise revert\\n * @return amount chosen token that user received\\n */\\n function removeLiquidityOneToken(\\n Swap storage self,\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount\\n ) external returns (uint256) {\\n LPToken lpToken = self.lpToken;\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n\\n require(tokenAmount <= lpToken.balanceOf(msg.sender), \\\">LP.balanceOf\\\");\\n require(tokenIndex < pooledTokens.length, \\\"Token not found\\\");\\n\\n uint256 totalSupply = lpToken.totalSupply();\\n\\n (uint256 dy, uint256 dyFee) = _calculateWithdrawOneToken(\\n self,\\n tokenAmount,\\n tokenIndex,\\n totalSupply\\n );\\n\\n require(dy >= minAmount, \\\"dy < minAmount\\\");\\n\\n self.balances[tokenIndex] = self.balances[tokenIndex].sub(\\n dy.add(dyFee.mul(self.adminFee).div(FEE_DENOMINATOR))\\n );\\n lpToken.burnFrom(msg.sender, tokenAmount);\\n pooledTokens[tokenIndex].safeTransfer(msg.sender, dy);\\n\\n emit RemoveLiquidityOne(\\n msg.sender,\\n tokenAmount,\\n totalSupply,\\n tokenIndex,\\n dy\\n );\\n\\n return dy;\\n }\\n\\n /**\\n * @notice Remove liquidity from the pool, weighted differently than the\\n * pool's current balances.\\n *\\n * @param self Swap struct to read from and write to\\n * @param amounts how much of each token to withdraw\\n * @param maxBurnAmount the max LP token provider is willing to pay to\\n * remove liquidity. Useful as a front-running mitigation.\\n * @return actual amount of LP tokens burned in the withdrawal\\n */\\n function removeLiquidityImbalance(\\n Swap storage self,\\n uint256[] memory amounts,\\n uint256 maxBurnAmount\\n ) public returns (uint256) {\\n ManageLiquidityInfo memory v = ManageLiquidityInfo(\\n 0,\\n 0,\\n 0,\\n _getAPrecise(self),\\n self.lpToken,\\n 0,\\n self.balances,\\n self.tokenPrecisionMultipliers\\n );\\n v.totalSupply = v.lpToken.totalSupply();\\n\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n\\n require(\\n amounts.length == pooledTokens.length,\\n \\\"Amounts should match pool tokens\\\"\\n );\\n\\n require(\\n maxBurnAmount <= v.lpToken.balanceOf(msg.sender) &&\\n maxBurnAmount != 0,\\n \\\">LP.balanceOf\\\"\\n );\\n\\n uint256 feePerToken = _feePerToken(self.swapFee, pooledTokens.length);\\n uint256[] memory fees = new uint256[](pooledTokens.length);\\n {\\n uint256[] memory balances1 = new uint256[](pooledTokens.length);\\n v.d0 = getD(_xp(v.balances, v.multipliers), v.preciseA);\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n balances1[i] = v.balances[i].sub(\\n amounts[i],\\n \\\"Cannot withdraw more than available\\\"\\n );\\n }\\n v.d1 = getD(_xp(balances1, v.multipliers), v.preciseA);\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n uint256 idealBalance = v.d1.mul(v.balances[i]).div(v.d0);\\n uint256 difference = idealBalance.difference(balances1[i]);\\n fees[i] = feePerToken.mul(difference).div(FEE_DENOMINATOR);\\n self.balances[i] = balances1[i].sub(\\n fees[i].mul(self.adminFee).div(FEE_DENOMINATOR)\\n );\\n balances1[i] = balances1[i].sub(fees[i]);\\n }\\n\\n v.d2 = getD(_xp(balances1, v.multipliers), v.preciseA);\\n }\\n uint256 tokenAmount = v.d0.sub(v.d2).mul(v.totalSupply).div(v.d0);\\n require(tokenAmount != 0, \\\"Burnt amount cannot be zero\\\");\\n tokenAmount = tokenAmount.add(1);\\n\\n require(tokenAmount <= maxBurnAmount, \\\"tokenAmount > maxBurnAmount\\\");\\n\\n v.lpToken.burnFrom(msg.sender, tokenAmount);\\n\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n pooledTokens[i].safeTransfer(msg.sender, amounts[i]);\\n }\\n\\n emit RemoveLiquidityImbalance(\\n msg.sender,\\n amounts,\\n fees,\\n v.d1,\\n v.totalSupply.sub(tokenAmount)\\n );\\n\\n return tokenAmount;\\n }\\n\\n /**\\n * @notice withdraw all admin fees to a given address\\n * @param self Swap struct to withdraw fees from\\n * @param to Address to send the fees to\\n */\\n function withdrawAdminFees(Swap storage self, address to) external {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n IERC20 token = pooledTokens[i];\\n uint256 balance = token.balanceOf(address(this)).sub(\\n self.balances[i]\\n );\\n if (balance != 0) {\\n token.safeTransfer(to, balance);\\n }\\n }\\n }\\n\\n /**\\n * @notice Sets the admin fee\\n * @dev adminFee cannot be higher than 100% of the swap fee\\n * @param self Swap struct to update\\n * @param newAdminFee new admin fee to be applied on future transactions\\n */\\n function setAdminFee(Swap storage self, uint256 newAdminFee) external {\\n require(newAdminFee <= MAX_ADMIN_FEE, \\\"Fee is too high\\\");\\n self.adminFee = newAdminFee;\\n\\n emit NewAdminFee(newAdminFee);\\n }\\n\\n /**\\n * @notice update the swap fee\\n * @dev fee cannot be higher than 1% of each swap\\n * @param self Swap struct to update\\n * @param newSwapFee new swap fee to be applied on future transactions\\n */\\n function setSwapFee(Swap storage self, uint256 newSwapFee) external {\\n require(newSwapFee <= MAX_SWAP_FEE, \\\"Fee is too high\\\");\\n self.swapFee = newSwapFee;\\n\\n emit NewSwapFee(newSwapFee);\\n }\\n}\\n\",\"keccak256\":\"0x1571bb987f110239e647da76403b6a73b7a46a082035dc950ddc9db26eb0fbed\",\"license\":\"MIT\"},\"contracts/interfaces/IAllowlist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\ninterface IAllowlist {\\n function getPoolAccountLimit(address poolAddress)\\n external\\n view\\n returns (uint256);\\n\\n function getPoolCap(address poolAddress) external view returns (uint256);\\n\\n function verifyAddress(address account, bytes32[] calldata merkleProof)\\n external\\n returns (bool);\\n}\\n\",\"keccak256\":\"0xf55e4d678d05bc5d0e24ec5f24504d7437b885e19579f9d29152748c3c1c732e\",\"license\":\"MIT\"},\"contracts/interfaces/IMasterRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity >=0.6.0;\\npragma experimental ABIEncoderV2;\\n\\ninterface IMasterRegistry {\\n /* Structs */\\n\\n struct ReverseRegistryData {\\n bytes32 name;\\n uint256 version;\\n }\\n\\n /* Functions */\\n\\n /**\\n * @notice Add a new registry entry to the master list.\\n * @param registryName name for the registry\\n * @param registryAddress address of the new registry\\n */\\n function addRegistry(bytes32 registryName, address registryAddress)\\n external\\n payable;\\n\\n /**\\n * @notice Resolves a name to the latest registry address. Reverts if no match is found.\\n * @param name name for the registry\\n * @return address address of the latest registry with the matching name\\n */\\n function resolveNameToLatestAddress(bytes32 name)\\n external\\n view\\n returns (address);\\n\\n /**\\n * @notice Resolves a name and version to an address. Reverts if there is no registry with given name and version.\\n * @param name address of the registry you want to resolve to\\n * @param version version of the registry you want to resolve to\\n */\\n function resolveNameAndVersionToAddress(bytes32 name, uint256 version)\\n external\\n view\\n returns (address);\\n\\n /**\\n * @notice Resolves a name to an array of all addresses. Reverts if no match is found.\\n * @param name name for the registry\\n * @return address address of the latest registry with the matching name\\n */\\n function resolveNameToAllAddresses(bytes32 name)\\n external\\n view\\n returns (address[] memory);\\n\\n /**\\n * @notice Resolves an address to registry entry data.\\n * @param registryAddress address of a registry you want to resolve\\n * @return name name of the resolved registry\\n * @return version version of the resolved registry\\n * @return isLatest boolean flag of whether the given address is the latest version of the given registries with\\n * matching name\\n */\\n function resolveAddressToRegistryData(address registryAddress)\\n external\\n view\\n returns (\\n bytes32 name,\\n uint256 version,\\n bool isLatest\\n );\\n}\\n\",\"keccak256\":\"0x0e403d7e259003f3826b3009ae3e39344706d7af8a0a5bd48ba45a6ca978226b\",\"license\":\"MIT\"},\"contracts/interfaces/ISwap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/ERC20.sol\\\";\\nimport \\\"./IAllowlist.sol\\\";\\n\\ninterface ISwap {\\n // pool data view functions\\n function getA() external view returns (uint256);\\n\\n function getAPrecise() external view returns (uint256);\\n\\n function getAllowlist() external view returns (IAllowlist);\\n\\n function getToken(uint8 index) external view returns (IERC20);\\n\\n function getTokenIndex(address tokenAddress) external view returns (uint8);\\n\\n function getTokenBalance(uint8 index) external view returns (uint256);\\n\\n function getVirtualPrice() external view returns (uint256);\\n\\n function owner() external view returns (address);\\n\\n function isGuarded() external view returns (bool);\\n\\n function paused() external view returns (bool);\\n\\n function swapStorage()\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n uint256,\\n address\\n );\\n\\n // min return calculation functions\\n function calculateSwap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx\\n ) external view returns (uint256);\\n\\n function calculateTokenAmount(uint256[] calldata amounts, bool deposit)\\n external\\n view\\n returns (uint256);\\n\\n function calculateRemoveLiquidity(uint256 amount)\\n external\\n view\\n returns (uint256[] memory);\\n\\n function calculateRemoveLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex\\n ) external view returns (uint256 availableTokenAmount);\\n\\n // state modifying functions\\n function initialize(\\n IERC20[] memory pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 a,\\n uint256 fee,\\n uint256 adminFee,\\n address lpTokenTargetAddress\\n ) external;\\n\\n function swap(\\n uint8 tokenIndexFrom,\\n uint8 tokenIndexTo,\\n uint256 dx,\\n uint256 minDy,\\n uint256 deadline\\n ) external returns (uint256);\\n\\n function addLiquidity(\\n uint256[] calldata amounts,\\n uint256 minToMint,\\n uint256 deadline\\n ) external returns (uint256);\\n\\n function removeLiquidity(\\n uint256 amount,\\n uint256[] calldata minAmounts,\\n uint256 deadline\\n ) external returns (uint256[] memory);\\n\\n function removeLiquidityOneToken(\\n uint256 tokenAmount,\\n uint8 tokenIndex,\\n uint256 minAmount,\\n uint256 deadline\\n ) external returns (uint256);\\n\\n function removeLiquidityImbalance(\\n uint256[] calldata amounts,\\n uint256 maxBurnAmount,\\n uint256 deadline\\n ) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xcd26195c5e3824e7984750a05c9fcb6dde3e266022c3bd1a9dcdda9e967a6f4c\",\"license\":\"MIT\"},\"contracts/permissionless/PermissionlessSwap.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"../Swap.sol\\\";\\nimport \\\"../interfaces/IMasterRegistry.sol\\\";\\nimport \\\"./PermissionlessSwapUtils.sol\\\";\\nimport \\\"./ShareProtocolFee.sol\\\";\\n\\n/**\\n * @title Swap - A StableSwap implementation in solidity.\\n * @notice This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)\\n * and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokens\\n * in desired ratios for an exchange of the pool token that represents their share of the pool.\\n * Users can burn pool tokens and withdraw their share of token(s).\\n *\\n * Each time a swap between the pooled tokens happens, a set fee incurs which effectively gets\\n * distributed to the LPs. Part of this fee is given to the creator of the pool as an Admin fee,\\n * the amount of which is set when the pool is created. Saddle will collect to 50% of these Admin fees.\\n *\\n * In case of emergencies, admin can pause additional deposits, swaps, or single-asset withdraws - which\\n * stops the ratio of the tokens in the pool from changing.\\n * Users can always withdraw their tokens via multi-asset withdraws.\\n *\\n * @dev Most of the logic is stored as a library `PermissionlessSwapUtils` for the sake of reducing\\n * contract's deployment size.\\n */\\ncontract PermissionlessSwap is Swap, ShareProtocolFee {\\n using PermissionlessSwapUtils for SwapUtils.Swap;\\n\\n /**\\n * @notice Constructor for the PermissionlessSwap contract.\\n * @param _masterRegistry address of the MasterRegistry contract\\n */\\n constructor(IMasterRegistry _masterRegistry)\\n public\\n ShareProtocolFee(_masterRegistry)\\n {}\\n\\n /*** ADMIN FUNCTIONS ***/\\n\\n /**\\n * @notice Updates cached address of the fee collector\\n */\\n function initialize(\\n IERC20[] memory _pooledTokens,\\n uint8[] memory decimals,\\n string memory lpTokenName,\\n string memory lpTokenSymbol,\\n uint256 _a,\\n uint256 _fee,\\n uint256 _adminFee,\\n address lpTokenTargetAddress\\n ) public payable virtual override initializer {\\n Swap.initialize(\\n _pooledTokens,\\n decimals,\\n lpTokenName,\\n lpTokenSymbol,\\n _a,\\n _fee,\\n _adminFee,\\n lpTokenTargetAddress\\n );\\n _updateFeeCollectorCache(MASTER_REGISTRY);\\n }\\n\\n /**\\n * @notice Withdraw all admin fees to the contract owner and the fee collector.\\n */\\n function withdrawAdminFees()\\n external\\n payable\\n virtual\\n override(Swap, ShareProtocolFee)\\n {\\n require(\\n msg.sender == owner() || msg.sender == feeCollector,\\n \\\"Caller is not authorized\\\"\\n );\\n PermissionlessSwapUtils.withdrawAdminFees(\\n swapStorage,\\n owner(),\\n feeCollector\\n );\\n }\\n}\\n\",\"keccak256\":\"0x36bb4e9bb6cfea001cb6d44018f5297c0552dddd1958e06232b529e4fe6deb58\",\"license\":\"MIT\"},\"contracts/permissionless/PermissionlessSwapUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\n\\nimport \\\"@openzeppelin/contracts/math/SafeMath.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\\\";\\nimport \\\"../SwapUtils.sol\\\";\\n\\n/**\\n * @title PermissionlessSwapUtils library\\n * @notice A library to be used within Swap.sol. Contains functions responsible for custody and AMM functionalities.\\n * @dev Contracts relying on this library must initialize SwapUtils.Swap struct then use this library\\n * for SwapUtils.Swap struct. Note that this library contains both functions called by users and admins.\\n * Admin functions should be protected within contracts using this library.\\n */\\nlibrary PermissionlessSwapUtils {\\n using SafeERC20 for IERC20;\\n using SafeMath for uint256;\\n\\n /**\\n * @notice Withdraw all admin fees to two addresses evenly\\n * @param self Swap struct to withdraw fees from\\n * @param creator Address to send hald of the fees to. For the creator of the community pool.\\n * @param protocol Address to send the half of the fees to. For the protocol fee collection.\\n */\\n function withdrawAdminFees(\\n SwapUtils.Swap storage self,\\n address creator,\\n address protocol\\n ) internal {\\n IERC20[] memory pooledTokens = self.pooledTokens;\\n for (uint256 i = 0; i < pooledTokens.length; i++) {\\n IERC20 token = pooledTokens[i];\\n uint256 balance = token.balanceOf(address(this)).sub(\\n self.balances[i]\\n ) / 2;\\n if (balance != 0) {\\n token.safeTransfer(creator, balance);\\n token.safeTransfer(protocol, balance);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1b94e14de31e95f82bf8f47aa65f4c68c7152823cac6daf2b50c3923f20f2ecc\",\"license\":\"MIT\"},\"contracts/permissionless/ShareProtocolFee.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.6.12;\\nimport \\\"../interfaces/IMasterRegistry.sol\\\";\\n\\nabstract contract ShareProtocolFee {\\n IMasterRegistry public immutable MASTER_REGISTRY;\\n bytes32 public constant FEE_COLLECTOR_NAME =\\n 0x466565436f6c6c6563746f720000000000000000000000000000000000000000;\\n address public feeCollector;\\n\\n constructor(IMasterRegistry _masterRegistry) public {\\n MASTER_REGISTRY = _masterRegistry;\\n _updateFeeCollectorCache(_masterRegistry);\\n }\\n\\n /**\\n * @notice Updates cached address of the fee collector\\n */\\n function updateFeeCollectorCache() public payable virtual {\\n _updateFeeCollectorCache(MASTER_REGISTRY);\\n }\\n\\n function _updateFeeCollectorCache(IMasterRegistry masterRegistry)\\n internal\\n virtual\\n {\\n address _feeCollector = masterRegistry.resolveNameToLatestAddress(\\n FEE_COLLECTOR_NAME\\n );\\n require(_feeCollector != address(0), \\\"Fee collector cannot be empty\\\");\\n feeCollector = _feeCollector;\\n }\\n\\n /**\\n * @notice Withdraws admin fees to appropriate addresses\\n */\\n function withdrawAdminFees() external payable virtual;\\n}\\n\",\"keccak256\":\"0x4af76c8dd2356c160c60f1378a11a832f0e99e9bbb36908b95d3743f3aecbc32\",\"license\":\"MIT\"}},\"version\":1}", @@ -1485,4 +1483,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/PoolRegistry.json b/deployments/base_testnet/PoolRegistry.json index ada75a7a..ce45e6ae 100644 --- a/deployments/base_testnet/PoolRegistry.json +++ b/deployments/base_testnet/PoolRegistry.json @@ -1966,4 +1966,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/SaddleDummyPool.json b/deployments/base_testnet/SaddleDummyPool.json index 5f677bc0..e4c8569e 100644 --- a/deployments/base_testnet/SaddleDummyPool.json +++ b/deployments/base_testnet/SaddleDummyPool.json @@ -1434,4 +1434,4 @@ } } } -} \ No newline at end of file +} diff --git a/deployments/base_testnet/SaddleDummyPoolLPToken.json b/deployments/base_testnet/SaddleDummyPoolLPToken.json index 9dbd4d79..29e3600a 100644 --- a/deployments/base_testnet/SaddleDummyPoolLPToken.json +++ b/deployments/base_testnet/SaddleDummyPoolLPToken.json @@ -411,4 +411,4 @@ } ], "numDeployments": 1 -} \ No newline at end of file +} diff --git a/hardhat.config.ts b/hardhat.config.ts index 4baba972..48b1fdb9 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -183,7 +183,7 @@ const config: HardhatUserConfig = { deploy: ["./deploy/base_testnet/"], verify: { etherscan: { - apiUrl: "https://api-goerli.basescan.org/api", + apiUrl: "https://api-goerli.basescan.org", apiKey: process.env.ETHERSCAN_API ?? "NO_KEY", }, }, @@ -296,6 +296,22 @@ const config: HardhatUserConfig = { overwrite: false, runOnCompile: true, }, + + etherscan: { + apiKey: { + base_testnet: process.env.ETHERSCAN_API ?? "NO_KEY", + }, + customChains: [ + { + network: "base_testnet", + chainId: 84531, + urls: { + apiURL: "https://api-goerli.basescan.org/api", + browserURL: "https://goerli.basescan.org/", + }, + }, + ], + }, } // If we have any private keys, use them for mainnet networks as default signers