From f78bb5d5971bf5fe46e4a49610accc9c41f9ef69 Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 6 Oct 2021 17:51:46 +0300 Subject: [PATCH] remove sign; L1Helper with registration; minimal withdraw; maximum deposit; refactoring --- .env.example | 2 + contracts/CrossChainUpgradeableProxy.sol | 4 +- contracts/MerkleTreeWithHistory.sol | 2 +- contracts/Mocks/MerkleTreeWithHistoryMock.sol | 4 + contracts/Mocks/MockOmniBridge.sol | 2 +- contracts/TornadoPool.sol | 101 +- contracts/bridge/BridgeHelper.sol | 737 ---- contracts/bridge/L1Helper.sol | 49 + contracts/bridge/bridge.sol.tmp | 3615 ----------------- .../interfaces/{Bridge.sol => IBridge.sol} | 17 + contracts/interfaces/IVerifier.sol | 8 + hardhat.config.js | 9 + package.json | 5 +- scripts/deployTornado.js | 22 +- src/index.js | 2 +- test/full.test.js | 62 +- test/utils.js | 36 +- yarn.lock | 1340 +++--- 18 files changed, 1024 insertions(+), 4993 deletions(-) delete mode 100644 contracts/bridge/BridgeHelper.sol create mode 100644 contracts/bridge/L1Helper.sol delete mode 100644 contracts/bridge/bridge.sol.tmp rename contracts/interfaces/{Bridge.sol => IBridge.sol} (58%) create mode 100644 contracts/interfaces/IVerifier.sol diff --git a/.env.example b/.env.example index 3984720..ff016e7 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,4 @@ PRIVATE_KEY= ETH_RPC=https:// +MINIMUM_WITHDRAWAL_AMOUNT=0.05 +MAXIMUM_DEPOSIT_AMOUNT=1 diff --git a/contracts/CrossChainUpgradeableProxy.sol b/contracts/CrossChainUpgradeableProxy.sol index 8399e88..bfc6dba 100644 --- a/contracts/CrossChainUpgradeableProxy.sol +++ b/contracts/CrossChainUpgradeableProxy.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; -import { IAMB } from "./interfaces/Bridge.sol"; -import "@openzeppelin/contracts/contracts/proxy/TransparentUpgradeableProxy.sol"; +import { IAMB } from "./interfaces/IBridge.sol"; +import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; /** * @dev TransparentUpgradeableProxy where admin acts from a different chain. diff --git a/contracts/MerkleTreeWithHistory.sol b/contracts/MerkleTreeWithHistory.sol index c45ca89..c91bfca 100644 --- a/contracts/MerkleTreeWithHistory.sol +++ b/contracts/MerkleTreeWithHistory.sol @@ -43,7 +43,7 @@ contract MerkleTreeWithHistory is Initializable { hasher = IHasher(_hasher); } - function initialize() external initializer { + function _initialize() internal { for (uint32 i = 0; i < levels; i++) { filledSubtrees[i] = zeros(i); } diff --git a/contracts/Mocks/MerkleTreeWithHistoryMock.sol b/contracts/Mocks/MerkleTreeWithHistoryMock.sol index 60eef68..ebe303c 100644 --- a/contracts/Mocks/MerkleTreeWithHistoryMock.sol +++ b/contracts/Mocks/MerkleTreeWithHistoryMock.sol @@ -9,4 +9,8 @@ contract MerkleTreeWithHistoryMock is MerkleTreeWithHistory { function insert(bytes32 _leaf1, bytes32 _leaf2) public returns (uint32 index) { return _insert(_leaf1, _leaf2); } + + function initialize() external { + super._initialize(); + } } diff --git a/contracts/Mocks/MockOmniBridge.sol b/contracts/Mocks/MockOmniBridge.sol index 17245bf..77fea9d 100644 --- a/contracts/Mocks/MockOmniBridge.sol +++ b/contracts/Mocks/MockOmniBridge.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; -import { IAMB, IOmniBridge } from "../interfaces/Bridge.sol"; +import { IAMB, IOmniBridge } from "../interfaces/IBridge.sol"; contract MockOmniBridge is IOmniBridge { IAMB public AMB; diff --git a/contracts/TornadoPool.sol b/contracts/TornadoPool.sol index 2ed5ea3..81ed474 100644 --- a/contracts/TornadoPool.sol +++ b/contracts/TornadoPool.sol @@ -13,37 +13,16 @@ pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; -import "@openzeppelin/contracts/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/contracts/cryptography/ECDSA.sol"; +import "@openzeppelin/contracts/cryptography/ECDSA.sol"; +import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; +import { IERC20Receiver, IERC6777 } from "./interfaces/IBridge.sol"; +import { IVerifier } from "./interfaces/IVerifier.sol"; import "./MerkleTreeWithHistory.sol"; -interface IERC6777 is IERC20 { - function transferAndCall( - address, - uint256, - bytes calldata - ) external returns (bool); -} - -interface IVerifier { - function verifyProof(bytes memory _proof, uint256[7] memory _input) external view returns (bool); - - function verifyProof(bytes memory _proof, uint256[21] memory _input) external view returns (bool); -} - -interface IERC20Receiver { - function onTokenBridged( - IERC6777 token, - uint256 value, - bytes calldata data - ) external; -} - -contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver { +contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver, ReentrancyGuard { int256 public constant MAX_EXT_AMOUNT = 2**248; uint256 public constant MAX_FEE = 2**248; - bytes32 public constant ACCOUNT_TYPEHASH = keccak256("TornadoAccount(address owner,bytes publicKey)"); - uint256 public immutable L1_CHAIN_ID; + address public immutable governance; IVerifier public immutable verifier2; IVerifier public immutable verifier16; @@ -51,7 +30,9 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver { address public immutable omniBridge; address public immutable l1Unwrapper; - uint256 public totalDeposited; + uint256 public lastBalance; + uint256 public minimalWithdrawalAmount; + uint256 public maximumDepositAmount; mapping(bytes32 => bool) public nullifierHashes; struct ExtData { @@ -82,6 +63,11 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver { event NewNullifier(bytes32 nullifier); event PublicKey(address indexed owner, bytes key); + modifier onlyGovernance() { + require(msg.sender == governance, "only governance"); + _; + } + /** @dev The constructor @param _verifier2 the address of SNARK verifier for 2 inputs @@ -95,27 +81,36 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver { IERC6777 _token, address _omniBridge, address _l1Unwrapper, - uint256 _l1ChainId + address _governance ) MerkleTreeWithHistory(_levels, _hasher) { verifier2 = _verifier2; verifier16 = _verifier16; token = _token; omniBridge = _omniBridge; l1Unwrapper = _l1Unwrapper; - L1_CHAIN_ID = _l1ChainId; + governance = _governance; + } + + function initialize(uint256 _minimalWithdrawalAmount, uint256 _maximumDepositAmount) external initializer { + _configureLimits(_minimalWithdrawalAmount, _maximumDepositAmount); + super._initialize(); + } + + function configureLimits(uint256 _minimalWithdrawalAmount, uint256 _maximumDepositAmount) public onlyGovernance { + _configureLimits(_minimalWithdrawalAmount, _maximumDepositAmount); } function transact(Proof memory _args, ExtData memory _extData) public { if (_extData.extAmount > 0) { // for deposits from L2 token.transferFrom(msg.sender, address(this), uint256(_extData.extAmount)); - totalDeposited += uint256(_extData.extAmount); + require(uint256(_extData.extAmount) <= maximumDepositAmount, "amount is larger than maximumDepositAmount"); } _transact(_args, _extData); } - function _transact(Proof memory _args, ExtData memory _extData) internal { + function _transact(Proof memory _args, ExtData memory _extData) internal nonReentrant { require(isKnownRoot(_args.root), "Invalid merkle root"); for (uint256 i = 0; i < _args.inputNullifiers.length; i++) { require(!isSpent(_args.inputNullifiers[i]), "Input is already spent"); @@ -135,12 +130,13 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver { } else { token.transfer(_extData.recipient, uint256(-_extData.extAmount)); } - totalDeposited -= uint256(-_extData.extAmount); + require(uint256(-_extData.extAmount) >= minimalWithdrawalAmount, "amount is less than minimalWithdrawalAmount"); // prevents ddos attack to Bridge } if (_extData.fee > 0) { token.transfer(_extData.relayer, _extData.fee); } + lastBalance = token.balanceOf(address(this)); _insert(_args.outputCommitments[0], _args.outputCommitments[1]); emit NewCommitment(_args.outputCommitments[0], nextIndex - 2, _extData.encryptedOutput1); emit NewCommitment(_args.outputCommitments[1], nextIndex - 1, _extData.encryptedOutput2); @@ -232,42 +228,17 @@ contract TornadoPool is MerkleTreeWithHistory, IERC20Receiver { uint256 _amount, bytes calldata _data ) external override { - (Account memory _account, Proof memory _args, ExtData memory _extData, bytes memory _signature) = abi.decode( - _data, - (Account, Proof, ExtData, bytes) - ); - require(isValidSignature(_account, _signature), "Invalid account signature"); + (Proof memory _args, ExtData memory _extData) = abi.decode(_data, (Proof, ExtData)); require(_token == token, "provided token is not supported"); require(msg.sender == omniBridge, "only omni bridge"); - require(_amount == uint256(_extData.extAmount), "amount from bridge is incorrect"); - require(uint256(_extData.extAmount) + totalDeposited >= token.balanceOf(address(this)), "bridge did not send enough tokens"); - - totalDeposited += uint256(_extData.extAmount); - - if (_account.owner != address(0) && _account.publicKey.length > 0) { - _register(_account); - } + require(_amount >= uint256(_extData.extAmount), "amount from bridge is incorrect"); + require(token.balanceOf(address(this)) >= uint256(_extData.extAmount) + lastBalance, "bridge did not send enough tokens"); + require(uint256(_extData.extAmount) <= maximumDepositAmount, "amount is larger than maximumDepositAmount"); _transact(_args, _extData); } - function isValidSignature(Account memory _account, bytes memory _signature) public view returns (bool) { - bytes32 hashStruct = keccak256(abi.encode(ACCOUNT_TYPEHASH, _account.owner, keccak256(_account.publicKey))); - bytes32 hash = keccak256(abi.encodePacked(uint16(0x1901), domainSeparator(), hashStruct)); - - address signer = ECDSA.recover(hash, _signature); - return signer == _account.owner; - } - - function domainSeparator() public view returns (bytes32) { - return - keccak256( - abi.encode( - keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), - keccak256(bytes("TornadoPool")), - keccak256(bytes("1")), // Version - L1_CHAIN_ID, - address(this) - ) - ); + function _configureLimits(uint256 _minimalWithdrawalAmount, uint256 _maximumDepositAmount) internal { + minimalWithdrawalAmount = _minimalWithdrawalAmount; + maximumDepositAmount = _maximumDepositAmount; } } diff --git a/contracts/bridge/BridgeHelper.sol b/contracts/bridge/BridgeHelper.sol deleted file mode 100644 index 18596a8..0000000 --- a/contracts/bridge/BridgeHelper.sol +++ /dev/null @@ -1,737 +0,0 @@ -/** - *Submitted for verification at BscScan.com on 2021-03-09 - */ - -pragma solidity 0.7.6; - -/** - * @dev Wrappers over Solidity's arithmetic operations with added overflow - * checks. - * - * Arithmetic operations in Solidity wrap on overflow. This can easily result - * in bugs, because programmers usually assume that an overflow raises an - * error, which is the standard behavior in high level programming languages. - * `SafeMath` restores this intuition by reverting the transaction when an - * operation overflows. - * - * Using this library instead of the unchecked operations eliminates an entire - * class of bugs, so it's recommended to use it always. - */ -library SafeMath { - /** - * @dev Returns the addition of two unsigned integers, reverting on - * overflow. - * - * Counterpart to Solidity's `+` operator. - * - * Requirements: - * - * - Addition cannot overflow. - */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; - require(c >= a, "SafeMath: addition overflow"); - - return c; - } - - /** - * @dev Returns the subtraction of two unsigned integers, reverting on - * overflow (when the result is negative). - * - * Counterpart to Solidity's `-` operator. - * - * Requirements: - * - * - Subtraction cannot overflow. - */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - return sub(a, b, "SafeMath: subtraction overflow"); - } - - /** - * @dev Returns the subtraction of two unsigned integers, reverting with custom message on - * overflow (when the result is negative). - * - * Counterpart to Solidity's `-` operator. - * - * Requirements: - * - * - Subtraction cannot overflow. - */ - function sub( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { - require(b <= a, errorMessage); - uint256 c = a - b; - - return c; - } - - /** - * @dev Returns the multiplication of two unsigned integers, reverting on - * overflow. - * - * Counterpart to Solidity's `*` operator. - * - * Requirements: - * - * - Multiplication cannot overflow. - */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { - // Gas optimization: this is cheaper than requiring 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 - if (a == 0) { - return 0; - } - - uint256 c = a * b; - require(c / a == b, "SafeMath: multiplication overflow"); - - return c; - } - - /** - * @dev Returns the integer division of two unsigned integers. Reverts on - * division by zero. The result is rounded towards zero. - * - * Counterpart to Solidity's `/` operator. Note: this function uses a - * `revert` opcode (which leaves remaining gas untouched) while Solidity - * uses an invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { - return div(a, b, "SafeMath: division by zero"); - } - - /** - * @dev Returns the integer division of two unsigned integers. Reverts with custom message on - * division by zero. The result is rounded towards zero. - * - * Counterpart to Solidity's `/` operator. Note: this function uses a - * `revert` opcode (which leaves remaining gas untouched) while Solidity - * uses an invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function div( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { - require(b > 0, errorMessage); - uint256 c = a / b; - // assert(a == b * c + a % b); // There is no case in which this doesn't hold - - return c; - } - - /** - * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), - * Reverts when dividing by zero. - * - * Counterpart to Solidity's `%` operator. This function uses a `revert` - * opcode (which leaves remaining gas untouched) while Solidity uses an - * invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function mod(uint256 a, uint256 b) internal pure returns (uint256) { - return mod(a, b, "SafeMath: modulo by zero"); - } - - /** - * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), - * Reverts with custom message when dividing by zero. - * - * Counterpart to Solidity's `%` operator. This function uses a `revert` - * opcode (which leaves remaining gas untouched) while Solidity uses an - * invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function mod( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { - require(b != 0, errorMessage); - return a % b; - } -} - -interface IOmnibridge { - function relayTokens( - address _token, - address _receiver, - uint256 _value - ) external; - - /** - * @dev Initiate the bridge operation for some amount of tokens from msg.sender. - * The user should first call Approve method of the ERC677 token. - * @param token bridged token contract address. - * @param _receiver address that will receive the native tokens on the other network. - * @param _value amount of tokens to be transferred to the other network. - * @param _data additional transfer data to be used on the other side. - */ - function relayTokensAndCall( - address token, - address _receiver, - uint256 _value, - bytes memory _data - ) external; -} - -interface IWETH { - function deposit() external payable; - - function withdraw(uint256 _value) external; - - function approve(address _to, uint256 _value) external; -} - -contract Sacrifice { - constructor(address payable _recipient) payable { - selfdestruct(_recipient); - } -} - -/** - * @title AddressHelper - * @dev Helper methods for Address type. - */ -library AddressHelper { - /** - * @dev Try to send native tokens to the address. If it fails, it will force the transfer by creating a selfdestruct contract - * @param _receiver address that will receive the native tokens - * @param _value the amount of native tokens to send - */ - function safeSendValue(address payable _receiver, uint256 _value) internal { - if (!(_receiver).send(_value)) { - new Sacrifice{ value: _value }(_receiver); - } - } -} - -/** - * @dev Collection of functions related to the address type - */ -library Address { - /** - * @dev Returns true if `account` is a contract. - * - * [IMPORTANT] - * ==== - * It is unsafe to assume that an address for which this function returns - * false is an externally-owned account (EOA) and not a contract. - * - * Among others, `isContract` will return false for the following - * types of addresses: - * - * - an externally-owned account - * - a contract in construction - * - an address where a contract will be created - * - an address where a contract lived, but was destroyed - * ==== - */ - function isContract(address account) internal view returns (bool) { - // According to EIP-1052, 0x0 is the value returned for not-yet created accounts - // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned - // for accounts without code, i.e. `keccak256('')` - bytes32 codehash; - bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; - // solhint-disable-next-line no-inline-assembly - assembly { - codehash := extcodehash(account) - } - return (codehash != accountHash && codehash != 0x0); - } - - /** - * @dev Replacement for Solidity's `transfer`: sends `amount` wei to - * `recipient`, forwarding all available gas and reverting on errors. - * - * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost - * of certain opcodes, possibly making contracts go over the 2300 gas limit - * imposed by `transfer`, making them unable to receive funds via - * `transfer`. {sendValue} removes this limitation. - * - * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. - * - * IMPORTANT: because control is transferred to `recipient`, care must be - * taken to not create reentrancy vulnerabilities. Consider using - * {ReentrancyGuard} or the - * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. - */ - function sendValue(address payable recipient, uint256 amount) internal { - require(address(this).balance >= amount, "Address: insufficient balance"); - - // solhint-disable-next-line avoid-low-level-calls, avoid-call-value - (bool success, ) = recipient.call{ value: amount }(""); - require(success, "Address: unable to send value, recipient may have reverted"); - } - - /** - * @dev Performs a Solidity function call using a low level `call`. A - * plain`call` is an unsafe replacement for a function call: use this - * function instead. - * - * If `target` reverts with a revert reason, it is bubbled up by this - * function (like regular Solidity function calls). - * - * Returns the raw returned data. To convert to the expected return value, - * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. - * - * Requirements: - * - * - `target` must be a contract. - * - calling `target` with `data` must not revert. - * - * _Available since v3.1._ - */ - function functionCall(address target, bytes memory data) internal returns (bytes memory) { - return functionCall(target, data, "Address: low-level call failed"); - } - - /** - * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with - * `errorMessage` as a fallback revert reason when `target` reverts. - * - * _Available since v3.1._ - */ - function functionCall( - address target, - bytes memory data, - string memory errorMessage - ) internal returns (bytes memory) { - return _functionCallWithValue(target, data, 0, errorMessage); - } - - /** - * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], - * but also transferring `value` wei to `target`. - * - * Requirements: - * - * - the calling contract must have an ETH balance of at least `value`. - * - the called Solidity function must be `payable`. - * - * _Available since v3.1._ - */ - function functionCallWithValue( - address target, - bytes memory data, - uint256 value - ) internal returns (bytes memory) { - return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); - } - - /** - * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but - * with `errorMessage` as a fallback revert reason when `target` reverts. - * - * _Available since v3.1._ - */ - function functionCallWithValue( - address target, - bytes memory data, - uint256 value, - string memory errorMessage - ) internal returns (bytes memory) { - require(address(this).balance >= value, "Address: insufficient balance for call"); - return _functionCallWithValue(target, data, value, errorMessage); - } - - function _functionCallWithValue( - address target, - bytes memory data, - uint256 weiValue, - string memory errorMessage - ) private returns (bytes memory) { - require(isContract(target), "Address: call to non-contract"); - - // solhint-disable-next-line avoid-low-level-calls - (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); - if (success) { - return returndata; - } else { - // Look for revert reason and bubble it up if present - if (returndata.length > 0) { - // The easiest way to bubble the revert reason is using memory via assembly - - // solhint-disable-next-line no-inline-assembly - assembly { - let returndata_size := mload(returndata) - revert(add(32, returndata), returndata_size) - } - } else { - revert(errorMessage); - } - } - } -} - -/** - * @dev Interface of the ERC20 standard as defined in the EIP. - */ -interface IERC20 { - /** - * @dev Returns the amount of tokens in existence. - */ - function totalSupply() external view returns (uint256); - - /** - * @dev Returns the amount of tokens owned by `account`. - */ - function balanceOf(address account) external view returns (uint256); - - /** - * @dev Moves `amount` tokens from the caller's account to `recipient`. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ - function transfer(address recipient, uint256 amount) external returns (bool); - - /** - * @dev Returns the remaining number of tokens that `spender` will be - * allowed to spend on behalf of `owner` through {transferFrom}. This is - * zero by default. - * - * This value changes when {approve} or {transferFrom} are called. - */ - function allowance(address owner, address spender) external view returns (uint256); - - /** - * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * IMPORTANT: Beware that changing an allowance with this method brings the risk - * that someone may use both the old and the new allowance by unfortunate - * transaction ordering. One possible solution to mitigate this race - * condition is to first reduce the spender's allowance to 0 and set the - * desired value afterwards: - * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 - * - * Emits an {Approval} event. - */ - function approve(address spender, uint256 amount) external returns (bool); - - /** - * @dev Moves `amount` tokens from `sender` to `recipient` using the - * allowance mechanism. `amount` is then deducted from the caller's - * allowance. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ - function transferFrom( - address sender, - address recipient, - uint256 amount - ) external returns (bool); - - /** - * @dev Emitted when `value` tokens are moved from one account (`from`) to - * another (`to`). - * - * Note that `value` may be zero. - */ - event Transfer(address indexed from, address indexed to, uint256 value); - - /** - * @dev Emitted when the allowance of a `spender` for an `owner` is set by - * a call to {approve}. `value` is the new allowance. - */ - event Approval(address indexed owner, address indexed spender, uint256 value); -} - -/** - * @title SafeERC20 - * @dev Wrappers around ERC20 operations that throw on failure (when the token - * contract returns false). Tokens that return no value (and instead revert or - * throw on failure) are also supported, non-reverting calls are assumed to be - * successful. - * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, - * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. - */ -library SafeERC20 { - using SafeMath for uint256; - using Address for address; - - function safeTransfer( - IERC20 token, - address to, - uint256 value - ) internal { - _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); - } - - function safeTransferFrom( - IERC20 token, - address from, - address to, - uint256 value - ) internal { - _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); - } - - /** - * @dev Deprecated. This function has issues similar to the ones found in - * {IERC20-approve}, and its usage is discouraged. - * - * Whenever possible, use {safeIncreaseAllowance} and - * {safeDecreaseAllowance} instead. - */ - function safeApprove( - IERC20 token, - address spender, - uint256 value - ) internal { - // safeApprove should only be called when setting an initial allowance, - // or when resetting it to zero. To increase and decrease it, use - // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' - // solhint-disable-next-line max-line-length - require( - (value == 0) || (token.allowance(address(this), spender) == 0), - "SafeERC20: approve from non-zero to non-zero allowance" - ); - _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); - } - - function safeIncreaseAllowance( - IERC20 token, - address spender, - uint256 value - ) internal { - uint256 newAllowance = token.allowance(address(this), spender).add(value); - _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); - } - - function safeDecreaseAllowance( - IERC20 token, - address spender, - uint256 value - ) internal { - uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); - _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); - } - - /** - * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement - * on the return value: the return value is optional (but if data is returned, it must not be false). - * @param token The token targeted by the call. - * @param data The call data (encoded using abi.encode or one of its variants). - */ - function _callOptionalReturn(IERC20 token, bytes memory data) private { - // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since - // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that - // the target address contains contract code and also asserts for success in the low-level call. - - bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); - if (returndata.length > 0) { - // Return data is optional - // solhint-disable-next-line max-line-length - require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); - } - } -} - -/** - * @title OwnableModule - * @dev Common functionality for multi-token extension non-upgradeable module. - */ -contract OwnableModule { - address public owner; - - /** - * @dev Initializes this contract. - * @param _owner address of the owner that is allowed to perform additional actions on the particular module. - */ - constructor(address _owner) { - owner = _owner; - } - - /** - * @dev Throws if sender is not the owner of this contract. - */ - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - /** - * @dev Changes the owner of this contract. - * @param _newOwner address of the new owner. - */ - function transferOwnership(address _newOwner) external onlyOwner { - owner = _newOwner; - } -} - -/** - * @title Claimable - * @dev Implementation of the claiming utils that can be useful for withdrawing accidentally sent tokens that are not used in bridge operations. - */ -contract Claimable { - using SafeERC20 for IERC20; - - /** - * Throws if a given address is equal to address(0) - */ - modifier validAddress(address _to) { - require(_to != address(0)); - _; - } - - /** - * @dev Withdraws the erc20 tokens or native coins from this contract. - * Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()). - * @param _token address of the claimed token or address(0) for native coins. - * @param _to address of the tokens/coins receiver. - */ - function claimValues(address _token, address _to) internal validAddress(_to) { - if (_token == address(0)) { - claimNativeCoins(_to); - } else { - claimErc20Tokens(_token, _to); - } - } - - /** - * @dev Internal function for withdrawing all native coins from the contract. - * @param _to address of the coins receiver. - */ - function claimNativeCoins(address _to) internal { - uint256 value = address(this).balance; - AddressHelper.safeSendValue(payable(_to), value); - } - - /** - * @dev Internal function for withdrawing all tokens of ssome particular ERC20 contract from this contract. - * @param _token address of the claimed ERC20 token. - * @param _to address of the tokens receiver. - */ - function claimErc20Tokens(address _token, address _to) internal { - IERC20 token = IERC20(_token); - uint256 balance = token.balanceOf(address(this)); - token.safeTransfer(_to, balance); - } -} - -/** - * @title WETHOmnibridgeRouter - * @dev Omnibridge extension for processing native and wrapped native assets. - * Intended to work with WETH/WBNB/WXDAI tokens, see: - * https://etherscan.io/address/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 - * https://bscscan.com/address/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c - * https://blockscout.com/poa/xdai/address/0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d - */ -contract WETHOmnibridgeRouter is OwnableModule, Claimable { - IOmnibridge public immutable bridge; - IWETH public immutable WETH; - - /** - * @dev Initializes this contract. - * @param _bridge address of the HomeOmnibridge/ForeignOmnibridge contract. - * @param _weth address of the WETH token used for wrapping/unwrapping native coins (e.g. WETH/WBNB/WXDAI). - * @param _owner address of the contract owner. - */ - constructor( - IOmnibridge _bridge, - IWETH _weth, - address _owner - ) OwnableModule(_owner) { - bridge = _bridge; - WETH = _weth; - _weth.approve(address(_bridge), uint256(-1)); - } - - /** - * @dev Wraps native assets and relays wrapped ERC20 tokens to the other chain. - * Call msg.sender will receive assets on the other side of the bridge. - */ - function wrapAndRelayTokens() external payable { - wrapAndRelayTokens(msg.sender); - } - - /** - * @dev Wraps native assets and relays wrapped ERC20 tokens to the other chain. - * @param _receiver bridged assets receiver on the other side of the bridge. - */ - function wrapAndRelayTokens(address _receiver) public payable { - WETH.deposit{ value: msg.value }(); - bridge.relayTokens(address(WETH), _receiver, msg.value); - } - - /** - * @dev Wraps native assets and relays wrapped ERC20 tokens to the other chain. - * It also calls receiver on other side with the _data provided. - * @param _receiver bridged assets receiver on the other side of the bridge. - * @param _data data for the call of receiver on other side. - */ - function wrapAndRelayTokens(address _receiver, bytes memory _data) public payable { - WETH.deposit{ value: msg.value }(); - bridge.relayTokensAndCall(address(WETH), _receiver, msg.value, _data); - } - - /** - * @dev Bridged callback function used for unwrapping received tokens. - * Can only be called by the associated Omnibridge contract. - * @param _token bridged token contract address, should be WETH. - * @param _value amount of bridged/received tokens. - * @param _data extra data passed alongside with relayTokensAndCall on the other side of the bridge. - * Should contain coins receiver address. - */ - function onTokenBridged( - address _token, - uint256 _value, - bytes calldata _data - ) external { - require(_token == address(WETH)); - require(msg.sender == address(bridge)); - require(_data.length == 20); - - WETH.withdraw(_value); - - address payable receiver; - assembly { - receiver := calldataload(120) - } - AddressHelper.safeSendValue(receiver, _value); - } - - /** - * @dev Claims stuck coins/tokens. - * Only contract owner can call this method. - * @param _token address of claimed token contract, address(0) for native coins. - * @param _to address of tokens receiver - */ - function claimTokens(address _token, address _to) external onlyOwner { - claimValues(_token, _to); - } - - /** - * @dev Ether receive function. - * Should be only called from the WETH contract when withdrawing native coins. Will revert otherwise. - */ - receive() external payable { - require(msg.sender == address(WETH)); - } -} diff --git a/contracts/bridge/L1Helper.sol b/contracts/bridge/L1Helper.sol new file mode 100644 index 0000000..5c7e44e --- /dev/null +++ b/contracts/bridge/L1Helper.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.7.0; +pragma abicoder v2; + +import "omnibridge/contracts/helpers/WETHOmnibridgeRouter.sol"; + +contract L1Helper is WETHOmnibridgeRouter { + event PublicKey(address indexed owner, bytes key); + + struct Account { + address owner; + bytes publicKey; + } + + constructor( + IOmnibridge _bridge, + IWETH _weth, + address _owner + ) WETHOmnibridgeRouter(_bridge, _weth, _owner) {} + + function register(Account memory _account) public { + require(_account.owner == msg.sender, "only owner can be registered"); + _register(_account); + } + + function _register(Account memory _account) internal { + emit PublicKey(_account.owner, _account.publicKey); + } + + /** + * @dev Wraps native assets and relays wrapped ERC20 tokens to the other chain. + * It also calls receiver on other side with the _data provided. + * @param _receiver bridged assets receiver on the other side of the bridge. + * @param _data data for the call of receiver on other side. + * @param _account tornadoPool account data + */ + function wrapAndRelayTokens( + address _receiver, + bytes memory _data, + Account memory _account + ) public payable { + WETH.deposit{ value: msg.value }(); + bridge.relayTokensAndCall(address(WETH), _receiver, msg.value, _data); + + if (_account.owner == msg.sender) { + _register(_account); + } + } +} diff --git a/contracts/bridge/bridge.sol.tmp b/contracts/bridge/bridge.sol.tmp deleted file mode 100644 index bcb9d37..0000000 --- a/contracts/bridge/bridge.sol.tmp +++ /dev/null @@ -1,3615 +0,0 @@ -// File: @openzeppelin/contracts/math/SafeMath.sol - -pragma solidity ^0.7.0; - -/** - * @dev Wrappers over Solidity's arithmetic operations with added overflow - * checks. - * - * Arithmetic operations in Solidity wrap on overflow. This can easily result - * in bugs, because programmers usually assume that an overflow raises an - * error, which is the standard behavior in high level programming languages. - * `SafeMath` restores this intuition by reverting the transaction when an - * operation overflows. - * - * Using this library instead of the unchecked operations eliminates an entire - * class of bugs, so it's recommended to use it always. - */ -library SafeMath { - /** - * @dev Returns the addition of two unsigned integers, reverting on - * overflow. - * - * Counterpart to Solidity's `+` operator. - * - * Requirements: - * - * - Addition cannot overflow. - */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; - require(c >= a, "SafeMath: addition overflow"); - - return c; - } - - /** - * @dev Returns the subtraction of two unsigned integers, reverting on - * overflow (when the result is negative). - * - * Counterpart to Solidity's `-` operator. - * - * Requirements: - * - * - Subtraction cannot overflow. - */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - return sub(a, b, "SafeMath: subtraction overflow"); - } - - /** - * @dev Returns the subtraction of two unsigned integers, reverting with custom message on - * overflow (when the result is negative). - * - * Counterpart to Solidity's `-` operator. - * - * Requirements: - * - * - Subtraction cannot overflow. - */ - function sub( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { - require(b <= a, errorMessage); - uint256 c = a - b; - - return c; - } - - /** - * @dev Returns the multiplication of two unsigned integers, reverting on - * overflow. - * - * Counterpart to Solidity's `*` operator. - * - * Requirements: - * - * - Multiplication cannot overflow. - */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { - // Gas optimization: this is cheaper than requiring 'a' not being zero, but the - // benefit is lost if 'b' is also tested. - // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 - if (a == 0) { - return 0; - } - - uint256 c = a * b; - require(c / a == b, "SafeMath: multiplication overflow"); - - return c; - } - - /** - * @dev Returns the integer division of two unsigned integers. Reverts on - * division by zero. The result is rounded towards zero. - * - * Counterpart to Solidity's `/` operator. Note: this function uses a - * `revert` opcode (which leaves remaining gas untouched) while Solidity - * uses an invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { - return div(a, b, "SafeMath: division by zero"); - } - - /** - * @dev Returns the integer division of two unsigned integers. Reverts with custom message on - * division by zero. The result is rounded towards zero. - * - * Counterpart to Solidity's `/` operator. Note: this function uses a - * `revert` opcode (which leaves remaining gas untouched) while Solidity - * uses an invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function div( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { - require(b > 0, errorMessage); - uint256 c = a / b; - // assert(a == b * c + a % b); // There is no case in which this doesn't hold - - return c; - } - - /** - * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), - * Reverts when dividing by zero. - * - * Counterpart to Solidity's `%` operator. This function uses a `revert` - * opcode (which leaves remaining gas untouched) while Solidity uses an - * invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function mod(uint256 a, uint256 b) internal pure returns (uint256) { - return mod(a, b, "SafeMath: modulo by zero"); - } - - /** - * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), - * Reverts with custom message when dividing by zero. - * - * Counterpart to Solidity's `%` operator. This function uses a `revert` - * opcode (which leaves remaining gas untouched) while Solidity uses an - * invalid opcode to revert (consuming all remaining gas). - * - * Requirements: - * - * - The divisor cannot be zero. - */ - function mod( - uint256 a, - uint256 b, - string memory errorMessage - ) internal pure returns (uint256) { - require(b != 0, errorMessage); - return a % b; - } -} - -// File: contracts/upgradeability/EternalStorage.sol - -pragma solidity 0.7.5; - -/** - * @title EternalStorage - * @dev This contract holds all the necessary state variables to carry out the storage of any contract. - */ -contract EternalStorage { - mapping(bytes32 => uint256) internal uintStorage; - mapping(bytes32 => string) internal stringStorage; - mapping(bytes32 => address) internal addressStorage; - mapping(bytes32 => bytes) internal bytesStorage; - mapping(bytes32 => bool) internal boolStorage; - mapping(bytes32 => int256) internal intStorage; -} - -// File: contracts/upgradeable_contracts/Initializable.sol - -pragma solidity 0.7.5; - -contract Initializable is EternalStorage { - bytes32 internal constant INITIALIZED = 0x0a6f646cd611241d8073675e00d1a1ff700fbf1b53fcf473de56d1e6e4b714ba; // keccak256(abi.encodePacked("isInitialized")) - - function setInitialize() internal { - boolStorage[INITIALIZED] = true; - } - - function isInitialized() public view returns (bool) { - return boolStorage[INITIALIZED]; - } -} - -// File: contracts/interfaces/IUpgradeabilityOwnerStorage.sol - -pragma solidity 0.7.5; - -interface IUpgradeabilityOwnerStorage { - function upgradeabilityOwner() external view returns (address); -} - -// File: contracts/upgradeable_contracts/Upgradeable.sol - -pragma solidity 0.7.5; - -contract Upgradeable { - // Avoid using onlyUpgradeabilityOwner name to prevent issues with implementation from proxy contract - modifier onlyIfUpgradeabilityOwner() { - require(msg.sender == IUpgradeabilityOwnerStorage(address(this)).upgradeabilityOwner()); - _; - } -} - -// File: @openzeppelin/contracts/token/ERC20/IERC20.sol - -pragma solidity ^0.7.0; - -/** - * @dev Interface of the ERC20 standard as defined in the EIP. - */ -interface IERC20 { - /** - * @dev Returns the amount of tokens in existence. - */ - function totalSupply() external view returns (uint256); - - /** - * @dev Returns the amount of tokens owned by `account`. - */ - function balanceOf(address account) external view returns (uint256); - - /** - * @dev Moves `amount` tokens from the caller's account to `recipient`. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ - function transfer(address recipient, uint256 amount) external returns (bool); - - /** - * @dev Returns the remaining number of tokens that `spender` will be - * allowed to spend on behalf of `owner` through {transferFrom}. This is - * zero by default. - * - * This value changes when {approve} or {transferFrom} are called. - */ - function allowance(address owner, address spender) external view returns (uint256); - - /** - * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * IMPORTANT: Beware that changing an allowance with this method brings the risk - * that someone may use both the old and the new allowance by unfortunate - * transaction ordering. One possible solution to mitigate this race - * condition is to first reduce the spender's allowance to 0 and set the - * desired value afterwards: - * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 - * - * Emits an {Approval} event. - */ - function approve(address spender, uint256 amount) external returns (bool); - - /** - * @dev Moves `amount` tokens from `sender` to `recipient` using the - * allowance mechanism. `amount` is then deducted from the caller's - * allowance. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ - function transferFrom( - address sender, - address recipient, - uint256 amount - ) external returns (bool); - - /** - * @dev Emitted when `value` tokens are moved from one account (`from`) to - * another (`to`). - * - * Note that `value` may be zero. - */ - event Transfer(address indexed from, address indexed to, uint256 value); - - /** - * @dev Emitted when the allowance of a `spender` for an `owner` is set by - * a call to {approve}. `value` is the new allowance. - */ - event Approval(address indexed owner, address indexed spender, uint256 value); -} - -// File: @openzeppelin/contracts/utils/Address.sol - -pragma solidity ^0.7.0; - -/** - * @dev Collection of functions related to the address type - */ -library Address { - /** - * @dev Returns true if `account` is a contract. - * - * [IMPORTANT] - * ==== - * It is unsafe to assume that an address for which this function returns - * false is an externally-owned account (EOA) and not a contract. - * - * Among others, `isContract` will return false for the following - * types of addresses: - * - * - an externally-owned account - * - a contract in construction - * - an address where a contract will be created - * - an address where a contract lived, but was destroyed - * ==== - */ - function isContract(address account) internal view returns (bool) { - // According to EIP-1052, 0x0 is the value returned for not-yet created accounts - // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned - // for accounts without code, i.e. `keccak256('')` - bytes32 codehash; - bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; - // solhint-disable-next-line no-inline-assembly - assembly { - codehash := extcodehash(account) - } - return (codehash != accountHash && codehash != 0x0); - } - - /** - * @dev Replacement for Solidity's `transfer`: sends `amount` wei to - * `recipient`, forwarding all available gas and reverting on errors. - * - * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost - * of certain opcodes, possibly making contracts go over the 2300 gas limit - * imposed by `transfer`, making them unable to receive funds via - * `transfer`. {sendValue} removes this limitation. - * - * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. - * - * IMPORTANT: because control is transferred to `recipient`, care must be - * taken to not create reentrancy vulnerabilities. Consider using - * {ReentrancyGuard} or the - * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. - */ - function sendValue(address payable recipient, uint256 amount) internal { - require(address(this).balance >= amount, "Address: insufficient balance"); - - // solhint-disable-next-line avoid-low-level-calls, avoid-call-value - (bool success, ) = recipient.call{ value: amount }(""); - require(success, "Address: unable to send value, recipient may have reverted"); - } - - /** - * @dev Performs a Solidity function call using a low level `call`. A - * plain`call` is an unsafe replacement for a function call: use this - * function instead. - * - * If `target` reverts with a revert reason, it is bubbled up by this - * function (like regular Solidity function calls). - * - * Returns the raw returned data. To convert to the expected return value, - * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. - * - * Requirements: - * - * - `target` must be a contract. - * - calling `target` with `data` must not revert. - * - * _Available since v3.1._ - */ - function functionCall(address target, bytes memory data) internal returns (bytes memory) { - return functionCall(target, data, "Address: low-level call failed"); - } - - /** - * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with - * `errorMessage` as a fallback revert reason when `target` reverts. - * - * _Available since v3.1._ - */ - function functionCall( - address target, - bytes memory data, - string memory errorMessage - ) internal returns (bytes memory) { - return _functionCallWithValue(target, data, 0, errorMessage); - } - - /** - * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], - * but also transferring `value` wei to `target`. - * - * Requirements: - * - * - the calling contract must have an ETH balance of at least `value`. - * - the called Solidity function must be `payable`. - * - * _Available since v3.1._ - */ - function functionCallWithValue( - address target, - bytes memory data, - uint256 value - ) internal returns (bytes memory) { - return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); - } - - /** - * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but - * with `errorMessage` as a fallback revert reason when `target` reverts. - * - * _Available since v3.1._ - */ - function functionCallWithValue( - address target, - bytes memory data, - uint256 value, - string memory errorMessage - ) internal returns (bytes memory) { - require(address(this).balance >= value, "Address: insufficient balance for call"); - return _functionCallWithValue(target, data, value, errorMessage); - } - - function _functionCallWithValue( - address target, - bytes memory data, - uint256 weiValue, - string memory errorMessage - ) private returns (bytes memory) { - require(isContract(target), "Address: call to non-contract"); - - // solhint-disable-next-line avoid-low-level-calls - (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); - if (success) { - return returndata; - } else { - // Look for revert reason and bubble it up if present - if (returndata.length > 0) { - // The easiest way to bubble the revert reason is using memory via assembly - - // solhint-disable-next-line no-inline-assembly - assembly { - let returndata_size := mload(returndata) - revert(add(32, returndata), returndata_size) - } - } else { - revert(errorMessage); - } - } - } -} - -// File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol - -pragma solidity ^0.7.0; - -/** - * @title SafeERC20 - * @dev Wrappers around ERC20 operations that throw on failure (when the token - * contract returns false). Tokens that return no value (and instead revert or - * throw on failure) are also supported, non-reverting calls are assumed to be - * successful. - * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, - * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. - */ -library SafeERC20 { - using SafeMath for uint256; - using Address for address; - - function safeTransfer( - IERC20 token, - address to, - uint256 value - ) internal { - _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); - } - - function safeTransferFrom( - IERC20 token, - address from, - address to, - uint256 value - ) internal { - _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); - } - - /** - * @dev Deprecated. This function has issues similar to the ones found in - * {IERC20-approve}, and its usage is discouraged. - * - * Whenever possible, use {safeIncreaseAllowance} and - * {safeDecreaseAllowance} instead. - */ - function safeApprove( - IERC20 token, - address spender, - uint256 value - ) internal { - // safeApprove should only be called when setting an initial allowance, - // or when resetting it to zero. To increase and decrease it, use - // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' - // solhint-disable-next-line max-line-length - require( - (value == 0) || (token.allowance(address(this), spender) == 0), - "SafeERC20: approve from non-zero to non-zero allowance" - ); - _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); - } - - function safeIncreaseAllowance( - IERC20 token, - address spender, - uint256 value - ) internal { - uint256 newAllowance = token.allowance(address(this), spender).add(value); - _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); - } - - function safeDecreaseAllowance( - IERC20 token, - address spender, - uint256 value - ) internal { - uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); - _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); - } - - /** - * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement - * on the return value: the return value is optional (but if data is returned, it must not be false). - * @param token The token targeted by the call. - * @param data The call data (encoded using abi.encode or one of its variants). - */ - function _callOptionalReturn(IERC20 token, bytes memory data) private { - // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since - // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that - // the target address contains contract code and also asserts for success in the low-level call. - - bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); - if (returndata.length > 0) { - // Return data is optional - // solhint-disable-next-line max-line-length - require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); - } - } -} - -// File: contracts/upgradeable_contracts/Sacrifice.sol - -pragma solidity 0.7.5; - -contract Sacrifice { - constructor(address payable _recipient) payable { - selfdestruct(_recipient); - } -} - -// File: contracts/libraries/AddressHelper.sol - -pragma solidity 0.7.5; - -/** - * @title AddressHelper - * @dev Helper methods for Address type. - */ -library AddressHelper { - /** - * @dev Try to send native tokens to the address. If it fails, it will force the transfer by creating a selfdestruct contract - * @param _receiver address that will receive the native tokens - * @param _value the amount of native tokens to send - */ - function safeSendValue(address payable _receiver, uint256 _value) internal { - if (!(_receiver).send(_value)) { - new Sacrifice{ value: _value }(_receiver); - } - } -} - -// File: contracts/upgradeable_contracts/Claimable.sol - -pragma solidity 0.7.5; - -/** - * @title Claimable - * @dev Implementation of the claiming utils that can be useful for withdrawing accidentally sent tokens that are not used in bridge operations. - */ -contract Claimable { - using SafeERC20 for IERC20; - - /** - * Throws if a given address is equal to address(0) - */ - modifier validAddress(address _to) { - require(_to != address(0)); - _; - } - - /** - * @dev Withdraws the erc20 tokens or native coins from this contract. - * Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()). - * @param _token address of the claimed token or address(0) for native coins. - * @param _to address of the tokens/coins receiver. - */ - function claimValues(address _token, address _to) internal validAddress(_to) { - if (_token == address(0)) { - claimNativeCoins(_to); - } else { - claimErc20Tokens(_token, _to); - } - } - - /** - * @dev Internal function for withdrawing all native coins from the contract. - * @param _to address of the coins receiver. - */ - function claimNativeCoins(address _to) internal { - uint256 value = address(this).balance; - AddressHelper.safeSendValue(payable(_to), value); - } - - /** - * @dev Internal function for withdrawing all tokens of some particular ERC20 contract from this contract. - * @param _token address of the claimed ERC20 token. - * @param _to address of the tokens receiver. - */ - function claimErc20Tokens(address _token, address _to) internal { - IERC20 token = IERC20(_token); - uint256 balance = token.balanceOf(address(this)); - token.safeTransfer(_to, balance); - } -} - -// File: contracts/upgradeable_contracts/components/bridged/BridgedTokensRegistry.sol - -pragma solidity 0.7.5; - -/** - * @title BridgedTokensRegistry - * @dev Functionality for keeping track of registered bridged token pairs. - */ -contract BridgedTokensRegistry is EternalStorage { - event NewTokenRegistered(address indexed nativeToken, address indexed bridgedToken); - - /** - * @dev Retrieves address of the bridged token contract associated with a specific native token contract on the other side. - * @param _nativeToken address of the native token contract on the other side. - * @return address of the deployed bridged token contract. - */ - function bridgedTokenAddress(address _nativeToken) public view returns (address) { - return addressStorage[keccak256(abi.encodePacked("homeTokenAddress", _nativeToken))]; - } - - /** - * @dev Retrieves address of the native token contract associated with a specific bridged token contract. - * @param _bridgedToken address of the created bridged token contract on this side. - * @return address of the native token contract on the other side of the bridge. - */ - function nativeTokenAddress(address _bridgedToken) public view returns (address) { - return addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", _bridgedToken))]; - } - - /** - * @dev Internal function for updating a pair of addresses for the bridged token. - * @param _nativeToken address of the native token contract on the other side. - * @param _bridgedToken address of the created bridged token contract on this side. - */ - function _setTokenAddressPair(address _nativeToken, address _bridgedToken) internal { - addressStorage[keccak256(abi.encodePacked("homeTokenAddress", _nativeToken))] = _bridgedToken; - addressStorage[keccak256(abi.encodePacked("foreignTokenAddress", _bridgedToken))] = _nativeToken; - - emit NewTokenRegistered(_nativeToken, _bridgedToken); - } -} - -// File: contracts/upgradeable_contracts/components/native/NativeTokensRegistry.sol - -pragma solidity 0.7.5; - -/** - * @title NativeTokensRegistry - * @dev Functionality for keeping track of registered native tokens. - */ -contract NativeTokensRegistry is EternalStorage { - /** - * @dev Checks if for a given native token, the deployment of its bridged alternative was already acknowledged. - * @param _token address of native token contract. - * @return true, if bridged token was already deployed. - */ - function isBridgedTokenDeployAcknowledged(address _token) public view returns (bool) { - return boolStorage[keccak256(abi.encodePacked("ackDeploy", _token))]; - } - - /** - * @dev Acknowledges the deployment of bridged token contract on the other side. - * @param _token address of native token contract. - */ - function _ackBridgedTokenDeploy(address _token) internal { - if (!boolStorage[keccak256(abi.encodePacked("ackDeploy", _token))]) { - boolStorage[keccak256(abi.encodePacked("ackDeploy", _token))] = true; - } - } -} - -// File: contracts/upgradeable_contracts/components/native/MediatorBalanceStorage.sol - -pragma solidity 0.7.5; - -/** - * @title MediatorBalanceStorage - * @dev Functionality for storing expected mediator balance for native tokens. - */ -contract MediatorBalanceStorage is EternalStorage { - /** - * @dev Tells the expected token balance of the contract. - * @param _token address of token contract. - * @return the current tracked token balance of the contract. - */ - function mediatorBalance(address _token) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("mediatorBalance", _token))]; - } - - /** - * @dev Updates expected token balance of the contract. - * @param _token address of token contract. - * @param _balance the new token balance of the contract. - */ - function _setMediatorBalance(address _token, uint256 _balance) internal { - uintStorage[keccak256(abi.encodePacked("mediatorBalance", _token))] = _balance; - } -} - -// File: contracts/interfaces/IERC677.sol - -pragma solidity 0.7.5; - -interface IERC677 is IERC20 { - event Transfer(address indexed from, address indexed to, uint256 value, bytes data); - - function transferAndCall( - address to, - uint256 value, - bytes calldata data - ) external returns (bool); - - function increaseAllowance(address spender, uint256 addedValue) external returns (bool); - - function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); -} - -// File: contracts/libraries/Bytes.sol - -pragma solidity 0.7.5; - -/** - * @title Bytes - * @dev Helper methods to transform bytes to other solidity types. - */ -library Bytes { - /** - * @dev Truncate bytes array if its size is more than 20 bytes. - * NOTE: This function does not perform any checks on the received parameter. - * Make sure that the _bytes argument has a correct length, not less than 20 bytes. - * A case when _bytes has length less than 20 will lead to the undefined behaviour, - * since assembly will read data from memory that is not related to the _bytes argument. - * @param _bytes to be converted to address type - * @return addr address included in the firsts 20 bytes of the bytes array in parameter. - */ - function bytesToAddress(bytes memory _bytes) internal pure returns (address addr) { - assembly { - addr := mload(add(_bytes, 20)) - } - } -} - -// File: contracts/upgradeable_contracts/ReentrancyGuard.sol - -pragma solidity 0.7.5; - -contract ReentrancyGuard { - function lock() internal view returns (bool res) { - assembly { - // Even though this is not the same as boolStorage[keccak256(abi.encodePacked("lock"))], - // since solidity mapping introduces another level of addressing, such slot change is safe - // for temporary variables which are cleared at the end of the call execution. - res := sload(0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92) // keccak256(abi.encodePacked("lock")) - } - } - - function setLock(bool _lock) internal { - assembly { - // Even though this is not the same as boolStorage[keccak256(abi.encodePacked("lock"))], - // since solidity mapping introduces another level of addressing, such slot change is safe - // for temporary variables which are cleared at the end of the call execution. - sstore(0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92, _lock) // keccak256(abi.encodePacked("lock")) - } - } -} - -// File: contracts/upgradeable_contracts/Ownable.sol - -pragma solidity 0.7.5; - -/** - * @title Ownable - * @dev This contract has an owner address providing basic authorization control - */ -contract Ownable is EternalStorage { - bytes4 internal constant UPGRADEABILITY_OWNER = 0x6fde8202; // upgradeabilityOwner() - - /** - * @dev Event to show ownership has been transferred - * @param previousOwner representing the address of the previous owner - * @param newOwner representing the address of the new owner - */ - event OwnershipTransferred(address previousOwner, address newOwner); - - /** - * @dev Throws if called by any account other than the owner. - */ - modifier onlyOwner() { - _onlyOwner(); - _; - } - - /** - * @dev Internal function for reducing onlyOwner modifier bytecode overhead. - */ - function _onlyOwner() internal view { - require(msg.sender == owner()); - } - - /** - * @dev Throws if called through proxy by any account other than contract itself or an upgradeability owner. - */ - modifier onlyRelevantSender() { - (bool isProxy, bytes memory returnData) = address(this).staticcall(abi.encodeWithSelector(UPGRADEABILITY_OWNER)); - require( - !isProxy || // covers usage without calling through storage proxy - (returnData.length == 32 && msg.sender == abi.decode(returnData, (address))) || // covers usage through regular proxy calls - msg.sender == address(this) // covers calls through upgradeAndCall proxy method - ); - _; - } - - bytes32 internal constant OWNER = 0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0; // keccak256(abi.encodePacked("owner")) - - /** - * @dev Tells the address of the owner - * @return the address of the owner - */ - function owner() public view returns (address) { - return addressStorage[OWNER]; - } - - /** - * @dev Allows the current owner to transfer control of the contract to a newOwner. - * @param newOwner the address to transfer ownership to. - */ - function transferOwnership(address newOwner) external onlyOwner { - _setOwner(newOwner); - } - - /** - * @dev Sets a new owner address - */ - function _setOwner(address newOwner) internal { - require(newOwner != address(0)); - emit OwnershipTransferred(owner(), newOwner); - addressStorage[OWNER] = newOwner; - } -} - -// File: contracts/interfaces/IAMB.sol - -pragma solidity 0.7.5; - -interface IAMB { - event UserRequestForAffirmation(bytes32 indexed messageId, bytes encodedData); - event UserRequestForSignature(bytes32 indexed messageId, bytes encodedData); - event AffirmationCompleted(address indexed sender, address indexed executor, bytes32 indexed messageId, bool status); - event RelayedMessage(address indexed sender, address indexed executor, bytes32 indexed messageId, bool status); - - function messageSender() external view returns (address); - - function maxGasPerTx() external view returns (uint256); - - function transactionHash() external view returns (bytes32); - - function messageId() external view returns (bytes32); - - function messageSourceChainId() external view returns (bytes32); - - function messageCallStatus(bytes32 _messageId) external view returns (bool); - - function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32); - - function failedMessageReceiver(bytes32 _messageId) external view returns (address); - - function failedMessageSender(bytes32 _messageId) external view returns (address); - - function requireToPassMessage( - address _contract, - bytes calldata _data, - uint256 _gas - ) external returns (bytes32); - - function requireToConfirmMessage( - address _contract, - bytes calldata _data, - uint256 _gas - ) external returns (bytes32); - - function sourceChainId() external view returns (uint256); - - function destinationChainId() external view returns (uint256); -} - -// File: contracts/upgradeable_contracts/BasicAMBMediator.sol - -pragma solidity 0.7.5; - -/** - * @title BasicAMBMediator - * @dev Basic storage and methods needed by mediators to interact with AMB bridge. - */ -abstract contract BasicAMBMediator is Ownable { - bytes32 internal constant BRIDGE_CONTRACT = 0x811bbb11e8899da471f0e69a3ed55090fc90215227fc5fb1cb0d6e962ea7b74f; // keccak256(abi.encodePacked("bridgeContract")) - bytes32 internal constant MEDIATOR_CONTRACT = 0x98aa806e31e94a687a31c65769cb99670064dd7f5a87526da075c5fb4eab9880; // keccak256(abi.encodePacked("mediatorContract")) - - /** - * @dev Throws if caller on the other side is not an associated mediator. - */ - modifier onlyMediator() { - _onlyMediator(); - _; - } - - /** - * @dev Internal function for reducing onlyMediator modifier bytecode overhead. - */ - function _onlyMediator() internal view { - IAMB bridge = bridgeContract(); - require(msg.sender == address(bridge)); - require(bridge.messageSender() == mediatorContractOnOtherSide()); - } - - /** - * @dev Sets the AMB bridge contract address. Only the owner can call this method. - * @param _bridgeContract the address of the bridge contract. - */ - function setBridgeContract(address _bridgeContract) external onlyOwner { - _setBridgeContract(_bridgeContract); - } - - /** - * @dev Sets the mediator contract address from the other network. Only the owner can call this method. - * @param _mediatorContract the address of the mediator contract. - */ - function setMediatorContractOnOtherSide(address _mediatorContract) external onlyOwner { - _setMediatorContractOnOtherSide(_mediatorContract); - } - - /** - * @dev Get the AMB interface for the bridge contract address - * @return AMB interface for the bridge contract address - */ - function bridgeContract() public view returns (IAMB) { - return IAMB(addressStorage[BRIDGE_CONTRACT]); - } - - /** - * @dev Tells the mediator contract address from the other network. - * @return the address of the mediator contract. - */ - function mediatorContractOnOtherSide() public view virtual returns (address) { - return addressStorage[MEDIATOR_CONTRACT]; - } - - /** - * @dev Stores a valid AMB bridge contract address. - * @param _bridgeContract the address of the bridge contract. - */ - function _setBridgeContract(address _bridgeContract) internal { - require(Address.isContract(_bridgeContract)); - addressStorage[BRIDGE_CONTRACT] = _bridgeContract; - } - - /** - * @dev Stores the mediator contract address from the other network. - * @param _mediatorContract the address of the mediator contract. - */ - function _setMediatorContractOnOtherSide(address _mediatorContract) internal { - addressStorage[MEDIATOR_CONTRACT] = _mediatorContract; - } - - /** - * @dev Tells the id of the message originated on the other network. - * @return the id of the message originated on the other network. - */ - function messageId() internal view returns (bytes32) { - return bridgeContract().messageId(); - } - - /** - * @dev Tells the maximum gas limit that a message can use on its execution by the AMB bridge on the other network. - * @return the maximum gas limit value. - */ - function maxGasPerTx() internal view returns (uint256) { - return bridgeContract().maxGasPerTx(); - } - - function _passMessage(bytes memory _data, bool _useOracleLane) internal virtual returns (bytes32); -} - -// File: contracts/upgradeable_contracts/components/common/TokensRelayer.sol - -pragma solidity 0.7.5; - -/** - * @title TokensRelayer - * @dev Functionality for bridging multiple tokens to the other side of the bridge. - */ -abstract contract TokensRelayer is BasicAMBMediator, ReentrancyGuard { - using SafeMath for uint256; - using SafeERC20 for IERC677; - - /** - * @dev ERC677 transfer callback function. - * @param _from address of tokens sender. - * @param _value amount of transferred tokens. - * @param _data additional transfer data, can be used for passing alternative receiver address. - */ - function onTokenTransfer( - address _from, - uint256 _value, - bytes memory _data - ) external returns (bool) { - if (!lock()) { - bytes memory data = new bytes(0); - address receiver = _from; - if (_data.length >= 20) { - receiver = Bytes.bytesToAddress(_data); - if (_data.length > 20) { - assembly { - let size := sub(mload(_data), 20) - data := add(_data, 20) - mstore(data, size) - } - } - } - bridgeSpecificActionsOnTokenTransfer(msg.sender, _from, receiver, _value, data); - } - return true; - } - - /** - * @dev Initiate the bridge operation for some amount of tokens from msg.sender. - * The user should first call Approve method of the ERC677 token. - * @param token bridged token contract address. - * @param _receiver address that will receive the native tokens on the other network. - * @param _value amount of tokens to be transferred to the other network. - */ - function relayTokens( - IERC677 token, - address _receiver, - uint256 _value - ) external { - _relayTokens(token, _receiver, _value, new bytes(0)); - } - - /** - * @dev Initiate the bridge operation for some amount of tokens from msg.sender to msg.sender on the other side. - * The user should first call Approve method of the ERC677 token. - * @param token bridged token contract address. - * @param _value amount of tokens to be transferred to the other network. - */ - function relayTokens(IERC677 token, uint256 _value) external { - _relayTokens(token, msg.sender, _value, new bytes(0)); - } - - /** - * @dev Initiate the bridge operation for some amount of tokens from msg.sender. - * The user should first call Approve method of the ERC677 token. - * @param token bridged token contract address. - * @param _receiver address that will receive the native tokens on the other network. - * @param _value amount of tokens to be transferred to the other network. - * @param _data additional transfer data to be used on the other side. - */ - function relayTokensAndCall( - IERC677 token, - address _receiver, - uint256 _value, - bytes memory _data - ) external { - _relayTokens(token, _receiver, _value, _data); - } - - /** - * @dev Validates that the token amount is inside the limits, calls transferFrom to transfer the tokens to the contract - * and invokes the method to burn/lock the tokens and unlock/mint the tokens on the other network. - * The user should first call Approve method of the ERC677 token. - * @param token bridge token contract address. - * @param _receiver address that will receive the native tokens on the other network. - * @param _value amount of tokens to be transferred to the other network. - * @param _data additional transfer data to be used on the other side. - */ - function _relayTokens( - IERC677 token, - address _receiver, - uint256 _value, - bytes memory _data - ) internal { - // This lock is to prevent calling passMessage twice if a ERC677 token is used. - // When transferFrom is called, after the transfer, the ERC677 token will call onTokenTransfer from this contract - // which will call passMessage. - require(!lock()); - - uint256 balanceBefore = token.balanceOf(address(this)); - setLock(true); - token.safeTransferFrom(msg.sender, address(this), _value); - setLock(false); - uint256 balanceDiff = token.balanceOf(address(this)).sub(balanceBefore); - require(balanceDiff <= _value); - bridgeSpecificActionsOnTokenTransfer(address(token), msg.sender, _receiver, balanceDiff, _data); - } - - function bridgeSpecificActionsOnTokenTransfer( - address _token, - address _from, - address _receiver, - uint256 _value, - bytes memory _data - ) internal virtual; -} - -// File: contracts/upgradeable_contracts/VersionableBridge.sol - -pragma solidity 0.7.5; - -interface VersionableBridge { - function getBridgeInterfacesVersion() - external - pure - returns ( - uint64 major, - uint64 minor, - uint64 patch - ); - - function getBridgeMode() external pure returns (bytes4); -} - -// File: contracts/upgradeable_contracts/components/common/OmnibridgeInfo.sol - -pragma solidity 0.7.5; - -/** - * @title OmnibridgeInfo - * @dev Functionality for versioning Omnibridge mediator. - */ -contract OmnibridgeInfo is VersionableBridge { - event TokensBridgingInitiated(address indexed token, address indexed sender, uint256 value, bytes32 indexed messageId); - event TokensBridged(address indexed token, address indexed recipient, uint256 value, bytes32 indexed messageId); - - /** - * @dev Tells the bridge interface version that this contract supports. - * @return major value of the version - * @return minor value of the version - * @return patch value of the version - */ - function getBridgeInterfacesVersion() - external - pure - override - returns ( - uint64 major, - uint64 minor, - uint64 patch - ) - { - // The patch version increased by 1 to reflect differences from - // the original contract: token minter for STAKE token is disabled, - // _isOracleDrivenLaneAllowed modified - return (3, 0, 3); - } - - /** - * @dev Tells the bridge mode that this contract supports. - * @return _data 4 bytes representing the bridge mode - */ - function getBridgeMode() external pure override returns (bytes4 _data) { - return 0xb1516c26; // bytes4(keccak256(abi.encodePacked("multi-erc-to-erc-amb"))) - } -} - -// File: contracts/upgradeable_contracts/components/common/TokensBridgeLimits.sol - -pragma solidity 0.7.5; - -/** - * @title TokensBridgeLimits - * @dev Functionality for keeping track of bridging limits for multiple tokens. - */ -contract TokensBridgeLimits is EternalStorage, Ownable { - using SafeMath for uint256; - - // token == 0x00..00 represents default limits (assuming decimals == 18) for all newly created tokens - event DailyLimitChanged(address indexed token, uint256 newLimit); - event ExecutionDailyLimitChanged(address indexed token, uint256 newLimit); - - /** - * @dev Checks if specified token was already bridged at least once. - * @param _token address of the token contract. - * @return true, if token address is address(0) or token was already bridged. - */ - function isTokenRegistered(address _token) public view returns (bool) { - return minPerTx(_token) > 0; - } - - /** - * @dev Retrieves the total spent amount for particular token during specific day. - * @param _token address of the token contract. - * @param _day day number for which spent amount if requested. - * @return amount of tokens sent through the bridge to the other side. - */ - function totalSpentPerDay(address _token, uint256 _day) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _token, _day))]; - } - - /** - * @dev Retrieves the total executed amount for particular token during specific day. - * @param _token address of the token contract. - * @param _day day number for which spent amount if requested. - * @return amount of tokens received from the bridge from the other side. - */ - function totalExecutedPerDay(address _token, uint256 _day) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))]; - } - - /** - * @dev Retrieves current daily limit for a particular token contract. - * @param _token address of the token contract. - * @return daily limit on tokens that can be sent through the bridge per day. - */ - function dailyLimit(address _token) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))]; - } - - /** - * @dev Retrieves current execution daily limit for a particular token contract. - * @param _token address of the token contract. - * @return daily limit on tokens that can be received from the bridge on the other side per day. - */ - function executionDailyLimit(address _token) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))]; - } - - /** - * @dev Retrieves current maximum amount of tokens per one transfer for a particular token contract. - * @param _token address of the token contract. - * @return maximum amount on tokens that can be sent through the bridge in one transfer. - */ - function maxPerTx(address _token) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))]; - } - - /** - * @dev Retrieves current maximum execution amount of tokens per one transfer for a particular token contract. - * @param _token address of the token contract. - * @return maximum amount on tokens that can received from the bridge on the other side in one transaction. - */ - function executionMaxPerTx(address _token) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))]; - } - - /** - * @dev Retrieves current minimum amount of tokens per one transfer for a particular token contract. - * @param _token address of the token contract. - * @return minimum amount on tokens that can be sent through the bridge in one transfer. - */ - function minPerTx(address _token) public view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("minPerTx", _token))]; - } - - /** - * @dev Checks that bridged amount of tokens conforms to the configured limits. - * @param _token address of the token contract. - * @param _amount amount of bridge tokens. - * @return true, if specified amount can be bridged. - */ - function withinLimit(address _token, uint256 _amount) public view returns (bool) { - uint256 nextLimit = totalSpentPerDay(_token, getCurrentDay()).add(_amount); - return - dailyLimit(address(0)) > 0 && dailyLimit(_token) >= nextLimit && _amount <= maxPerTx(_token) && _amount >= minPerTx(_token); - } - - /** - * @dev Checks that bridged amount of tokens conforms to the configured execution limits. - * @param _token address of the token contract. - * @param _amount amount of bridge tokens. - * @return true, if specified amount can be processed and executed. - */ - function withinExecutionLimit(address _token, uint256 _amount) public view returns (bool) { - uint256 nextLimit = totalExecutedPerDay(_token, getCurrentDay()).add(_amount); - return - executionDailyLimit(address(0)) > 0 && executionDailyLimit(_token) >= nextLimit && _amount <= executionMaxPerTx(_token); - } - - /** - * @dev Returns current day number. - * @return day number. - */ - function getCurrentDay() public view returns (uint256) { - // solhint-disable-next-line not-rely-on-time - return block.timestamp / 1 days; - } - - /** - * @dev Updates daily limit for the particular token. Only owner can call this method. - * @param _token address of the token contract, or address(0) for configuring the efault limit. - * @param _dailyLimit daily allowed amount of bridged tokens, should be greater than maxPerTx. - * 0 value is also allowed, will stop the bridge operations in outgoing direction. - */ - function setDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner { - require(isTokenRegistered(_token)); - require(_dailyLimit > maxPerTx(_token) || _dailyLimit == 0); - uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))] = _dailyLimit; - emit DailyLimitChanged(_token, _dailyLimit); - } - - /** - * @dev Updates execution daily limit for the particular token. Only owner can call this method. - * @param _token address of the token contract, or address(0) for configuring the default limit. - * @param _dailyLimit daily allowed amount of executed tokens, should be greater than executionMaxPerTx. - * 0 value is also allowed, will stop the bridge operations in incoming direction. - */ - function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner { - require(isTokenRegistered(_token)); - require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0); - uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit; - emit ExecutionDailyLimitChanged(_token, _dailyLimit); - } - - /** - * @dev Updates execution maximum per transaction for the particular token. Only owner can call this method. - * @param _token address of the token contract, or address(0) for configuring the default limit. - * @param _maxPerTx maximum amount of executed tokens per one transaction, should be less than executionDailyLimit. - * 0 value is also allowed, will stop the bridge operations in incoming direction. - */ - function setExecutionMaxPerTx(address _token, uint256 _maxPerTx) external onlyOwner { - require(isTokenRegistered(_token)); - require(_maxPerTx == 0 || (_maxPerTx > 0 && _maxPerTx < executionDailyLimit(_token))); - uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))] = _maxPerTx; - } - - /** - * @dev Updates maximum per transaction for the particular token. Only owner can call this method. - * @param _token address of the token contract, or address(0) for configuring the default limit. - * @param _maxPerTx maximum amount of tokens per one transaction, should be less than dailyLimit, greater than minPerTx. - * 0 value is also allowed, will stop the bridge operations in outgoing direction. - */ - function setMaxPerTx(address _token, uint256 _maxPerTx) external onlyOwner { - require(isTokenRegistered(_token)); - require(_maxPerTx == 0 || (_maxPerTx > minPerTx(_token) && _maxPerTx < dailyLimit(_token))); - uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))] = _maxPerTx; - } - - /** - * @dev Updates minimum per transaction for the particular token. Only owner can call this method. - * @param _token address of the token contract, or address(0) for configuring the default limit. - * @param _minPerTx minimum amount of tokens per one transaction, should be less than maxPerTx and dailyLimit. - */ - function setMinPerTx(address _token, uint256 _minPerTx) external onlyOwner { - require(isTokenRegistered(_token)); - require(_minPerTx > 0 && _minPerTx < dailyLimit(_token) && _minPerTx < maxPerTx(_token)); - uintStorage[keccak256(abi.encodePacked("minPerTx", _token))] = _minPerTx; - } - - /** - * @dev Retrieves maximum available bridge amount per one transaction taking into account maxPerTx() and dailyLimit() parameters. - * @param _token address of the token contract, or address(0) for the default limit. - * @return minimum of maxPerTx parameter and remaining daily quota. - */ - function maxAvailablePerTx(address _token) public view returns (uint256) { - uint256 _maxPerTx = maxPerTx(_token); - uint256 _dailyLimit = dailyLimit(_token); - uint256 _spent = totalSpentPerDay(_token, getCurrentDay()); - uint256 _remainingOutOfDaily = _dailyLimit > _spent ? _dailyLimit - _spent : 0; - return _maxPerTx < _remainingOutOfDaily ? _maxPerTx : _remainingOutOfDaily; - } - - /** - * @dev Internal function for adding spent amount for some token. - * @param _token address of the token contract. - * @param _day day number, when tokens are processed. - * @param _value amount of bridge tokens. - */ - function addTotalSpentPerDay( - address _token, - uint256 _day, - uint256 _value - ) internal { - uintStorage[keccak256(abi.encodePacked("totalSpentPerDay", _token, _day))] = totalSpentPerDay(_token, _day).add(_value); - } - - /** - * @dev Internal function for adding executed amount for some token. - * @param _token address of the token contract. - * @param _day day number, when tokens are processed. - * @param _value amount of bridge tokens. - */ - function addTotalExecutedPerDay( - address _token, - uint256 _day, - uint256 _value - ) internal { - uintStorage[keccak256(abi.encodePacked("totalExecutedPerDay", _token, _day))] = totalExecutedPerDay(_token, _day).add(_value); - } - - /** - * @dev Internal function for initializing limits for some token. - * @param _token address of the token contract. - * @param _limits [ 0 = dailyLimit, 1 = maxPerTx, 2 = minPerTx ]. - */ - function _setLimits(address _token, uint256[3] memory _limits) internal { - require( - _limits[2] > 0 && // minPerTx > 0 - _limits[1] > _limits[2] && // maxPerTx > minPerTx - _limits[0] > _limits[1] // dailyLimit > maxPerTx - ); - - uintStorage[keccak256(abi.encodePacked("dailyLimit", _token))] = _limits[0]; - uintStorage[keccak256(abi.encodePacked("maxPerTx", _token))] = _limits[1]; - uintStorage[keccak256(abi.encodePacked("minPerTx", _token))] = _limits[2]; - - emit DailyLimitChanged(_token, _limits[0]); - } - - /** - * @dev Internal function for initializing execution limits for some token. - * @param _token address of the token contract. - * @param _limits [ 0 = executionDailyLimit, 1 = executionMaxPerTx ]. - */ - function _setExecutionLimits(address _token, uint256[2] memory _limits) internal { - require(_limits[1] < _limits[0]); // foreignMaxPerTx < foreignDailyLimit - - uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _limits[0]; - uintStorage[keccak256(abi.encodePacked("executionMaxPerTx", _token))] = _limits[1]; - - emit ExecutionDailyLimitChanged(_token, _limits[0]); - } - - /** - * @dev Internal function for initializing limits for some token relative to its decimals parameter. - * @param _token address of the token contract. - * @param _decimals token decimals parameter. - */ - function _initializeTokenBridgeLimits(address _token, uint256 _decimals) internal { - uint256 factor; - if (_decimals < 18) { - factor = 10**(18 - _decimals); - - uint256 _minPerTx = minPerTx(address(0)).div(factor); - uint256 _maxPerTx = maxPerTx(address(0)).div(factor); - uint256 _dailyLimit = dailyLimit(address(0)).div(factor); - uint256 _executionMaxPerTx = executionMaxPerTx(address(0)).div(factor); - uint256 _executionDailyLimit = executionDailyLimit(address(0)).div(factor); - - // such situation can happen when calculated limits relative to the token decimals are too low - // e.g. minPerTx(address(0)) == 10 ** 14, _decimals == 3. _minPerTx happens to be 0, which is not allowed. - // in this case, limits are raised to the default values - if (_minPerTx == 0) { - // Numbers 1, 100, 10000 are chosen in a semi-random way, - // so that any token with small decimals can still be bridged in some amounts. - // It is possible to override limits for the particular token later if needed. - _minPerTx = 1; - if (_maxPerTx <= _minPerTx) { - _maxPerTx = 100; - _executionMaxPerTx = 100; - if (_dailyLimit <= _maxPerTx || _executionDailyLimit <= _executionMaxPerTx) { - _dailyLimit = 10000; - _executionDailyLimit = 10000; - } - } - } - _setLimits(_token, [_dailyLimit, _maxPerTx, _minPerTx]); - _setExecutionLimits(_token, [_executionDailyLimit, _executionMaxPerTx]); - } else { - factor = 10**(_decimals - 18); - _setLimits( - _token, - [dailyLimit(address(0)).mul(factor), maxPerTx(address(0)).mul(factor), minPerTx(address(0)).mul(factor)] - ); - _setExecutionLimits(_token, [executionDailyLimit(address(0)).mul(factor), executionMaxPerTx(address(0)).mul(factor)]); - } - } -} - -// File: contracts/upgradeable_contracts/components/common/BridgeOperationsStorage.sol - -pragma solidity 0.7.5; - -/** - * @title BridgeOperationsStorage - * @dev Functionality for storing processed bridged operations. - */ -abstract contract BridgeOperationsStorage is EternalStorage { - /** - * @dev Stores the bridged token of a message sent to the AMB bridge. - * @param _messageId of the message sent to the bridge. - * @param _token bridged token address. - */ - function setMessageToken(bytes32 _messageId, address _token) internal { - addressStorage[keccak256(abi.encodePacked("messageToken", _messageId))] = _token; - } - - /** - * @dev Tells the bridged token address of a message sent to the AMB bridge. - * @return address of a token contract. - */ - function messageToken(bytes32 _messageId) internal view returns (address) { - return addressStorage[keccak256(abi.encodePacked("messageToken", _messageId))]; - } - - /** - * @dev Stores the value of a message sent to the AMB bridge. - * @param _messageId of the message sent to the bridge. - * @param _value amount of tokens bridged. - */ - function setMessageValue(bytes32 _messageId, uint256 _value) internal { - uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))] = _value; - } - - /** - * @dev Tells the amount of tokens of a message sent to the AMB bridge. - * @return value representing amount of tokens. - */ - function messageValue(bytes32 _messageId) internal view returns (uint256) { - return uintStorage[keccak256(abi.encodePacked("messageValue", _messageId))]; - } - - /** - * @dev Stores the receiver of a message sent to the AMB bridge. - * @param _messageId of the message sent to the bridge. - * @param _recipient receiver of the tokens bridged. - */ - function setMessageRecipient(bytes32 _messageId, address _recipient) internal { - addressStorage[keccak256(abi.encodePacked("messageRecipient", _messageId))] = _recipient; - } - - /** - * @dev Tells the receiver of a message sent to the AMB bridge. - * @return address of the receiver. - */ - function messageRecipient(bytes32 _messageId) internal view returns (address) { - return addressStorage[keccak256(abi.encodePacked("messageRecipient", _messageId))]; - } -} - -// File: contracts/upgradeable_contracts/components/common/FailedMessagesProcessor.sol - -pragma solidity 0.7.5; - -/** - * @title FailedMessagesProcessor - * @dev Functionality for fixing failed bridging operations. - */ -abstract contract FailedMessagesProcessor is BasicAMBMediator, BridgeOperationsStorage { - event FailedMessageFixed(bytes32 indexed messageId, address token, address recipient, uint256 value); - - /** - * @dev Method to be called when a bridged message execution failed. It will generate a new message requesting to - * fix/roll back the transferred assets on the other network. - * @param _messageId id of the message which execution failed. - */ - function requestFailedMessageFix(bytes32 _messageId) external { - IAMB bridge = bridgeContract(); - require(!bridge.messageCallStatus(_messageId)); - require(bridge.failedMessageReceiver(_messageId) == address(this)); - require(bridge.failedMessageSender(_messageId) == mediatorContractOnOtherSide()); - - bytes4 methodSelector = this.fixFailedMessage.selector; - bytes memory data = abi.encodeWithSelector(methodSelector, _messageId); - _passMessage(data, true); - } - - /** - * @dev Handles the request to fix transferred assets which bridged message execution failed on the other network. - * It uses the information stored by passMessage method when the assets were initially transferred - * @param _messageId id of the message which execution failed on the other network. - */ - function fixFailedMessage(bytes32 _messageId) public onlyMediator { - require(!messageFixed(_messageId)); - - address token = messageToken(_messageId); - address recipient = messageRecipient(_messageId); - uint256 value = messageValue(_messageId); - setMessageFixed(_messageId); - executeActionOnFixedTokens(token, recipient, value); - emit FailedMessageFixed(_messageId, token, recipient, value); - } - - /** - * @dev Tells if a message sent to the AMB bridge has been fixed. - * @return bool indicating the status of the message. - */ - function messageFixed(bytes32 _messageId) public view returns (bool) { - return boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))]; - } - - /** - * @dev Sets that the message sent to the AMB bridge has been fixed. - * @param _messageId of the message sent to the bridge. - */ - function setMessageFixed(bytes32 _messageId) internal { - boolStorage[keccak256(abi.encodePacked("messageFixed", _messageId))] = true; - } - - function executeActionOnFixedTokens( - address _token, - address _recipient, - uint256 _value - ) internal virtual; -} - -// File: contracts/upgradeability/Proxy.sol - -pragma solidity 0.7.5; - -/** - * @title Proxy - * @dev Gives the possibility to delegate any call to a foreign implementation. - */ -abstract contract Proxy { - /** - * @dev Tells the address of the implementation where every call will be delegated. - * @return address of the implementation to which it will be delegated - */ - function implementation() public view virtual returns (address); - - /** - * @dev Fallback function allowing to perform a delegatecall to the given implementation. - * This function will return whatever the implementation call returns - */ - fallback() external payable { - // solhint-disable-previous-line no-complex-fallback - address _impl = implementation(); - require(_impl != address(0)); - assembly { - /* - 0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40) - loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty - memory. It's needed because we're going to write the return data of delegatecall to the - free memory slot. - */ - let ptr := mload(0x40) - /* - `calldatacopy` is copy calldatasize bytes from calldata - First argument is the destination to which data is copied(ptr) - Second argument specifies the start position of the copied data. - Since calldata is sort of its own unique location in memory, - 0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata. - That's always going to be the zeroth byte of the function selector. - Third argument, calldatasize, specifies how much data will be copied. - calldata is naturally calldatasize bytes long (same thing as msg.data.length) - */ - calldatacopy(ptr, 0, calldatasize()) - /* - delegatecall params explained: - gas: the amount of gas to provide for the call. `gas` is an Opcode that gives - us the amount of gas still available to execution - - _impl: address of the contract to delegate to - - ptr: to pass copied data - - calldatasize: loads the size of `bytes memory data`, same as msg.data.length - - 0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic, - these are set to 0, 0 so the output data will not be written to memory. The output - data will be read using `returndatasize` and `returdatacopy` instead. - - result: This will be 0 if the call fails and 1 if it succeeds - */ - let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0) - /* - - */ - /* - ptr current points to the value stored at 0x40, - because we assigned it like ptr := mload(0x40). - Because we use 0x40 as a free memory pointer, - we want to make sure that the next time we want to allocate memory, - we aren't overwriting anything important. - So, by adding ptr and returndatasize, - we get a memory location beyond the end of the data we will be copying to ptr. - We place this in at 0x40, and any reads from 0x40 will now read from free memory - */ - mstore(0x40, add(ptr, returndatasize())) - /* - `returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the - slot it will copy to, 0 means copy from the beginning of the return data, and size is - the amount of data to copy. - `returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall - */ - returndatacopy(ptr, 0, returndatasize()) - - /* - if `result` is 0, revert. - if `result` is 1, return `size` amount of data from `ptr`. This is the data that was - copied to `ptr` from the delegatecall return data - */ - switch result - case 0 { - revert(ptr, returndatasize()) - } - default { - return(ptr, returndatasize()) - } - } - } -} - -// File: contracts/upgradeable_contracts/modules/factory/TokenProxy.sol - -pragma solidity 0.7.5; - -interface IPermittableTokenVersion { - function version() external pure returns (string memory); -} - -/** - * @title TokenProxy - * @dev Helps to reduces the size of the deployed bytecode for automatically created tokens, by using a proxy contract. - */ -contract TokenProxy is Proxy { - // storage layout is copied from PermittableToken.sol - string internal name; - string internal symbol; - uint8 internal decimals; - mapping(address => uint256) internal balances; - uint256 internal totalSupply; - mapping(address => mapping(address => uint256)) internal allowed; - address internal owner; - bool internal mintingFinished; - address internal bridgeContractAddr; - // string public constant version = "1"; - bytes32 internal DOMAIN_SEPARATOR; - // bytes32 public constant PERMIT_TYPEHASH = 0xea2aa0a1be11a07ed86d755c93467f4f82362b452371d1ba94d1715123511acb; - mapping(address => uint256) internal nonces; - mapping(address => mapping(address => uint256)) internal expirations; - - /** - * @dev Creates a non-upgradeable token proxy for PermitableToken.sol, initializes its eternalStorage. - * @param _tokenImage address of the token image used for mirroring all functions. - * @param _name token name. - * @param _symbol token symbol. - * @param _decimals token decimals. - * @param _chainId chain id for current network. - * @param _owner address of the owner for this contract. - */ - constructor( - address _tokenImage, - string memory _name, - string memory _symbol, - uint8 _decimals, - uint256 _chainId, - address _owner - ) { - string memory version = IPermittableTokenVersion(_tokenImage).version(); - - assembly { - // EIP 1967 - // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1) - sstore(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc, _tokenImage) - } - name = _name; - symbol = _symbol; - decimals = _decimals; - owner = _owner; // _owner == HomeOmnibridge/ForeignOmnibridge mediator - bridgeContractAddr = _owner; - DOMAIN_SEPARATOR = keccak256( - abi.encode( - keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), - keccak256(bytes(_name)), - keccak256(bytes(version)), - _chainId, - address(this) - ) - ); - } - - /** - * @dev Retrieves the implementation contract address, mirrored token image. - * @return impl token image address. - */ - function implementation() public view override returns (address impl) { - assembly { - impl := sload(0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc) - } - } -} - -// File: contracts/upgradeable_contracts/modules/OwnableModule.sol - -pragma solidity 0.7.5; - -/** - * @title OwnableModule - * @dev Common functionality for multi-token extension non-upgradeable module. - */ -contract OwnableModule { - address public owner; - - /** - * @dev Initializes this contract. - * @param _owner address of the owner that is allowed to perform additional actions on the particular module. - */ - constructor(address _owner) { - owner = _owner; - } - - /** - * @dev Throws if sender is not the owner of this contract. - */ - modifier onlyOwner() { - require(msg.sender == owner); - _; - } - - /** - * @dev Changes the owner of this contract. - * @param _newOwner address of the new owner. - */ - function transferOwnership(address _newOwner) external onlyOwner { - owner = _newOwner; - } -} - -// File: contracts/upgradeable_contracts/modules/factory/TokenFactory.sol - -pragma solidity 0.7.5; - -/** - * @title TokenFactory - * @dev Factory contract for deployment of new TokenProxy contracts. - */ -contract TokenFactory is OwnableModule { - address public tokenImage; - - /** - * @dev Initializes this contract - * @param _owner of this factory contract. - * @param _tokenImage address of the token image contract that should be used for creation of new tokens. - */ - constructor(address _owner, address _tokenImage) OwnableModule(_owner) { - tokenImage = _tokenImage; - } - - /** - * @dev Updates the address of the used token image contract. - * Only owner can call this method. - * @param _tokenImage address of the new token image used for further deployments. - */ - function setTokenImage(address _tokenImage) external onlyOwner { - require(Address.isContract(_tokenImage)); - tokenImage = _tokenImage; - } - - /** - * @dev Deploys a new TokenProxy contract, using saved token image contract as a template. - * @param _name deployed token name. - * @param _symbol deployed token symbol. - * @param _decimals deployed token decimals. - * @param _chainId chain id of the current environment. - * @return address of a newly created contract. - */ - function deploy( - string calldata _name, - string calldata _symbol, - uint8 _decimals, - uint256 _chainId - ) external returns (address) { - return address(new TokenProxy(tokenImage, _name, _symbol, _decimals, _chainId, msg.sender)); - } -} - -// File: contracts/upgradeable_contracts/modules/factory/TokenFactoryConnector.sol - -pragma solidity 0.7.5; - -/** - * @title TokenFactoryConnector - * @dev Connectivity functionality for working with TokenFactory contract. - */ -contract TokenFactoryConnector is Ownable { - bytes32 internal constant TOKEN_FACTORY_CONTRACT = 0x269c5905f777ee6391c7a361d17039a7d62f52ba9fffeb98c5ade342705731a3; // keccak256(abi.encodePacked("tokenFactoryContract")) - - /** - * @dev Updates an address of the used TokenFactory contract used for creating new tokens. - * @param _tokenFactory address of TokenFactory contract. - */ - function setTokenFactory(address _tokenFactory) external onlyOwner { - _setTokenFactory(_tokenFactory); - } - - /** - * @dev Retrieves an address of the token factory contract. - * @return address of the TokenFactory contract. - */ - function tokenFactory() public view returns (TokenFactory) { - return TokenFactory(addressStorage[TOKEN_FACTORY_CONTRACT]); - } - - /** - * @dev Internal function for updating an address of the token factory contract. - * @param _tokenFactory address of the deployed TokenFactory contract. - */ - function _setTokenFactory(address _tokenFactory) internal { - require(Address.isContract(_tokenFactory)); - addressStorage[TOKEN_FACTORY_CONTRACT] = _tokenFactory; - } -} - -// File: contracts/interfaces/IBurnableMintableERC677Token.sol - -pragma solidity 0.7.5; - -interface IBurnableMintableERC677Token is IERC677 { - function mint(address _to, uint256 _amount) external returns (bool); - - function burn(uint256 _value) external; - - function claimTokens(address _token, address _to) external; -} - -// File: contracts/interfaces/IERC20Metadata.sol - -pragma solidity 0.7.5; - -interface IERC20Metadata { - function name() external view returns (string memory); - - function symbol() external view returns (string memory); - - function decimals() external view returns (uint8); -} - -// File: contracts/interfaces/IERC20Receiver.sol - -pragma solidity 0.7.5; - -interface IERC20Receiver { - function onTokenBridged( - address token, - uint256 value, - bytes calldata data - ) external; -} - -// File: contracts/libraries/TokenReader.sol - -pragma solidity 0.7.5; - -// solhint-disable -interface ITokenDetails { - function name() external view; - - function NAME() external view; - - function symbol() external view; - - function SYMBOL() external view; - - function decimals() external view; - - function DECIMALS() external view; -} - -// solhint-enable - -/** - * @title TokenReader - * @dev Helper methods for reading name/symbol/decimals parameters from ERC20 token contracts. - */ -library TokenReader { - /** - * @dev Reads the name property of the provided token. - * Either name() or NAME() method is used. - * Both, string and bytes32 types are supported. - * @param _token address of the token contract. - * @return token name as a string or an empty string if none of the methods succeeded. - */ - function readName(address _token) internal view returns (string memory) { - (bool status, bytes memory data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.name.selector)); - if (!status) { - (status, data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.NAME.selector)); - if (!status) { - return ""; - } - } - return _convertToString(data); - } - - /** - * @dev Reads the symbol property of the provided token. - * Either symbol() or SYMBOL() method is used. - * Both, string and bytes32 types are supported. - * @param _token address of the token contract. - * @return token symbol as a string or an empty string if none of the methods succeeded. - */ - function readSymbol(address _token) internal view returns (string memory) { - (bool status, bytes memory data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.symbol.selector)); - if (!status) { - (status, data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.SYMBOL.selector)); - if (!status) { - return ""; - } - } - return _convertToString(data); - } - - /** - * @dev Reads the decimals property of the provided token. - * Either decimals() or DECIMALS() method is used. - * @param _token address of the token contract. - * @return token decimals or 0 if none of the methods succeeded. - */ - function readDecimals(address _token) internal view returns (uint8) { - (bool status, bytes memory data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.decimals.selector)); - if (!status) { - (status, data) = _token.staticcall(abi.encodeWithSelector(ITokenDetails.DECIMALS.selector)); - if (!status) { - return 0; - } - } - return abi.decode(data, (uint8)); - } - - /** - * @dev Internal function for converting returned value of name()/symbol() from bytes32/string to string. - * @param returnData data returned by the token contract. - * @return string with value obtained from returnData. - */ - function _convertToString(bytes memory returnData) private pure returns (string memory) { - if (returnData.length > 32) { - return abi.decode(returnData, (string)); - } else if (returnData.length == 32) { - bytes32 data = abi.decode(returnData, (bytes32)); - string memory res = new string(32); - assembly { - let len := 0 - mstore(add(res, 32), data) // save value in result string - - // solhint-disable - for { - - } gt(data, 0) { - len := add(len, 1) - } { - // until string is empty - data := shl(8, data) // shift left by one symbol - } - // solhint-enable - mstore(res, len) // save result string length - } - return res; - } else { - return ""; - } - } -} - -// File: contracts/libraries/SafeMint.sol - -pragma solidity 0.7.5; - -/** - * @title SafeMint - * @dev Wrapper around the mint() function in all mintable tokens that verifies the return value. - */ -library SafeMint { - /** - * @dev Wrapper around IBurnableMintableERC677Token.mint() that verifies that output value is true. - * @param _token token contract. - * @param _to address of the tokens receiver. - * @param _value amount of tokens to mint. - */ - function safeMint( - IBurnableMintableERC677Token _token, - address _to, - uint256 _value - ) internal { - require(_token.mint(_to, _value)); - } -} - -// File: contracts/upgradeable_contracts/BasicOmnibridge.sol - -pragma solidity 0.7.5; - -/** - * @title BasicOmnibridge - * @dev Common functionality for multi-token mediator intended to work on top of AMB bridge. - */ -abstract contract BasicOmnibridge is - Initializable, - Upgradeable, - Claimable, - OmnibridgeInfo, - TokensRelayer, - FailedMessagesProcessor, - BridgedTokensRegistry, - NativeTokensRegistry, - MediatorBalanceStorage, - TokenFactoryConnector, - TokensBridgeLimits -{ - using SafeERC20 for IERC677; - using SafeMint for IBurnableMintableERC677Token; - using SafeMath for uint256; - - // Workaround for storing variable up-to-32 bytes suffix - uint256 private immutable SUFFIX_SIZE; - bytes32 private immutable SUFFIX; - - // Since contract is intended to be deployed under EternalStorageProxy, only constant and immutable variables can be set here - constructor(string memory _suffix) { - require(bytes(_suffix).length <= 32); - bytes32 suffix; - assembly { - suffix := mload(add(_suffix, 32)) - } - SUFFIX = suffix; - SUFFIX_SIZE = bytes(_suffix).length; - } - - /** - * @dev Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract. - * Checks that the value is inside the execution limits and invokes the Mint or Unlock accordingly. - * @param _token address of the native ERC20/ERC677 token on the other side. - * @param _name name of the native token, name suffix will be appended, if empty, symbol will be used instead. - * @param _symbol symbol of the bridged token, if empty, name will be used instead. - * @param _decimals decimals of the bridge foreign token. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - */ - function deployAndHandleBridgedTokens( - address _token, - string calldata _name, - string calldata _symbol, - uint8 _decimals, - address _recipient, - uint256 _value - ) external onlyMediator { - address bridgedToken = _getBridgedTokenOrDeploy(_token, _name, _symbol, _decimals); - - _handleTokens(bridgedToken, false, _recipient, _value); - } - - /** - * @dev Handles the bridged tokens for the first time, includes deployment of new TokenProxy contract. - * Executes a callback on the receiver. - * Checks that the value is inside the execution limits and invokes the Mint accordingly. - * @param _token address of the native ERC20/ERC677 token on the other side. - * @param _name name of the native token, name suffix will be appended, if empty, symbol will be used instead. - * @param _symbol symbol of the bridged token, if empty, name will be used instead. - * @param _decimals decimals of the bridge foreign token. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - * @param _data additional data passed from the other chain. - */ - function deployAndHandleBridgedTokensAndCall( - address _token, - string calldata _name, - string calldata _symbol, - uint8 _decimals, - address _recipient, - uint256 _value, - bytes calldata _data - ) external onlyMediator { - address bridgedToken = _getBridgedTokenOrDeploy(_token, _name, _symbol, _decimals); - - _handleTokens(bridgedToken, false, _recipient, _value); - - _receiverCallback(_recipient, bridgedToken, _value, _data); - } - - /** - * @dev Handles the bridged tokens for the already registered token pair. - * Checks that the value is inside the execution limits and invokes the Mint accordingly. - * @param _token address of the native ERC20/ERC677 token on the other side. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - */ - function handleBridgedTokens( - address _token, - address _recipient, - uint256 _value - ) external onlyMediator { - address token = bridgedTokenAddress(_token); - - require(isTokenRegistered(token)); - - _handleTokens(token, false, _recipient, _value); - } - - /** - * @dev Handles the bridged tokens for the already registered token pair. - * Checks that the value is inside the execution limits and invokes the Unlock accordingly. - * Executes a callback on the receiver. - * @param _token address of the native ERC20/ERC677 token on the other side. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - * @param _data additional transfer data passed from the other side. - */ - function handleBridgedTokensAndCall( - address _token, - address _recipient, - uint256 _value, - bytes memory _data - ) external onlyMediator { - address token = bridgedTokenAddress(_token); - - require(isTokenRegistered(token)); - - _handleTokens(token, false, _recipient, _value); - - _receiverCallback(_recipient, token, _value, _data); - } - - /** - * @dev Handles the bridged tokens that are native to this chain. - * Checks that the value is inside the execution limits and invokes the Unlock accordingly. - * @param _token native ERC20 token. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - */ - function handleNativeTokens( - address _token, - address _recipient, - uint256 _value - ) external onlyMediator { - _ackBridgedTokenDeploy(_token); - - _handleTokens(_token, true, _recipient, _value); - } - - /** - * @dev Handles the bridged tokens that are native to this chain. - * Checks that the value is inside the execution limits and invokes the Unlock accordingly. - * Executes a callback on the receiver. - * @param _token native ERC20 token. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - * @param _data additional transfer data passed from the other side. - */ - function handleNativeTokensAndCall( - address _token, - address _recipient, - uint256 _value, - bytes memory _data - ) external onlyMediator { - _ackBridgedTokenDeploy(_token); - - _handleTokens(_token, true, _recipient, _value); - - _receiverCallback(_recipient, _token, _value, _data); - } - - /** - * @dev Checks if a given token is a bridged token that is native to this side of the bridge. - * @param _token address of token contract. - * @return message id of the send message. - */ - function isRegisteredAsNativeToken(address _token) public view returns (bool) { - return isTokenRegistered(_token) && nativeTokenAddress(_token) == address(0); - } - - /** - * @dev Unlock back the amount of tokens that were bridged to the other network but failed. - * @param _token address that bridged token contract. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - */ - function executeActionOnFixedTokens( - address _token, - address _recipient, - uint256 _value - ) internal override { - _releaseTokens(nativeTokenAddress(_token) == address(0), _token, _recipient, _value, _value); - } - - /** - * @dev Allows to pre-set the bridged token contract for not-yet bridged token. - * Only the owner can call this method. - * @param _nativeToken address of the token contract on the other side that was not yet bridged. - * @param _bridgedToken address of the bridged token contract. - */ - function setCustomTokenAddressPair(address _nativeToken, address _bridgedToken) external onlyOwner { - require(!isTokenRegistered(_bridgedToken)); - require(nativeTokenAddress(_bridgedToken) == address(0)); - require(bridgedTokenAddress(_nativeToken) == address(0)); - // Unfortunately, there is no simple way to verify that the _nativeToken address - // does not belong to the bridged token on the other side, - // since information about bridged tokens addresses is not transferred back. - // Therefore, owner account calling this function SHOULD manually verify on the other side of the bridge that - // nativeTokenAddress(_nativeToken) == address(0) && isTokenRegistered(_nativeToken) == false. - - IBurnableMintableERC677Token(_bridgedToken).safeMint(address(this), 1); - IBurnableMintableERC677Token(_bridgedToken).burn(1); - - _setTokenAddressPair(_nativeToken, _bridgedToken); - } - - /** - * @dev Allows to send to the other network the amount of locked tokens that can be forced into the contract - * without the invocation of the required methods. (e. g. regular transfer without a call to onTokenTransfer) - * @param _token address of the token contract. - * Before calling this method, it must be carefully investigated how imbalance happened - * in order to avoid an attempt to steal the funds from a token with double addresses - * (e.g. TUSD is accessible at both 0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E and 0x0000000000085d4780B73119b644AE5ecd22b376) - * @param _receiver the address that will receive the tokens on the other network. - */ - function fixMediatorBalance(address _token, address _receiver) external onlyIfUpgradeabilityOwner validAddress(_receiver) { - require(isRegisteredAsNativeToken(_token)); - - uint256 balance = IERC677(_token).balanceOf(address(this)); - uint256 expectedBalance = mediatorBalance(_token); - require(balance > expectedBalance); - uint256 diff = balance - expectedBalance; - uint256 available = maxAvailablePerTx(_token); - require(available > 0); - if (diff > available) { - diff = available; - } - addTotalSpentPerDay(_token, getCurrentDay(), diff); - - bytes memory data = _prepareMessage(address(0), _token, _receiver, diff, new bytes(0)); - bytes32 _messageId = _passMessage(data, true); - _recordBridgeOperation(_messageId, _token, _receiver, diff); - } - - /** - * @dev Claims stuck tokens. Only unsupported tokens can be claimed. - * When dealing with already supported tokens, fixMediatorBalance can be used instead. - * @param _token address of claimed token, address(0) for native - * @param _to address of tokens receiver - */ - function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner { - // Only unregistered tokens and native coins are allowed to be claimed with the use of this function - require(_token == address(0) || !isTokenRegistered(_token)); - claimValues(_token, _to); - } - - /** - * @dev Withdraws erc20 tokens or native coins from the bridged token contract. - * Only the proxy owner is allowed to call this method. - * @param _bridgedToken address of the bridged token contract. - * @param _token address of the claimed token or address(0) for native coins. - * @param _to address of the tokens/coins receiver. - */ - function claimTokensFromTokenContract( - address _bridgedToken, - address _token, - address _to - ) external onlyIfUpgradeabilityOwner { - IBurnableMintableERC677Token(_bridgedToken).claimTokens(_token, _to); - } - - /** - * @dev Internal function for recording bridge operation for further usage. - * Recorded information is used for fixing failed requests on the other side. - * @param _messageId id of the sent message. - * @param _token bridged token address. - * @param _sender address of the tokens sender. - * @param _value bridged value. - */ - function _recordBridgeOperation( - bytes32 _messageId, - address _token, - address _sender, - uint256 _value - ) internal { - setMessageToken(_messageId, _token); - setMessageRecipient(_messageId, _sender); - setMessageValue(_messageId, _value); - - emit TokensBridgingInitiated(_token, _sender, _value, _messageId); - } - - /** - * @dev Constructs the message to be sent to the other side. Burns/locks bridged amount of tokens. - * @param _nativeToken address of the native token contract. - * @param _token bridged token address. - * @param _receiver address of the tokens receiver on the other side. - * @param _value bridged value. - * @param _data additional transfer data passed from the other side. - */ - function _prepareMessage( - address _nativeToken, - address _token, - address _receiver, - uint256 _value, - bytes memory _data - ) internal returns (bytes memory) { - bool withData = _data.length > 0 || msg.sig == this.relayTokensAndCall.selector; - - // process token is native with respect to this side of the bridge - if (_nativeToken == address(0)) { - _setMediatorBalance(_token, mediatorBalance(_token).add(_value)); - - // process token which bridged alternative was already ACKed to be deployed - if (isBridgedTokenDeployAcknowledged(_token)) { - return - withData - ? abi.encodeWithSelector(this.handleBridgedTokensAndCall.selector, _token, _receiver, _value, _data) - : abi.encodeWithSelector(this.handleBridgedTokens.selector, _token, _receiver, _value); - } - - uint8 decimals = TokenReader.readDecimals(_token); - string memory name = TokenReader.readName(_token); - string memory symbol = TokenReader.readSymbol(_token); - - require(bytes(name).length > 0 || bytes(symbol).length > 0); - - return - withData - ? abi.encodeWithSelector( - this.deployAndHandleBridgedTokensAndCall.selector, - _token, - name, - symbol, - decimals, - _receiver, - _value, - _data - ) - : abi.encodeWithSelector(this.deployAndHandleBridgedTokens.selector, _token, name, symbol, decimals, _receiver, _value); - } - - // process already known token that is bridged from other chain - IBurnableMintableERC677Token(_token).burn(_value); - return - withData - ? abi.encodeWithSelector(this.handleNativeTokensAndCall.selector, _nativeToken, _receiver, _value, _data) - : abi.encodeWithSelector(this.handleNativeTokens.selector, _nativeToken, _receiver, _value); - } - - /** - * @dev Internal function for getting minter proxy address. - * @param _token address of the token to mint. - * @return address of the minter contract that should be used for calling mint(address,uint256) - */ - function _getMinterFor(address _token) internal pure virtual returns (IBurnableMintableERC677Token) { - return IBurnableMintableERC677Token(_token); - } - - /** - * Internal function for unlocking some amount of tokens. - * @param _isNative true, if token is native w.r.t. to this side of the bridge. - * @param _token address of the token contract. - * @param _recipient address of the tokens receiver. - * @param _value amount of tokens to unlock. - * @param _balanceChange amount of balance to subtract from the mediator balance. - */ - function _releaseTokens( - bool _isNative, - address _token, - address _recipient, - uint256 _value, - uint256 _balanceChange - ) internal virtual { - if (_isNative) { - IERC677(_token).safeTransfer(_recipient, _value); - _setMediatorBalance(_token, mediatorBalance(_token).sub(_balanceChange)); - } else { - _getMinterFor(_token).safeMint(_recipient, _value); - } - } - - /** - * Internal function for getting address of the bridged token. Deploys new token if necessary. - * @param _token address of the token contract on the other side of the bridge. - * @param _name name of the native token, name suffix will be appended, if empty, symbol will be used instead. - * @param _symbol symbol of the bridged token, if empty, name will be used instead. - * @param _decimals decimals of the bridge foreign token. - */ - function _getBridgedTokenOrDeploy( - address _token, - string calldata _name, - string calldata _symbol, - uint8 _decimals - ) internal returns (address) { - address bridgedToken = bridgedTokenAddress(_token); - if (bridgedToken == address(0)) { - string memory name = _name; - string memory symbol = _symbol; - require(bytes(name).length > 0 || bytes(symbol).length > 0); - if (bytes(name).length == 0) { - name = symbol; - } else if (bytes(symbol).length == 0) { - symbol = name; - } - name = _transformName(name); - bridgedToken = tokenFactory().deploy(name, symbol, _decimals, bridgeContract().sourceChainId()); - _setTokenAddressPair(_token, bridgedToken); - _initializeTokenBridgeLimits(bridgedToken, _decimals); - } else if (!isTokenRegistered(bridgedToken)) { - require(IERC20Metadata(bridgedToken).decimals() == _decimals); - _initializeTokenBridgeLimits(bridgedToken, _decimals); - } - return bridgedToken; - } - - /** - * Notifies receiving contract about the completed bridging operation. - * @param _recipient address of the tokens receiver. - * @param _token address of the bridged token. - * @param _value amount of tokens transferred. - * @param _data additional data passed to the callback. - */ - function _receiverCallback( - address _recipient, - address _token, - uint256 _value, - bytes memory _data - ) internal { - if (Address.isContract(_recipient)) { - _recipient.call(abi.encodeWithSelector(IERC20Receiver.onTokenBridged.selector, _token, _value, _data)); - } - } - - /** - * @dev Internal function for transforming the bridged token name. Appends a side-specific suffix. - * @param _name bridged token from the other side. - * @return token name for this side of the bridge. - */ - function _transformName(string memory _name) internal view returns (string memory) { - string memory result = string(abi.encodePacked(_name, SUFFIX)); - uint256 size = SUFFIX_SIZE; - assembly { - mstore(result, add(mload(_name), size)) - } - return result; - } - - function _handleTokens( - address _token, - bool _isNative, - address _recipient, - uint256 _value - ) internal virtual; -} - -// File: contracts/upgradeable_contracts/modules/forwarding_rules/MultiTokenForwardingRulesManager.sol - -pragma solidity 0.7.5; - -/** - * @title MultiTokenForwardingRulesManager - * @dev Multi token mediator functionality for managing destination AMB lanes permissions. - */ -contract MultiTokenForwardingRulesManager is OwnableModule { - address internal constant ANY_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF; - - // Forwarding rules mapping - // token => sender => receiver => destination lane - mapping(address => mapping(address => mapping(address => int256))) public forwardingRule; - - event ForwardingRuleUpdated(address token, address sender, address receiver, int256 lane); - - constructor(address _owner) OwnableModule(_owner) {} - - /** - * @dev Tells the destination lane for a particular bridge operation by checking several wildcard forwarding rules. - * @param _token address of the token contract on the foreign side of the bridge. - * @param _sender address of the tokens sender on the home side of the bridge. - * @param _receiver address of the tokens receiver on the foreign side of the bridge. - * @return destination lane identifier, where the message should be forwarded to. - * 1 - oracle-driven-lane should be used. - * 0 - default behaviour should be applied. - * -1 - manual lane should be used. - */ - function destinationLane( - address _token, - address _sender, - address _receiver - ) public view returns (int256) { - int256 defaultLane = forwardingRule[_token][ANY_ADDRESS][ANY_ADDRESS]; // specific token for all senders and receivers - int256 lane; - if (defaultLane < 0) { - lane = forwardingRule[_token][_sender][ANY_ADDRESS]; // specific token for specific sender - if (lane != 0) return lane; - lane = forwardingRule[_token][ANY_ADDRESS][_receiver]; // specific token for specific receiver - if (lane != 0) return lane; - return defaultLane; - } - lane = forwardingRule[ANY_ADDRESS][_sender][ANY_ADDRESS]; // all tokens for specific sender - if (lane != 0) return lane; - return forwardingRule[ANY_ADDRESS][ANY_ADDRESS][_receiver]; // all tokens for specific receiver - } - - /** - * Updates the forwarding rule for bridging specific token. - * Only owner can call this method. - * @param _token address of the token contract on the foreign side. - * @param _enable true, if bridge operations for a given token should be forwarded to the manual lane. - */ - function setTokenForwardingRule(address _token, bool _enable) external { - require(_token != ANY_ADDRESS); - _setForwardingRule(_token, ANY_ADDRESS, ANY_ADDRESS, _enable ? int256(-1) : int256(0)); - } - - /** - * Allows a particular address to send bridge requests to the oracle-driven lane for a particular token. - * Only owner can call this method. - * @param _token address of the token contract on the foreign side. - * @param _sender address of the tokens sender on the home side of the bridge. - * @param _enable true, if bridge operations for a given token and sender should be forwarded to the oracle-driven lane. - */ - function setSenderExceptionForTokenForwardingRule( - address _token, - address _sender, - bool _enable - ) external { - require(_token != ANY_ADDRESS); - require(_sender != ANY_ADDRESS); - _setForwardingRule(_token, _sender, ANY_ADDRESS, _enable ? int256(1) : int256(0)); - } - - /** - * Allows a particular address to receive bridged tokens from the oracle-driven lane for a particular token. - * Only owner can call this method. - * @param _token address of the token contract on the foreign side. - * @param _receiver address of the tokens receiver on the foreign side of the bridge. - * @param _enable true, if bridge operations for a given token and receiver should be forwarded to the oracle-driven lane. - */ - function setReceiverExceptionForTokenForwardingRule( - address _token, - address _receiver, - bool _enable - ) external { - require(_token != ANY_ADDRESS); - require(_receiver != ANY_ADDRESS); - _setForwardingRule(_token, ANY_ADDRESS, _receiver, _enable ? int256(1) : int256(0)); - } - - /** - * Updates the forwarding rule for the specific sender. - * Only owner can call this method. - * @param _sender address of the tokens sender on the home side. - * @param _enable true, if all bridge operations from a given sender should be forwarded to the manual lane. - */ - function setSenderForwardingRule(address _sender, bool _enable) external { - require(_sender != ANY_ADDRESS); - _setForwardingRule(ANY_ADDRESS, _sender, ANY_ADDRESS, _enable ? int256(-1) : int256(0)); - } - - /** - * Updates the forwarding rule for the specific receiver. - * Only owner can call this method. - * @param _receiver address of the tokens receiver on the foreign side. - * @param _enable true, if all bridge operations to a given receiver should be forwarded to the manual lane. - */ - function setReceiverForwardingRule(address _receiver, bool _enable) external { - require(_receiver != ANY_ADDRESS); - _setForwardingRule(ANY_ADDRESS, ANY_ADDRESS, _receiver, _enable ? int256(-1) : int256(0)); - } - - /** - * @dev Internal function for updating the preferred destination lane for the specific wildcard pattern. - * Only owner can call this method. - * Examples: - * _setForwardingRule(tokenA, ANY_ADDRESS, ANY_ADDRESS, -1) - forward all operations on tokenA to the manual lane - * _setForwardingRule(tokenA, Alice, ANY_ADDRESS, 1) - allow Alice to use the oracle-driven lane for bridging tokenA - * _setForwardingRule(tokenA, ANY_ADDRESS, Bob, 1) - forward all tokenA bridge operations, where Bob is the receiver, to the oracle-driven lane - * _setForwardingRule(ANY_ADDRESS, Mallory, ANY_ADDRESS, -1) - forward all bridge operations from Mallory to the manual lane - * @param _token address of the token contract on the foreign side of the bridge. - * @param _sender address of the tokens sender on the home side of the bridge. - * @param _receiver address of the tokens receiver on the foreign side of the bridge. - * @param _lane preferred destination lane for the particular sender. - * 1 - forward to the oracle-driven lane. - * 0 - behaviour is unset, proceed by checking other less-specific rules. - * -1 - manual lane should be used. - */ - function _setForwardingRule( - address _token, - address _sender, - address _receiver, - int256 _lane - ) internal onlyOwner { - forwardingRule[_token][_sender][_receiver] = _lane; - - emit ForwardingRuleUpdated(_token, _sender, _receiver, _lane); - } -} - -// File: contracts/upgradeable_contracts/modules/forwarding_rules/MultiTokenForwardingRulesConnector.sol - -pragma solidity 0.7.5; - -/** - * @title MultiTokenForwardingRulesConnector - * @dev Connectivity functionality that is required for using forwarding rules manager. - */ -contract MultiTokenForwardingRulesConnector is Ownable { - bytes32 internal constant FORWARDING_RULES_MANAGER_CONTRACT = - 0x5f86f226cd489cc09187d5f5e0adfb94308af0d4ceac482dd8a8adea9d80daf4; // keccak256(abi.encodePacked("forwardingRulesManagerContract")) - - /** - * @dev Updates an address of the used forwarding rules manager contract. - * @param _manager address of forwarding rules manager contract. - */ - function setForwardingRulesManager(address _manager) external onlyOwner { - _setForwardingRulesManager(_manager); - } - - /** - * @dev Retrieves an address of the forwarding rules manager contract. - * @return address of the forwarding rules manager contract. - */ - function forwardingRulesManager() public view returns (MultiTokenForwardingRulesManager) { - return MultiTokenForwardingRulesManager(addressStorage[FORWARDING_RULES_MANAGER_CONTRACT]); - } - - /** - * @dev Internal function for updating an address of the used forwarding rules manager contract. - * @param _manager address of forwarding rules manager contract. - */ - function _setForwardingRulesManager(address _manager) internal { - require(_manager == address(0) || Address.isContract(_manager)); - addressStorage[FORWARDING_RULES_MANAGER_CONTRACT] = _manager; - } - - /** - * @dev Checks if bridge operation is allowed to use oracle driven lane. - * @param _token address of the token contract on the foreign side of the bridge. - * @param _sender address of the tokens sender on the home side of the bridge. - * @param _receiver address of the tokens receiver on the foreign side of the bridge. - * @return true, if message can be forwarded to the oracle-driven lane. - */ - function _isOracleDrivenLaneAllowed( - address _token, - address _sender, - address _receiver - ) internal view returns (bool) { - MultiTokenForwardingRulesManager manager = forwardingRulesManager(); - // Default lane is manual, since oracle-driven line is requred only for very small - // number of exceptions - return address(manager) == address(0) || manager.destinationLane(_token, _sender, _receiver) > 0; - } -} - -// File: contracts/upgradeable_contracts/modules/MediatorOwnableModule.sol - -pragma solidity 0.7.5; - -/** - * @title MediatorOwnableModule - * @dev Common functionality for non-upgradeable Omnibridge extension module. - */ -contract MediatorOwnableModule is OwnableModule { - address public mediator; - - /** - * @dev Initializes this contract. - * @param _mediator address of the deployed Omnibridge extension for which this module is deployed. - * @param _owner address of the owner that is allowed to perform additional actions on the particular module. - */ - constructor(address _mediator, address _owner) OwnableModule(_owner) { - require(Address.isContract(_mediator)); - mediator = _mediator; - } - - /** - * @dev Throws if sender is not the Omnibridge extension. - */ - modifier onlyMediator() { - require(msg.sender == mediator); - _; - } -} - -// File: contracts/upgradeable_contracts/modules/fee_manager/OmnibridgeFeeManager.sol - -pragma solidity 0.7.5; - -/** - * @title OmnibridgeFeeManager - * @dev Implements the logic to distribute fees from the Omnibridge mediator contract operations. - * The fees are distributed in the form of ERC20/ERC677 tokens to the list of reward addresses. - */ -contract OmnibridgeFeeManager is MediatorOwnableModule { - using SafeMath for uint256; - using SafeERC20 for IERC20; - - // This is not a real fee value but a relative value used to calculate the fee percentage. - // 1 ether = 100% of the value. - uint256 internal constant MAX_FEE = 1 ether; - uint256 internal constant MAX_REWARD_ACCOUNTS = 50; - - bytes32 public constant HOME_TO_FOREIGN_FEE = 0x741ede137d0537e88e0ea0ff25b1f22d837903dbbee8980b4a06e8523247ee26; // keccak256(abi.encodePacked("homeToForeignFee")) - bytes32 public constant FOREIGN_TO_HOME_FEE = 0x03be2b2875cb41e0e77355e802a16769bb8dfcf825061cde185c73bf94f12625; // keccak256(abi.encodePacked("foreignToHomeFee")) - - // mapping feeType => token address => fee percentage - mapping(bytes32 => mapping(address => uint256)) internal fees; - address[] internal rewardAddresses; - - event FeeUpdated(bytes32 feeType, address indexed token, uint256 fee); - - /** - * @dev Stores the initial parameters of the fee manager. - * @param _mediator address of the mediator contract used together with this fee manager. - * @param _owner address of the contract owner. - * @param _rewardAddresses list of unique initial reward addresses, between whom fees will be distributed - * @param _fees array with initial fees for both bridge directions. - * [ 0 = homeToForeignFee, 1 = foreignToHomeFee ] - */ - constructor( - address _mediator, - address _owner, - address[] memory _rewardAddresses, - uint256[2] memory _fees - ) MediatorOwnableModule(_mediator, _owner) { - require(_rewardAddresses.length <= MAX_REWARD_ACCOUNTS); - _setFee(HOME_TO_FOREIGN_FEE, address(0), _fees[0]); - _setFee(FOREIGN_TO_HOME_FEE, address(0), _fees[1]); - - for (uint256 i = 0; i < _rewardAddresses.length; i++) { - require(_isValidAddress(_rewardAddresses[i])); - for (uint256 j = 0; j < i; j++) { - require(_rewardAddresses[j] != _rewardAddresses[i]); - } - } - rewardAddresses = _rewardAddresses; - } - - /** - * @dev Throws if given fee amount is invalid. - */ - modifier validFee(uint256 _fee) { - require(_fee < MAX_FEE); - /* solcov ignore next */ - _; - } - - /** - * @dev Throws if given fee type is unknown. - */ - modifier validFeeType(bytes32 _feeType) { - require(_feeType == HOME_TO_FOREIGN_FEE || _feeType == FOREIGN_TO_HOME_FEE); - /* solcov ignore next */ - _; - } - - /** - * @dev Updates the value for the particular fee type. - * Only the owner can call this method. - * @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE]. - * @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens. - * @param _fee new fee value, in percentage (1 ether == 10**18 == 100%). - */ - function setFee( - bytes32 _feeType, - address _token, - uint256 _fee - ) external validFeeType(_feeType) onlyOwner { - _setFee(_feeType, _token, _fee); - } - - /** - * @dev Retrieves the value for the particular fee type. - * @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE]. - * @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens. - * @return fee value associated with the requested fee type. - */ - function getFee(bytes32 _feeType, address _token) public view validFeeType(_feeType) returns (uint256) { - // use token-specific fee if one is registered - uint256 _tokenFee = fees[_feeType][_token]; - if (_tokenFee > 0) { - return _tokenFee - 1; - } - // use default fee otherwise - return fees[_feeType][address(0)] - 1; - } - - /** - * @dev Calculates the amount of fee to pay for the value of the particular fee type. - * @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE]. - * @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens. - * @param _value bridged value, for which fee should be evaluated. - * @return amount of fee to be subtracted from the transferred value. - */ - function calculateFee( - bytes32 _feeType, - address _token, - uint256 _value - ) public view returns (uint256) { - if (rewardAddresses.length == 0) { - return 0; - } - uint256 _fee = getFee(_feeType, _token); - return _value.mul(_fee).div(MAX_FEE); - } - - /** - * @dev Adds a new address to the list of accounts to receive rewards for the operations. - * Only the owner can call this method. - * @param _addr new reward address. - */ - function addRewardAddress(address _addr) external onlyOwner { - require(_isValidAddress(_addr)); - require(!isRewardAddress(_addr)); - require(rewardAddresses.length < MAX_REWARD_ACCOUNTS); - rewardAddresses.push(_addr); - } - - /** - * @dev Removes an address from the list of accounts to receive rewards for the operations. - * Only the owner can call this method. - * finds the element, swaps it with the last element, and then deletes it; - * @param _addr to be removed. - * return boolean whether the element was found and deleted - */ - function removeRewardAddress(address _addr) external onlyOwner { - uint256 numOfAccounts = rewardAddresses.length; - for (uint256 i = 0; i < numOfAccounts; i++) { - if (rewardAddresses[i] == _addr) { - rewardAddresses[i] = rewardAddresses[numOfAccounts - 1]; - delete rewardAddresses[numOfAccounts - 1]; - rewardAddresses.pop(); - return; - } - } - // If account is not found and removed, the transactions is reverted - revert(); - } - - /** - * @dev Tells the number of registered reward receivers. - * @return amount of addresses. - */ - function rewardAddressCount() external view returns (uint256) { - return rewardAddresses.length; - } - - /** - * @dev Tells the list of registered reward receivers. - * @return list with all registered reward receivers. - */ - function rewardAddressList() external view returns (address[] memory) { - return rewardAddresses; - } - - /** - * @dev Tells if a given address is part of the reward address list. - * @param _addr address to check if it is part of the list. - * @return true if the given address is in the list - */ - function isRewardAddress(address _addr) public view returns (bool) { - for (uint256 i = 0; i < rewardAddresses.length; i++) { - if (rewardAddresses[i] == _addr) { - return true; - } - } - return false; - } - - /** - * @dev Distributes the fee proportionally between registered reward addresses. - * @param _token address of the token contract for which fee should be distributed. - */ - function distributeFee(address _token) external onlyMediator { - uint256 numOfAccounts = rewardAddresses.length; - uint256 fee = IERC20(_token).balanceOf(address(this)); - uint256 feePerAccount = fee.div(numOfAccounts); - uint256 randomAccountIndex; - uint256 diff = fee.sub(feePerAccount.mul(numOfAccounts)); - if (diff > 0) { - randomAccountIndex = random(numOfAccounts); - } - - for (uint256 i = 0; i < numOfAccounts; i++) { - uint256 feeToDistribute = feePerAccount; - if (diff > 0 && randomAccountIndex == i) { - feeToDistribute = feeToDistribute.add(diff); - } - IERC20(_token).safeTransfer(rewardAddresses[i], feeToDistribute); - } - } - - /** - * @dev Calculates a random number based on the block number. - * @param _count the max value for the random number. - * @return a number between 0 and _count. - */ - function random(uint256 _count) internal view returns (uint256) { - return uint256(blockhash(block.number.sub(1))) % _count; - } - - /** - * @dev Internal function for updating the fee value for the given fee type. - * @param _feeType type of the updated fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE]. - * @param _token address of the token contract for which fee should apply, 0x00..00 describes the initial fee for newly created tokens. - * @param _fee new fee value, in percentage (1 ether == 10**18 == 100%). - */ - function _setFee( - bytes32 _feeType, - address _token, - uint256 _fee - ) internal validFee(_fee) { - fees[_feeType][_token] = 1 + _fee; - emit FeeUpdated(_feeType, _token, _fee); - } - - /** - * @dev Checks if a given address can be a reward receiver. - * @param _addr address of the proposed reward receiver. - * @return true, if address is valid. - */ - function _isValidAddress(address _addr) internal view returns (bool) { - return _addr != address(0) && _addr != address(mediator); - } -} - -// File: contracts/upgradeable_contracts/modules/fee_manager/OmnibridgeFeeManagerConnector.sol - -pragma solidity 0.7.5; - -/** - * @title OmnibridgeFeeManagerConnector - * @dev Connectivity functionality for working with OmnibridgeFeeManager contract. - */ -abstract contract OmnibridgeFeeManagerConnector is Ownable { - using SafeERC20 for IERC20; - using SafeMint for IBurnableMintableERC677Token; - - bytes32 internal constant FEE_MANAGER_CONTRACT = 0x779a349c5bee7817f04c960f525ee3e2f2516078c38c68a3149787976ee837e5; // keccak256(abi.encodePacked("feeManagerContract")) - bytes32 internal constant HOME_TO_FOREIGN_FEE = 0x741ede137d0537e88e0ea0ff25b1f22d837903dbbee8980b4a06e8523247ee26; // keccak256(abi.encodePacked("homeToForeignFee")) - bytes32 internal constant FOREIGN_TO_HOME_FEE = 0x03be2b2875cb41e0e77355e802a16769bb8dfcf825061cde185c73bf94f12625; // keccak256(abi.encodePacked("foreignToHomeFee")) - - event FeeDistributed(uint256 fee, address indexed token, bytes32 indexed messageId); - event FeeDistributionFailed(address indexed token, uint256 fee); - - /** - * @dev Updates an address of the used fee manager contract used for calculating and distributing fees. - * @param _feeManager address of fee manager contract. - */ - function setFeeManager(address _feeManager) external onlyOwner { - _setFeeManager(_feeManager); - } - - /** - * @dev Retrieves an address of the fee manager contract. - * @return address of the fee manager contract. - */ - function feeManager() public view returns (OmnibridgeFeeManager) { - return OmnibridgeFeeManager(addressStorage[FEE_MANAGER_CONTRACT]); - } - - /** - * @dev Internal function for updating an address of the used fee manager contract. - * @param _feeManager address of fee manager contract. - */ - function _setFeeManager(address _feeManager) internal { - require(_feeManager == address(0) || Address.isContract(_feeManager)); - addressStorage[FEE_MANAGER_CONTRACT] = _feeManager; - } - - /** - * @dev Internal function for calculating and distributing fee through the separate fee manager contract. - * @param _feeType type of the fee, can be one of [HOME_TO_FOREIGN_FEE, FOREIGN_TO_HOME_FEE]. - * @param _isNative true, if distributed token is native to this side of the bridge. - * @param _from address of the tokens sender, needed only if _feeType is HOME_TO_FOREIGN_FEE. - * @param _token address of the token contract, for which fee should be processed. - * @param _value amount of tokens bridged. - * @return total amount of fee distributed. - */ - function _distributeFee( - bytes32 _feeType, - bool _isNative, - address _from, - address _token, - uint256 _value - ) internal returns (uint256) { - OmnibridgeFeeManager manager = feeManager(); - if (address(manager) != address(0)) { - // Next line disables fee collection in case sender is one of the reward addresses. - // It is needed to allow a 100% withdrawal of tokens from the home side. - // If fees are not disabled for reward receivers, small fraction of tokens will always - // be redistributed between the same set of reward addresses, which is not the desired behaviour. - if (_feeType == HOME_TO_FOREIGN_FEE && manager.isRewardAddress(_from)) { - return 0; - } - uint256 fee = manager.calculateFee(_feeType, _token, _value); - if (fee > 0) { - if (_feeType == HOME_TO_FOREIGN_FEE) { - // for home -> foreign direction, fee is collected using transfer(address,uint256) method - // if transfer to the manager contract fails, the transaction is reverted - IERC20(_token).safeTransfer(address(manager), fee); - } else { - // for foreign -> home direction, - // fee is collected using transfer(address,uint256) method for native tokens, - // and using mint(address,uint256) method for bridged tokens. - // if transfer/mint to the manager contract fails, the message still will be processed, but without fees - bytes4 selector = _isNative ? IERC20.transfer.selector : IBurnableMintableERC677Token.mint.selector; - (bool status, bytes memory returnData) = _token.call(abi.encodeWithSelector(selector, manager, fee)); - if (!status) { - emit FeeDistributionFailed(_token, fee); - return 0; - } - require(returnData.length == 0 || abi.decode(returnData, (bool))); - } - manager.distributeFee(_token); - } - return fee; - } - return 0; - } - - function _getMinterFor(address _token) internal pure virtual returns (IBurnableMintableERC677Token); -} - -// File: contracts/upgradeable_contracts/modules/gas_limit/SelectorTokenGasLimitManager.sol - -pragma solidity 0.7.5; - -/** - * @title SelectorTokenGasLimitManager - * @dev Multi token mediator functionality for managing request gas limits. - */ -contract SelectorTokenGasLimitManager is OwnableModule { - IAMB public immutable bridge; - - uint256 internal defaultGasLimit; - mapping(bytes4 => uint256) internal selectorGasLimit; - mapping(bytes4 => mapping(address => uint256)) internal selectorTokenGasLimit; - - constructor( - IAMB _bridge, - address _owner, - uint256 _gasLimit - ) OwnableModule(_owner) { - require(_gasLimit <= _bridge.maxGasPerTx()); - bridge = _bridge; - defaultGasLimit = _gasLimit; - } - - /** - * @dev Throws if provided gas limit is greater then the maximum allowed gas limit in the AMB contract. - * @param _gasLimit gas limit value to check. - */ - modifier validGasLimit(uint256 _gasLimit) { - require(_gasLimit <= bridge.maxGasPerTx()); - _; - } - - /** - * @dev Throws if one of the provided gas limits is greater then the maximum allowed gas limit in the AMB contract. - * @param _length expected length of the _gasLimits array. - * @param _gasLimits array of gas limit values to check, should contain exactly _length elements. - */ - modifier validGasLimits(uint256 _length, uint256[] calldata _gasLimits) { - require(_gasLimits.length == _length); - uint256 maxGasLimit = bridge.maxGasPerTx(); - for (uint256 i = 0; i < _length; i++) { - require(_gasLimits[i] <= maxGasLimit); - } - _; - } - - /** - * @dev Sets the default gas limit to be used in the message execution by the AMB bridge on the other network. - * This value can't exceed the parameter maxGasPerTx defined on the AMB bridge. - * Only the owner can call this method. - * @param _gasLimit the gas limit for the message execution. - */ - function setRequestGasLimit(uint256 _gasLimit) external onlyOwner validGasLimit(_gasLimit) { - defaultGasLimit = _gasLimit; - } - - /** - * @dev Sets the selector-specific gas limit to be used in the message execution by the AMB bridge on the other network. - * This value can't exceed the parameter maxGasPerTx defined on the AMB bridge. - * Only the owner can call this method. - * @param _selector method selector of the outgoing message payload. - * @param _gasLimit the gas limit for the message execution. - */ - function setRequestGasLimit(bytes4 _selector, uint256 _gasLimit) external onlyOwner validGasLimit(_gasLimit) { - selectorGasLimit[_selector] = _gasLimit; - } - - /** - * @dev Sets the token-specific gas limit to be used in the message execution by the AMB bridge on the other network. - * This value can't exceed the parameter maxGasPerTx defined on the AMB bridge. - * Only the owner can call this method. - * @param _selector method selector of the outgoing message payload. - * @param _token address of the native token that is used in the first argument of handleBridgedTokens/handleNativeTokens. - * @param _gasLimit the gas limit for the message execution. - */ - function setRequestGasLimit( - bytes4 _selector, - address _token, - uint256 _gasLimit - ) external onlyOwner validGasLimit(_gasLimit) { - selectorTokenGasLimit[_selector][_token] = _gasLimit; - } - - /** - * @dev Tells the default gas limit to be used in the message execution by the AMB bridge on the other network. - * @return the gas limit for the message execution. - */ - function requestGasLimit() public view returns (uint256) { - return defaultGasLimit; - } - - /** - * @dev Tells the selector-specific gas limit to be used in the message execution by the AMB bridge on the other network. - * @param _selector method selector for the passed message. - * @return the gas limit for the message execution. - */ - function requestGasLimit(bytes4 _selector) public view returns (uint256) { - return selectorGasLimit[_selector]; - } - - /** - * @dev Tells the token-specific gas limit to be used in the message execution by the AMB bridge on the other network. - * @param _selector method selector for the passed message. - * @param _token address of the native token that is used in the first argument of handleBridgedTokens/handleNativeTokens. - * @return the gas limit for the message execution. - */ - function requestGasLimit(bytes4 _selector, address _token) public view returns (uint256) { - return selectorTokenGasLimit[_selector][_token]; - } - - /** - * @dev Tells the gas limit to use for the message execution by the AMB bridge on the other network. - * @param _data calldata to be used on the other side of the bridge, when execution a message. - * @return the gas limit for the message execution. - */ - function requestGasLimit(bytes memory _data) external view returns (uint256) { - bytes4 selector; - address token; - assembly { - // first 4 bytes of _data contain the selector of the function to be called on the other side of the bridge. - // mload(add(_data, 4)) loads selector to the 28-31 bytes of the word. - // shl(28 * 8, x) then used to correct the padding of the selector, putting it to 0-3 bytes of the word. - selector := shl(224, mload(add(_data, 4))) - // handleBridgedTokens/handleNativeTokens/... passes bridged token address as the first parameter. - // it is located in the 4-35 bytes of the calldata. - // 36 = bytes length padding (32) + selector length (4) - token := mload(add(_data, 36)) - } - uint256 gasLimit = selectorTokenGasLimit[selector][token]; - if (gasLimit == 0) { - gasLimit = selectorGasLimit[selector]; - if (gasLimit == 0) { - gasLimit = defaultGasLimit; - } - } - return gasLimit; - } - - /** - * @dev Sets the default values for different Omnibridge selectors. - * @param _gasLimits array with 7 gas limits for the following selectors of the outgoing messages: - * - deployAndHandleBridgedTokens, deployAndHandleBridgedTokensAndCall - * - handleBridgedTokens, handleBridgedTokensAndCall - * - handleNativeTokens, handleNativeTokensAndCall - * - fixFailedMessage - * Only the owner can call this method. - */ - function setCommonRequestGasLimits(uint256[] calldata _gasLimits) external onlyOwner validGasLimits(7, _gasLimits) { - require(_gasLimits[1] >= _gasLimits[0]); - require(_gasLimits[3] >= _gasLimits[2]); - require(_gasLimits[5] >= _gasLimits[4]); - require(_gasLimits[0] >= _gasLimits[2]); - require(_gasLimits[1] >= _gasLimits[3]); - selectorGasLimit[BasicOmnibridge.deployAndHandleBridgedTokens.selector] = _gasLimits[0]; - selectorGasLimit[BasicOmnibridge.deployAndHandleBridgedTokensAndCall.selector] = _gasLimits[1]; - selectorGasLimit[BasicOmnibridge.handleBridgedTokens.selector] = _gasLimits[2]; - selectorGasLimit[BasicOmnibridge.handleBridgedTokensAndCall.selector] = _gasLimits[3]; - selectorGasLimit[BasicOmnibridge.handleNativeTokens.selector] = _gasLimits[4]; - selectorGasLimit[BasicOmnibridge.handleNativeTokensAndCall.selector] = _gasLimits[5]; - selectorGasLimit[FailedMessagesProcessor.fixFailedMessage.selector] = _gasLimits[6]; - } - - /** - * @dev Sets the request gas limits for some specific token bridged from Foreign side of the bridge. - * @param _token address of the native token contract on the Foreign side. - * @param _gasLimits array with 2 gas limits for the following selectors of the outgoing messages: - * - handleNativeTokens, handleNativeTokensAndCall - * Only the owner can call this method. - */ - function setBridgedTokenRequestGasLimits(address _token, uint256[] calldata _gasLimits) - external - onlyOwner - validGasLimits(2, _gasLimits) - { - require(_gasLimits[1] >= _gasLimits[0]); - selectorTokenGasLimit[BasicOmnibridge.handleNativeTokens.selector][_token] = _gasLimits[0]; - selectorTokenGasLimit[BasicOmnibridge.handleNativeTokensAndCall.selector][_token] = _gasLimits[1]; - } - - /** - * @dev Sets the request gas limits for some specific token native to the Home side of the bridge. - * @param _token address of the native token contract on the Home side. - * @param _gasLimits array with 4 gas limits for the following selectors of the outgoing messages: - * - deployAndHandleBridgedTokens, deployAndHandleBridgedTokensAndCall - * - handleBridgedTokens, handleBridgedTokensAndCall - * Only the owner can call this method. - */ - function setNativeTokenRequestGasLimits(address _token, uint256[] calldata _gasLimits) - external - onlyOwner - validGasLimits(4, _gasLimits) - { - require(_gasLimits[1] >= _gasLimits[0]); - require(_gasLimits[3] >= _gasLimits[2]); - require(_gasLimits[0] >= _gasLimits[2]); - require(_gasLimits[1] >= _gasLimits[3]); - selectorTokenGasLimit[BasicOmnibridge.deployAndHandleBridgedTokens.selector][_token] = _gasLimits[0]; - selectorTokenGasLimit[BasicOmnibridge.deployAndHandleBridgedTokensAndCall.selector][_token] = _gasLimits[1]; - selectorTokenGasLimit[BasicOmnibridge.handleBridgedTokens.selector][_token] = _gasLimits[2]; - selectorTokenGasLimit[BasicOmnibridge.handleBridgedTokensAndCall.selector][_token] = _gasLimits[3]; - } -} - -// File: contracts/upgradeable_contracts/modules/gas_limit/SelectorTokenGasLimitConnector.sol - -pragma solidity 0.7.5; - -/** - * @title SelectorTokenGasLimitConnector - * @dev Connectivity functionality that is required for using gas limit manager. - */ -abstract contract SelectorTokenGasLimitConnector is Ownable, BasicAMBMediator { - bytes32 internal constant GAS_LIMIT_MANAGER_CONTRACT = 0x5f5bc4e0b888be22a35f2166061a04607296c26861006b9b8e089a172696a822; // keccak256(abi.encodePacked("gasLimitManagerContract")) - - /** - * @dev Updates an address of the used gas limit manager contract. - * @param _manager address of gas limit manager contract. - */ - function setGasLimitManager(address _manager) external onlyOwner { - _setGasLimitManager(_manager); - } - - /** - * @dev Retrieves an address of the gas limit manager contract. - * @return address of the gas limit manager contract. - */ - function gasLimitManager() public view returns (SelectorTokenGasLimitManager) { - return SelectorTokenGasLimitManager(addressStorage[GAS_LIMIT_MANAGER_CONTRACT]); - } - - /** - * @dev Internal function for updating an address of the used gas limit manager contract. - * @param _manager address of gas limit manager contract. - */ - function _setGasLimitManager(address _manager) internal { - require(_manager == address(0) || Address.isContract(_manager)); - addressStorage[GAS_LIMIT_MANAGER_CONTRACT] = _manager; - } - - /** - * @dev Tells the gas limit to use for the message execution by the AMB bridge on the other network. - * @param _data calldata to be used on the other side of the bridge, when execution a message. - * @return the gas limit for the message execution. - */ - function _chooseRequestGasLimit(bytes memory _data) internal view returns (uint256) { - SelectorTokenGasLimitManager manager = gasLimitManager(); - if (address(manager) == address(0)) { - return bridgeContract().maxGasPerTx(); - } else { - return manager.requestGasLimit(_data); - } - } -} - -// File: contracts/upgradeable_contracts/HomeOmnibridge.sol - -pragma solidity 0.7.5; - -/** - * @title HomeOmnibridge - * @dev Home side implementation for multi-token mediator intended to work on top of AMB bridge. - * It is designed to be used as an implementation contract of EternalStorageProxy contract. - */ -contract HomeOmnibridge is - BasicOmnibridge, - SelectorTokenGasLimitConnector, - OmnibridgeFeeManagerConnector, - MultiTokenForwardingRulesConnector -{ - using SafeMath for uint256; - using SafeERC20 for IERC677; - - constructor(string memory _suffix) BasicOmnibridge(_suffix) {} - - /** - * @dev Stores the initial parameters of the mediator. - * @param _bridgeContract the address of the AMB bridge contract. - * @param _mediatorContract the address of the mediator contract on the other network. - * @param _dailyLimitMaxPerTxMinPerTxArray array with limit values for the assets to be bridged to the other network. - * [ 0 = dailyLimit, 1 = maxPerTx, 2 = minPerTx ] - * @param _executionDailyLimitExecutionMaxPerTxArray array with limit values for the assets bridged from the other network. - * [ 0 = executionDailyLimit, 1 = executionMaxPerTx ] - * @param _gasLimitManager the gas limit manager contract address. - * @param _owner address of the owner of the mediator contract. - * @param _tokenFactory address of the TokenFactory contract that will be used for the deployment of new tokens. - * @param _feeManager address of the OmnibridgeFeeManager contract that will be used for fee distribution. - * @param _forwardingRulesManager address of the MultiTokenForwardingRulesManager contract that will be used for managing lane permissions. - */ - function initialize( - address _bridgeContract, - address _mediatorContract, - uint256[3] calldata _dailyLimitMaxPerTxMinPerTxArray, // [ 0 = _dailyLimit, 1 = _maxPerTx, 2 = _minPerTx ] - uint256[2] calldata _executionDailyLimitExecutionMaxPerTxArray, // [ 0 = _executionDailyLimit, 1 = _executionMaxPerTx ] - address _gasLimitManager, - address _owner, - address _tokenFactory, - address _feeManager, - address _forwardingRulesManager - ) external onlyRelevantSender returns (bool) { - require(!isInitialized()); - - _setBridgeContract(_bridgeContract); - _setMediatorContractOnOtherSide(_mediatorContract); - _setLimits(address(0), _dailyLimitMaxPerTxMinPerTxArray); - _setExecutionLimits(address(0), _executionDailyLimitExecutionMaxPerTxArray); - _setGasLimitManager(_gasLimitManager); - _setOwner(_owner); - _setTokenFactory(_tokenFactory); - _setFeeManager(_feeManager); - _setForwardingRulesManager(_forwardingRulesManager); - - setInitialize(); - - return isInitialized(); - } - - /** - * One-time function to be used together with upgradeToAndCall method. - * Sets the token factory contract. Resumes token bridging in the home to foreign direction. - * @param _tokenFactory address of the deployed TokenFactory contract. - * @param _forwardingRulesManager address of the deployed MultiTokenForwardingRulesManager contract. - * @param _gasLimitManager address of the deployed SelectorTokenGasLimitManager contract. - * @param _dailyLimit default daily limits used before stopping the bridge operation. - */ - function upgradeToReverseMode( - address _tokenFactory, - address _forwardingRulesManager, - address _gasLimitManager, - uint256 _dailyLimit - ) external { - require(msg.sender == address(this)); - - _setTokenFactory(_tokenFactory); - _setForwardingRulesManager(_forwardingRulesManager); - _setGasLimitManager(_gasLimitManager); - - uintStorage[keccak256(abi.encodePacked("dailyLimit", address(0)))] = _dailyLimit; - emit DailyLimitChanged(address(0), _dailyLimit); - } - - /** - * @dev Alias for bridgedTokenAddress for interface compatibility with the prior version of the Home mediator. - * @param _foreignToken address of the native token contract on the other side. - * @return address of the deployed bridged token contract. - */ - function homeTokenAddress(address _foreignToken) public view returns (address) { - return bridgedTokenAddress(_foreignToken); - } - - /** - * @dev Alias for nativeTokenAddress for interface compatibility with the prior version of the Home mediator. - * @param _homeToken address of the created bridged token contract on this side. - * @return address of the native token contract on the other side of the bridge. - */ - function foreignTokenAddress(address _homeToken) public view returns (address) { - return nativeTokenAddress(_homeToken); - } - - /** - * @dev Handles the bridged tokens. - * Checks that the value is inside the execution limits and invokes the Mint or Unlock accordingly. - * @param _token token contract address on this side of the bridge. - * @param _isNative true, if given token is native to this chain and Unlock should be used. - * @param _recipient address that will receive the tokens. - * @param _value amount of tokens to be received. - */ - function _handleTokens( - address _token, - bool _isNative, - address _recipient, - uint256 _value - ) internal override { - // prohibit withdrawal of tokens during other bridge operations (e.g. relayTokens) - // such reentrant withdrawal can lead to an incorrect balanceDiff calculation - require(!lock()); - - require(withinExecutionLimit(_token, _value)); - addTotalExecutedPerDay(_token, getCurrentDay(), _value); - - uint256 valueToBridge = _value; - uint256 fee = _distributeFee(FOREIGN_TO_HOME_FEE, _isNative, address(0), _token, valueToBridge); - bytes32 _messageId = messageId(); - if (fee > 0) { - emit FeeDistributed(fee, _token, _messageId); - valueToBridge = valueToBridge.sub(fee); - } - - _releaseTokens(_isNative, _token, _recipient, valueToBridge, _value); - - emit TokensBridged(_token, _recipient, valueToBridge, _messageId); - } - - /** - * @dev Executes action on deposit of bridged tokens - * @param _token address of the token contract - * @param _from address of tokens sender - * @param _receiver address of tokens receiver on the other side - * @param _value requested amount of bridged tokens - * @param _data additional transfer data to be used on the other side - */ - function bridgeSpecificActionsOnTokenTransfer( - address _token, - address _from, - address _receiver, - uint256 _value, - bytes memory _data - ) internal override { - require(_receiver != address(0) && _receiver != mediatorContractOnOtherSide()); - - // native unbridged token - if (!isTokenRegistered(_token)) { - uint8 decimals = TokenReader.readDecimals(_token); - _initializeTokenBridgeLimits(_token, decimals); - } - - require(withinLimit(_token, _value)); - addTotalSpentPerDay(_token, getCurrentDay(), _value); - - address nativeToken = nativeTokenAddress(_token); - uint256 fee = _distributeFee(HOME_TO_FOREIGN_FEE, nativeToken == address(0), _from, _token, _value); - uint256 valueToBridge = _value.sub(fee); - - bytes memory data = _prepareMessage(nativeToken, _token, _receiver, valueToBridge, _data); - - // Address of the home token is used here for determining lane permissions. - bytes32 _messageId = _passMessage(data, _isOracleDrivenLaneAllowed(_token, _from, _receiver)); - _recordBridgeOperation(_messageId, _token, _from, valueToBridge); - if (fee > 0) { - emit FeeDistributed(fee, _token, _messageId); - } - } - - /** - * @dev Internal function for sending an AMB message to the mediator on the other side. - * @param _data data to be sent to the other side of the bridge. - * @param _useOracleLane true, if the message should be sent to the oracle driven lane. - * @return id of the sent message. - */ - function _passMessage(bytes memory _data, bool _useOracleLane) internal override returns (bytes32) { - address executor = mediatorContractOnOtherSide(); - uint256 gasLimit = _chooseRequestGasLimit(_data); - IAMB bridge = bridgeContract(); - - return - _useOracleLane - ? bridge.requireToPassMessage(executor, _data, gasLimit) - : bridge.requireToConfirmMessage(executor, _data, gasLimit); - } - - /** - * @dev Internal function for getting minter proxy address. - * Returns the token address itself, expect for the case with bridged STAKE token. - * For bridged STAKE token, returns the hardcoded TokenMinter contract address. - * @param _token address of the token to mint. - * @return address of the minter contract that should be used for calling mint(address,uint256) - */ - function _getMinterFor(address _token) - internal - pure - override(BasicOmnibridge, OmnibridgeFeeManagerConnector) - returns (IBurnableMintableERC677Token) - { - // It is possible to hardcode different token minter contracts here during compile time. - // For example, the dedicated TokenMinter (0x857DD07866C1e19eb2CDFceF7aE655cE7f9E560d) is used for - // bridged STAKE token (0xb7D311E2Eb55F2f68a9440da38e7989210b9A05e). - // if (_token == address(0xb7D311E2Eb55F2f68a9440da38e7989210b9A05e)) { - // // hardcoded address of the TokenMinter address - // return IBurnableMintableERC677Token(0xb7D311E2Eb55F2f68a9440da38e7989210b9A05e); - // } - return IBurnableMintableERC677Token(_token); - } -} diff --git a/contracts/interfaces/Bridge.sol b/contracts/interfaces/IBridge.sol similarity index 58% rename from contracts/interfaces/Bridge.sol rename to contracts/interfaces/IBridge.sol index 0ed88d2..762ccff 100644 --- a/contracts/interfaces/Bridge.sol +++ b/contracts/interfaces/IBridge.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // https://docs.tokenbridge.net/amb-bridge/development-of-a-cross-chain-application/how-to-develop-xchain-apps-by-amb#call-a-method-in-another-chain-using-the-amb-bridge interface IAMB { @@ -11,3 +12,19 @@ interface IAMB { interface IOmniBridge { function bridgeContract() external view returns (IAMB); } + +interface IERC6777 is IERC20 { + function transferAndCall( + address, + uint256, + bytes calldata + ) external returns (bool); +} + +interface IERC20Receiver { + function onTokenBridged( + IERC6777 token, + uint256 value, + bytes calldata data + ) external; +} diff --git a/contracts/interfaces/IVerifier.sol b/contracts/interfaces/IVerifier.sol new file mode 100644 index 0000000..429d1db --- /dev/null +++ b/contracts/interfaces/IVerifier.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.7.0; + +interface IVerifier { + function verifyProof(bytes memory _proof, uint256[7] memory _input) external view returns (bool); + + function verifyProof(bytes memory _proof, uint256[21] memory _input) external view returns (bool); +} diff --git a/hardhat.config.js b/hardhat.config.js index e2177ef..8692437 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -16,6 +16,15 @@ const config = { }, }, }, + { + version: '0.7.5', + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, { version: '0.7.6', settings: { diff --git a/package.json b/package.json index 0eb482a..93bc2f1 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,9 @@ "author": "", "license": "ISC", "dependencies": { - "@metamask/eth-sig-util": "^4.0.0", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-waffle": "^2.0.1", - "@openzeppelin/contracts": "git+https://github.com/tornadocash/openzeppelin-contracts.git#6e46aa6946a7f215e7604169ddf46e1aebea850f", + "@openzeppelin": "git+https://github.com/tornadocash/openzeppelin-contracts.git#6e46aa6946a7f215e7604169ddf46e1aebea850f", "@openzeppelin/contracts-upgradeable": "3.4.2", "@typechain/ethers-v5": "^7.0.1", "@typechain/hardhat": "^2.3.0", @@ -37,13 +36,13 @@ "dotenv": "^10.0.0", "eth-sig-util": "^3.0.1", "ethereum-waffle": "^3.2.0", - "ethereumjs-util": "^7.1.2", "ethers": "^5.0.0", "ffiasm": "^0.1.3", "ffjavascript": "^0.2.36", "fixed-merkle-tree": "^0.5.1", "hardhat": "^2.3.0", "mocha": "^9.1.0", + "omnibridge": "git+https://github.com/peppersec/omnibridge.git#aa3a970c29752a4da5f3fc7ccf0733783c1acf0b", "snarkjs": "git+https://github.com/tornadocash/snarkjs.git#616c2d30699f28c8f3ab737b877402ccbb604cfe", "tmp-promise": "^3.0.2", "typechain": "^5.1.2" diff --git a/scripts/deployTornado.js b/scripts/deployTornado.js index 6af1817..112e0a1 100644 --- a/scripts/deployTornado.js +++ b/scripts/deployTornado.js @@ -1,11 +1,13 @@ const { ethers } = require('hardhat') const MERKLE_TREE_HEIGHT = 23 +const { MINIMUM_WITHDRAWAL_AMOUNT, MAXIMUM_DEPOSIT_AMOUNT } = process.env async function main() { require('./compileHasher') const govAddress = '0x03ebd0748aa4d1457cf479cce56309641e0a98f5' const omniBridge = '0x59447362798334d3485c64D1e4870Fde2DDC0d75' + const amb = '0x162e898bd0aacb578c8d5f8d6ca588c13d2a383f' const token = '0xCa8d20f3e0144a72C6B5d576e9Bd3Fd8557E2B04' // WBNB const l1Unwrapper = '0xcf35E84bbA3506BB97cf6fAEFe6cc1A9bd843Fc2' // WBNB -> BNB const l1ChainId = 56 @@ -26,7 +28,7 @@ async function main() { console.log(`hasher: ${hasher.address}`) const Pool = await ethers.getContractFactory('TornadoPool') - const tornado = await Pool.deploy( + const tornadoImpl = await Pool.deploy( verifier2.address, verifier16.address, MERKLE_TREE_HEIGHT, @@ -34,20 +36,18 @@ async function main() { token, omniBridge, l1Unwrapper, - ) - await tornado.deployed() - console.log(`TornadoPool address: ${tornado.address}`) - - const CrossChainUpgradeableProxy = await ethers.getContractFactory('CrossChainUpgradeableProxy') - const proxy = await CrossChainUpgradeableProxy.deploy( - tornado.address, - govAddress, - [], - omniBridge, l1ChainId, ) + await tornadoImpl.deployed() + console.log(`TornadoPool implementation address: ${tornadoImpl.address}`) + + const CrossChainUpgradeableProxy = await ethers.getContractFactory('CrossChainUpgradeableProxy') + const proxy = await CrossChainUpgradeableProxy.deploy(tornadoImpl.address, govAddress, [], amb, l1ChainId) await proxy.deployed() console.log(`proxy address: ${proxy.address}`) + + const tornadoPool = await Pool.attach(proxy.address) + await tornadoPool.initialize(MINIMUM_WITHDRAWAL_AMOUNT, MAXIMUM_DEPOSIT_AMOUNT) } main() diff --git a/src/index.js b/src/index.js index be836e1..e6b4fed 100644 --- a/src/index.js +++ b/src/index.js @@ -144,7 +144,7 @@ async function transaction({ tornadoPool, ...rest }) { }) const receipt = await tornadoPool.transact(args, extData, { - gasLimit: 1e6, + gasLimit: 2e6, }) return await receipt.wait() } diff --git a/test/full.test.js b/test/full.test.js index 0b55991..5a7bddd 100644 --- a/test/full.test.js +++ b/test/full.test.js @@ -4,17 +4,15 @@ const { loadFixture } = waffle const { expect } = require('chai') const { utils } = ethers -const { toBuffer } = require('ethereumjs-util') -const { signTypedData, SignTypedDataVersion } = require('@metamask/eth-sig-util') - const Utxo = require('../src/utxo') const { transaction, registerAndTransact, prepareTransaction } = require('../src/index') const { Keypair } = require('../src/keypair') -const { EIP721Params, encodeDataForBridge } = require('./utils') +const { encodeDataForBridge } = require('./utils') const MERKLE_TREE_HEIGHT = 5 -const L1ChainId = 1 -const SENDER_PRIVATE_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' +const l1ChainId = 1 +const MINIMUM_WITHDRAWAL_AMOUNT = utils.parseEther(process.env.MINIMUM_WITHDRAWAL_AMOUNT || '0.05') +const MAXIMUM_DEPOSIT_AMOUNT = utils.parseEther(process.env.MAXIMUM_DEPOSIT_AMOUNT || '1') describe('TornadoPool', function () { this.timeout(20000) @@ -32,10 +30,10 @@ describe('TornadoPool', function () { const verifier16 = await deploy('Verifier16') const hasher = await deploy('Hasher') - const token = await deploy('PermittableToken', 'Wrapped ETH', 'WETH', 18, L1ChainId) + const token = await deploy('PermittableToken', 'Wrapped ETH', 'WETH', 18, l1ChainId) await token.mint(sender.address, utils.parseEther('10000')) - const amb = await deploy('MockAMB', gov.address, L1ChainId) + const amb = await deploy('MockAMB', gov.address, l1ChainId) const omniBridge = await deploy('MockOmniBridge', amb.address) /** @type {TornadoPool} */ @@ -48,9 +46,8 @@ describe('TornadoPool', function () { token.address, omniBridge.address, l1Unwrapper.address, - L1ChainId, + gov.address, ) - await tornadoPoolImpl.initialize() // not necessary const proxy = await deploy( 'CrossChainUpgradeableProxy', @@ -58,12 +55,12 @@ describe('TornadoPool', function () { gov.address, [], amb.address, - L1ChainId, + l1ChainId, ) const TornadoPool = await ethers.getContractFactory('TornadoPool') const tornadoPool = TornadoPool.attach(proxy.address) - await tornadoPool.initialize() + await tornadoPool.initialize(MINIMUM_WITHDRAWAL_AMOUNT, MAXIMUM_DEPOSIT_AMOUNT) await token.approve(tornadoPool.address, utils.parseEther('10000')) @@ -156,7 +153,7 @@ describe('TornadoPool', function () { const { tornadoPool, token } = await loadFixture(fixture) // Alice deposits into tornado pool - const aliceDepositAmount = 1e7 + const aliceDepositAmount = utils.parseEther('0.1') const aliceDepositUtxo = new Utxo({ amount: aliceDepositAmount }) await transaction({ tornadoPool, outputs: [aliceDepositUtxo] }) @@ -165,10 +162,10 @@ describe('TornadoPool', function () { const bobAddress = bobKeypair.address() // contains only public key // Alice sends some funds to Bob - const bobSendAmount = 3e6 + const bobSendAmount = utils.parseEther('0.06') const bobSendUtxo = new Utxo({ amount: bobSendAmount, keypair: Keypair.fromString(bobAddress) }) const aliceChangeUtxo = new Utxo({ - amount: aliceDepositAmount - bobSendAmount, + amount: aliceDepositAmount.sub(bobSendAmount), keypair: aliceDepositUtxo.keypair, }) await transaction({ tornadoPool, inputs: [aliceDepositUtxo], outputs: [bobSendUtxo, aliceChangeUtxo] }) @@ -187,9 +184,9 @@ describe('TornadoPool', function () { expect(bobReceiveUtxo.amount).to.be.equal(bobSendAmount) // Bob withdraws a part of his funds from the shielded pool - const bobWithdrawAmount = 2e6 + const bobWithdrawAmount = utils.parseEther('0.05') const bobEthAddress = '0xDeaD00000000000000000000000000000000BEEf' - const bobChangeUtxo = new Utxo({ amount: bobSendAmount - bobWithdrawAmount, keypair: bobKeypair }) + const bobChangeUtxo = new Utxo({ amount: bobSendAmount.sub(bobWithdrawAmount), keypair: bobKeypair }) await transaction({ tornadoPool, inputs: [bobReceiveUtxo], @@ -203,36 +200,19 @@ describe('TornadoPool', function () { it('should deposit from L1 and withdraw to L1', async function () { const { tornadoPool, token, omniBridge } = await loadFixture(fixture) - const owner = (await ethers.getSigners())[0].address const aliceKeypair = new Keypair() // contains private and public keys // Alice deposits into tornado pool - const aliceDepositAmount = 1e7 + const aliceDepositAmount = utils.parseEther('0.07') const aliceDepositUtxo = new Utxo({ amount: aliceDepositAmount, keypair: aliceKeypair }) const { args, extData } = await prepareTransaction({ tornadoPool, outputs: [aliceDepositUtxo], }) - const signature = signTypedData({ - privateKey: toBuffer(SENDER_PRIVATE_KEY), - data: EIP721Params({ - chainId: L1ChainId, - verifyingContract: tornadoPool.address, - owner, - publicKey: aliceKeypair.address(), - }), - version: SignTypedDataVersion.V4, - }) - const onTokenBridgedData = encodeDataForBridge({ - account: { - owner, - publicKey: aliceKeypair.address(), - }, proof: args, extData, - signature, }) const onTokenBridgedTx = await tornadoPool.populateTransaction.onTokenBridged( @@ -245,10 +225,10 @@ describe('TornadoPool', function () { await omniBridge.execute(tornadoPool.address, onTokenBridgedTx.data) // withdraws a part of his funds from the shielded pool - const aliceWithdrawAmount = 2e6 + const aliceWithdrawAmount = utils.parseEther('0.06') const recipient = '0xDeaD00000000000000000000000000000000BEEf' const aliceChangeUtxo = new Utxo({ - amount: aliceDepositAmount - aliceWithdrawAmount, + amount: aliceDepositAmount.sub(aliceWithdrawAmount), keypair: aliceKeypair, }) await transaction({ @@ -267,6 +247,12 @@ describe('TornadoPool', function () { it('should work with 16 inputs', async function () { const { tornadoPool } = await loadFixture(fixture) - await transaction({ tornadoPool, inputs: [new Utxo(), new Utxo(), new Utxo()] }) + const aliceDepositAmount = utils.parseEther('0.07') + const aliceDepositUtxo = new Utxo({ amount: aliceDepositAmount }) + await transaction({ + tornadoPool, + inputs: [new Utxo(), new Utxo(), new Utxo()], + outputs: [aliceDepositUtxo], + }) }) }) diff --git a/test/utils.js b/test/utils.js index 8d98de4..0d7d194 100644 --- a/test/utils.js +++ b/test/utils.js @@ -2,44 +2,14 @@ const { ethers } = require('hardhat') const abi = new ethers.utils.AbiCoder() -function encodeDataForBridge({ account, proof, extData, signature }) { +function encodeDataForBridge({ proof, extData }) { return abi.encode( [ - 'tuple(address owner,bytes publicKey)', 'tuple(bytes proof,bytes32 root,bytes32[] inputNullifiers,bytes32[2] outputCommitments,uint256 publicAmount,bytes32 extDataHash)', 'tuple(address recipient,int256 extAmount,address relayer,uint256 fee,bytes encryptedOutput1,bytes encryptedOutput2,bool isL1Withdrawal)', - 'bytes', ], - [account, proof, extData, signature], + [proof, extData], ) } -function EIP721Params({ chainId, verifyingContract, owner, publicKey }) { - return { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - TornadoAccount: [ - { name: 'owner', type: 'address' }, - { name: 'publicKey', type: 'bytes' }, - ], - }, - primaryType: 'TornadoAccount', - domain: { - name: 'TornadoPool', - version: '1', - chainId, - verifyingContract, - }, - message: { - owner, - publicKey, - }, - } -} - -module.exports = { encodeDataForBridge, EIP721Params } +module.exports = { encodeDataForBridge } diff --git a/yarn.lock b/yarn.lock index 441a64e..5d547b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,49 +16,49 @@ dependencies: "@babel/highlight" "^7.14.5" -"@babel/generator@^7.15.0": - version "7.15.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.0.tgz#a7d0c172e0d814974bad5aa77ace543b97917f15" - integrity sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ== +"@babel/generator@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.4.tgz#85acb159a267ca6324f9793986991ee2022a05b0" + integrity sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw== dependencies: - "@babel/types" "^7.15.0" + "@babel/types" "^7.15.4" jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-function-name@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz#89e2c474972f15d8e233b52ee8c480e2cfcd50c4" - integrity sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ== +"@babel/helper-function-name@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz#845744dafc4381a4a5fb6afa6c3d36f98a787ebc" + integrity sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw== dependencies: - "@babel/helper-get-function-arity" "^7.14.5" - "@babel/template" "^7.14.5" - "@babel/types" "^7.14.5" + "@babel/helper-get-function-arity" "^7.15.4" + "@babel/template" "^7.15.4" + "@babel/types" "^7.15.4" -"@babel/helper-get-function-arity@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz#25fbfa579b0937eee1f3b805ece4ce398c431815" - integrity sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg== +"@babel/helper-get-function-arity@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz#098818934a137fce78b536a3e015864be1e2879b" + integrity sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA== dependencies: - "@babel/types" "^7.14.5" + "@babel/types" "^7.15.4" -"@babel/helper-hoist-variables@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz#e0dd27c33a78e577d7c8884916a3e7ef1f7c7f8d" - integrity sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ== +"@babel/helper-hoist-variables@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz#09993a3259c0e918f99d104261dfdfc033f178df" + integrity sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA== dependencies: - "@babel/types" "^7.14.5" + "@babel/types" "^7.15.4" -"@babel/helper-split-export-declaration@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz#22b23a54ef51c2b7605d851930c1976dd0bc693a" - integrity sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA== +"@babel/helper-split-export-declaration@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz#aecab92dcdbef6a10aa3b62ab204b085f776e257" + integrity sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw== dependencies: - "@babel/types" "^7.14.5" + "@babel/types" "^7.15.4" "@babel/helper-validator-identifier@^7.14.5", "@babel/helper-validator-identifier@^7.14.9": - version "7.14.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz#6654d171b2024f6d8ee151bf2509699919131d48" - integrity sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g== + version "7.15.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" + integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== "@babel/highlight@^7.10.4", "@babel/highlight@^7.14.5": version "7.14.5" @@ -69,39 +69,39 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.14.5", "@babel/parser@^7.15.0", "@babel/parser@^7.7.0": - version "7.15.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.3.tgz#3416d9bea748052cfcb63dbcc27368105b1ed862" - integrity sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA== +"@babel/parser@^7.15.4", "@babel/parser@^7.7.0": + version "7.15.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.7.tgz#0c3ed4a2eb07b165dfa85b3cc45c727334c4edae" + integrity sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g== -"@babel/template@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.14.5.tgz#a9bc9d8b33354ff6e55a9c60d1109200a68974f4" - integrity sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g== +"@babel/template@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194" + integrity sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg== dependencies: "@babel/code-frame" "^7.14.5" - "@babel/parser" "^7.14.5" - "@babel/types" "^7.14.5" + "@babel/parser" "^7.15.4" + "@babel/types" "^7.15.4" "@babel/traverse@^7.7.0": - version "7.15.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.0.tgz#4cca838fd1b2a03283c1f38e141f639d60b3fc98" - integrity sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw== + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" + integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== dependencies: "@babel/code-frame" "^7.14.5" - "@babel/generator" "^7.15.0" - "@babel/helper-function-name" "^7.14.5" - "@babel/helper-hoist-variables" "^7.14.5" - "@babel/helper-split-export-declaration" "^7.14.5" - "@babel/parser" "^7.15.0" - "@babel/types" "^7.15.0" + "@babel/generator" "^7.15.4" + "@babel/helper-function-name" "^7.15.4" + "@babel/helper-hoist-variables" "^7.15.4" + "@babel/helper-split-export-declaration" "^7.15.4" + "@babel/parser" "^7.15.4" + "@babel/types" "^7.15.4" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.14.5", "@babel/types@^7.15.0", "@babel/types@^7.7.0": - version "7.15.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.0.tgz#61af11f2286c4e9c69ca8deb5f4375a73c72dcbd" - integrity sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ== +"@babel/types@^7.15.4", "@babel/types@^7.7.0": + version "7.15.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f" + integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig== dependencies: "@babel/helper-validator-identifier" "^7.14.9" to-fast-properties "^2.0.0" @@ -138,12 +138,12 @@ strip-json-comments "^3.1.1" "@ethereum-waffle/chai@^3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@ethereum-waffle/chai/-/chai-3.4.0.tgz#2477877410a96bf370edd64df905b04fb9aba9d5" - integrity sha512-GVaFKuFbFUclMkhHtQTDnWBnBQMJc/pAbfbFj/nnIK237WPLsO3KDDslA7m+MNEyTAOFrcc0CyfruAGGXAQw3g== + version "3.4.1" + resolved "https://registry.yarnpkg.com/@ethereum-waffle/chai/-/chai-3.4.1.tgz#500b59db766a490cb19a7f74ac75a1c3cf86049b" + integrity sha512-8mjgjWCe8XSCWuyJgVtJY8sm00VTczGBTDxBejgEBWN/J9x7QD8jdmWW8bfxdnqZbxiDCTvRFL58Wmd254BEqQ== dependencies: "@ethereum-waffle/provider" "^3.4.0" - ethers "^5.0.0" + ethers "^5.4.7" "@ethereum-waffle/compiler@^3.4.0": version "3.4.0" @@ -190,73 +190,74 @@ patch-package "^6.2.2" postinstall-postinstall "^2.1.0" -"@ethereumjs/block@^3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.4.0.tgz#4747b0c06220ee10cbdfe1cbde8cbb0677b1b074" - integrity sha512-umKAoTX32yXzErpIksPHodFc/5y8bmZMnOl6hWy5Vd8xId4+HKFUOyEiN16Y97zMwFRysRpcrR6wBejfqc6Bmg== +"@ethereumjs/block@^3.4.0", "@ethereumjs/block@^3.5.0", "@ethereumjs/block@^3.5.1": + version "3.5.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.5.1.tgz#59737d393503249aa750c37dfc83896234f4e175" + integrity sha512-MoY9bHKABOBK6BW0v1N1Oc0Cve4x/giX67M3TtrVBUsKQTj2eznLGKpydoitxWSZ+WgKKSVhfRMzbCGRwk7T5w== dependencies: - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/tx" "^3.3.0" - ethereumjs-util "^7.1.0" - merkle-patricia-tree "^4.2.0" + "@ethereumjs/common" "^2.5.0" + "@ethereumjs/tx" "^3.3.1" + ethereumjs-util "^7.1.1" + merkle-patricia-tree "^4.2.1" -"@ethereumjs/blockchain@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.4.0.tgz#28d712627d3442b2bb1f50dd5acba7cde1021993" - integrity sha512-wAuKLaew6PL52kH8YPXO7PbjjKV12jivRSyHQehkESw4slSLLfYA6Jv7n5YxyT2ajD7KNMPVh7oyF/MU6HcOvg== +"@ethereumjs/blockchain@^5.4.0", "@ethereumjs/blockchain@^5.4.1": + version "5.4.2" + resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.4.2.tgz#5074e0a0157818762a5f5175ea0bd93c5455fe32" + integrity sha512-AOAAwz/lw2lciG9gf5wHi7M/qknraXXnLR66lYgbQ04qfyFC3ZE5x/5rLVm1Vu+kfJLlKrYZTmA0IbOkc7kvgw== dependencies: - "@ethereumjs/block" "^3.4.0" - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/ethash" "^1.0.0" + "@ethereumjs/block" "^3.5.1" + "@ethereumjs/common" "^2.5.0" + "@ethereumjs/ethash" "^1.1.0" debug "^2.2.0" - ethereumjs-util "^7.1.0" + ethereumjs-util "^7.1.1" level-mem "^5.0.1" lru-cache "^5.1.1" rlp "^2.2.4" semaphore-async-await "^1.5.1" -"@ethereumjs/common@^2.3.0", "@ethereumjs/common@^2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.4.0.tgz#2d67f6e6ba22246c5c89104e6b9a119fb3039766" - integrity sha512-UdkhFWzWcJCZVsj1O/H8/oqj/0RVYjLc1OhPjBrQdALAkQHpCp8xXI4WLnuGTADqTdJZww0NtgwG+TRPkXt27w== +"@ethereumjs/common@^2.3.0", "@ethereumjs/common@^2.4.0", "@ethereumjs/common@^2.5.0": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.5.0.tgz#ec61551b31bef7a69d1dc634d8932468866a4268" + integrity sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg== dependencies: crc-32 "^1.2.0" - ethereumjs-util "^7.1.0" + ethereumjs-util "^7.1.1" -"@ethereumjs/ethash@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.0.0.tgz#4e77f85b37be1ade5393e8719bdabac3e796ddaa" - integrity sha512-iIqnGG6NMKesyOxv2YctB2guOVX18qMAWlj3QlZyrc+GqfzLqoihti+cVNQnyNxr7eYuPdqwLQOFuPe6g/uKjw== +"@ethereumjs/ethash@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.1.0.tgz#7c5918ffcaa9cb9c1dc7d12f77ef038c11fb83fb" + integrity sha512-/U7UOKW6BzpA+Vt+kISAoeDie1vAvY4Zy2KF5JJb+So7+1yKmJeJEHOGSnQIj330e9Zyl3L5Nae6VZyh2TJnAA== dependencies: + "@ethereumjs/block" "^3.5.0" "@types/levelup" "^4.3.0" buffer-xor "^2.0.1" - ethereumjs-util "^7.0.7" + ethereumjs-util "^7.1.1" miller-rabin "^4.0.0" -"@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.0.tgz#14ed1b7fa0f28e1cd61e3ecbdab824205f6a4378" - integrity sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA== +"@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0", "@ethereumjs/tx@^3.3.1": + version "3.3.2" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.2.tgz#348d4624bf248aaab6c44fec2ae67265efe3db00" + integrity sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog== dependencies: - "@ethereumjs/common" "^2.4.0" - ethereumjs-util "^7.1.0" + "@ethereumjs/common" "^2.5.0" + ethereumjs-util "^7.1.2" "@ethereumjs/vm@^5.5.2": - version "5.5.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.5.2.tgz#918a2c1000aaa9fdbe6007a4fdc2c62833122adf" - integrity sha512-AydZ4wfvZAsBuFzs3xVSA2iU0hxhL8anXco3UW3oh9maVC34kTEytOfjHf06LTEfN0MF9LDQ4ciLa7If6ZN/sg== + version "5.5.3" + resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.5.3.tgz#dc8b30dd35efb589db093592600207660fa8dada" + integrity sha512-0k5OreWnlgXYs54wohgO11jtGI05GDasj2EYxzuaStxTi15CS3vow5wGYELC1pG9xngE1F/mFmKi/f14XRuDow== dependencies: - "@ethereumjs/block" "^3.4.0" - "@ethereumjs/blockchain" "^5.4.0" - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/tx" "^3.3.0" + "@ethereumjs/block" "^3.5.0" + "@ethereumjs/blockchain" "^5.4.1" + "@ethereumjs/common" "^2.5.0" + "@ethereumjs/tx" "^3.3.1" async-eventemitter "^0.2.4" core-js-pure "^3.0.1" debug "^2.2.0" - ethereumjs-util "^7.1.0" + ethereumjs-util "^7.1.1" functional-red-black-tree "^1.0.1" mcl-wasm "^0.7.1" - merkle-patricia-tree "^4.2.0" + merkle-patricia-tree "^4.2.1" rustbn.js "~0.2.0" util.promisify "^1.0.1" @@ -290,10 +291,10 @@ "@ethersproject/properties" "^5.0.3" "@ethersproject/strings" "^5.0.4" -"@ethersproject/abi@5.4.0", "@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.4.0.tgz#a6d63bdb3672f738398846d4279fa6b6c9818242" - integrity sha512-9gU2H+/yK1j2eVMdzm6xvHSnMxk8waIHQGYCZg5uvAyH0rsAzxkModzBSpbAkAuhKFEovC2S9hM4nPuLym8IZw== +"@ethersproject/abi@5.4.1", "@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0": + version "5.4.1" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.4.1.tgz#6ac28fafc9ef6f5a7a37e30356a2eb31fa05d39b" + integrity sha512-9mhbjUk76BiSluiiW4BaYyI58KSbDMMQpCLdsAR+RsT2GyATiNYxVv+pGWRrekmsIdY3I+hOqsYQSTkc8L/mcg== dependencies: "@ethersproject/address" "^5.4.0" "@ethersproject/bignumber" "^5.4.0" @@ -355,10 +356,10 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/properties" "^5.4.0" -"@ethersproject/bignumber@5.4.1", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.7", "@ethersproject/bignumber@^5.4.0": - version "5.4.1" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.4.1.tgz#64399d3b9ae80aa83d483e550ba57ea062c1042d" - integrity sha512-fJhdxqoQNuDOk6epfM7yD6J8Pol4NUCy1vkaGAkuujZm0+lNow//MKu1hLhRiYV4BsOHyBv5/lsTjF+7hWwhJg== +"@ethersproject/bignumber@5.4.2", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.7", "@ethersproject/bignumber@^5.4.0": + version "5.4.2" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.4.2.tgz#44232e015ae4ce82ac034de549eb3583c71283d8" + integrity sha512-oIBDhsKy5bs7j36JlaTzFgNPaZjiNDOXsdSgSpXRucUl+UA6L/1YLlFeI3cPAoodcenzF4nxNPV13pcy7XbWjA== dependencies: "@ethersproject/bytes" "^5.4.0" "@ethersproject/logger" "^5.4.0" @@ -453,10 +454,10 @@ "@ethersproject/bytes" "^5.4.0" js-sha3 "0.5.7" -"@ethersproject/logger@5.4.0", "@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.5", "@ethersproject/logger@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.4.0.tgz#f39adadf62ad610c420bcd156fd41270e91b3ca9" - integrity sha512-xYdWGGQ9P2cxBayt64d8LC8aPFJk6yWCawQi/4eJ4+oJdMMjEBMrIcIMZ9AxhwpPVmnBPrsB10PcXGmGAqgUEQ== +"@ethersproject/logger@5.4.1", "@ethersproject/logger@>=5.0.0-beta.129", "@ethersproject/logger@^5.0.5", "@ethersproject/logger@^5.4.0": + version "5.4.1" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.4.1.tgz#503bd33683538b923c578c07d1c2c0dd18672054" + integrity sha512-DZ+bRinnYLPw1yAC64oRl0QyVZj43QeHIhVKfD/+YwSz4wsv1pfwb5SOFjz+r710YEWzU6LrhuSjpSO+6PeE4A== "@ethersproject/networks@5.4.2", "@ethersproject/networks@^5.4.0": version "5.4.2" @@ -473,17 +474,17 @@ "@ethersproject/bytes" "^5.4.0" "@ethersproject/sha2" "^5.4.0" -"@ethersproject/properties@5.4.0", "@ethersproject/properties@>=5.0.0-beta.131", "@ethersproject/properties@^5.0.3", "@ethersproject/properties@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.4.0.tgz#38ba20539b44dcc5d5f80c45ad902017dcdbefe7" - integrity sha512-7jczalGVRAJ+XSRvNA6D5sAwT4gavLq3OXPuV/74o3Rd2wuzSL035IMpIMgei4CYyBdialJMrTqkOnzccLHn4A== +"@ethersproject/properties@5.4.1", "@ethersproject/properties@>=5.0.0-beta.131", "@ethersproject/properties@^5.0.3", "@ethersproject/properties@^5.4.0": + version "5.4.1" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.4.1.tgz#9f051f976ce790142c6261ccb7b826eaae1f2f36" + integrity sha512-cyCGlF8wWlIZyizsj2PpbJ9I7rIlUAfnHYwy/T90pdkSn/NFTa5YWZx2wTJBe9V7dD65dcrrEMisCRUJiq6n3w== dependencies: "@ethersproject/logger" "^5.4.0" -"@ethersproject/providers@5.4.4": - version "5.4.4" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.4.4.tgz#6729120317942fc0ab0ecdb35e944ec6bbedb795" - integrity sha512-mQevyXj2X2D3l8p/JGDYFZbODhZjW6On15DnCK4Xc9y6b+P0vqorQC/j46omWSm4cyo7BQ/rgfhXNYmvAfyZoQ== +"@ethersproject/providers@5.4.5": + version "5.4.5" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.4.5.tgz#eb2ea2a743a8115f79604a8157233a3a2c832928" + integrity sha512-1GkrvkiAw3Fj28cwi1Sqm8ED1RtERtpdXmRfwIBGmqBSN5MoeRUHuwHPppMtbPayPgpFcvD7/Gdc9doO5fGYgw== dependencies: "@ethersproject/abstract-provider" "^5.4.0" "@ethersproject/abstract-signer" "^5.4.0" @@ -656,17 +657,6 @@ fastfile "0.0.19" ffjavascript "^0.2.30" -"@metamask/eth-sig-util@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-4.0.0.tgz#11553ba06de0d1352332c1bde28c8edd00e0dcf6" - integrity sha512-LczOjjxY4A7XYloxzyxJIHONELmUxVZncpOLoClpEcTiebiVdM46KRPYXGuULro9oNNR2xdVx3yoKiQjdfWmoA== - dependencies: - ethereumjs-abi "^0.6.8" - ethereumjs-util "^6.2.1" - ethjs-util "^0.1.6" - tweetnacl "^1.0.3" - tweetnacl-util "^0.15.1" - "@nomiclabs/hardhat-ethers@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz#c472abcba0c5185aaa4ad4070146e95213c68511" @@ -685,7 +675,12 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-3.4.2.tgz#2c2a1b0fa748235a1f495b6489349776365c51b3" integrity sha512-mDlBS17ymb2wpaLcrqRYdnBAmP1EwqhOXMvqWk2c5Q1N1pm5TkiCtXM9Xzznh4bYsQBq0aIWEkFFE2+iLSN1Tw== -"@openzeppelin/contracts@git+https://github.com/tornadocash/openzeppelin-contracts.git#6e46aa6946a7f215e7604169ddf46e1aebea850f": +"@openzeppelin/contracts@3.2.2-solc-0.7": + version "3.2.2-solc-0.7" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.2.2-solc-0.7.tgz#8ab169da64438d59f47ca285f1a10efe2f9ba19e" + integrity sha512-vFV53E4pvfsAEjzL9Um2VX9MEuXyq7Hyd9JjnP77AGsrEPxkJaYS06zZIVyhAt3rXTM6QGdW0C282Zv7fM93AA== + +"@openzeppelin@git+https://github.com/tornadocash/openzeppelin-contracts.git#6e46aa6946a7f215e7604169ddf46e1aebea850f": version "3.4.1-solc-0.7-2" resolved "git+https://github.com/tornadocash/openzeppelin-contracts.git#6e46aa6946a7f215e7604169ddf46e1aebea850f" @@ -840,9 +835,12 @@ ethers "^5.0.2" "@typechain/ethers-v5@^7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-7.0.1.tgz#f9ae60ae5bd9e8ea8a996f66244147e8e74034ae" - integrity sha512-mXEJ7LG0pOYO+MRPkHtbf30Ey9X2KAsU0wkeoVvjQIn7iAY6tB3k3s+82bbmJAUMyENbQ04RDOZit36CgSG6Gg== + version "7.1.2" + resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-7.1.2.tgz#dbf31663f75cc50f2d9ad232f6e354c6a3e81465" + integrity sha512-sD4HVkTL5aIJa3Ft+CmqiOapba0zzZ8xa+QywcWH40Rm/dcxvZWwcCMnnI3En0JebkxOcAVfH3do+kQ9rKSxYw== + dependencies: + lodash "^4.17.15" + ts-essentials "^7.0.1" "@typechain/hardhat@^2.3.0": version "2.3.0" @@ -871,9 +869,9 @@ "@types/node" "*" "@types/chai@*": - version "4.2.21" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.21.tgz#9f35a5643129df132cf3b5c1ec64046ea1af0650" - integrity sha512-yd+9qKmJxm496BOV9CMNaey8TWsikaZOwMRwPHQIjcOJM9oV+fi9ZMNw3JsVnbEEbo2gRTDnGEBv8pjyn67hNg== + version "4.2.22" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.22.tgz#47020d7e4cf19194d43b5202f35f75bd2ad35ce7" + integrity sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ== "@types/level-errors@*": version "3.0.0" @@ -910,14 +908,14 @@ form-data "^3.0.0" "@types/node@*": - version "16.6.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.6.2.tgz#331b7b9f8621c638284787c5559423822fdffc50" - integrity sha512-LSw8TZt12ZudbpHc6EkIyDM3nHVWKYrAvGy6EAJfNfjusbwnThqjqxUKKRwuV3iWYeW/LYMzNgaq3MaLffQ2xA== + version "16.10.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.3.tgz#7a8f2838603ea314d1d22bb3171d899e15c57bd5" + integrity sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ== "@types/node@^12.12.6": - version "12.20.19" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.19.tgz#538e61fc220f77ae4a4663c3d8c3cb391365c209" - integrity sha512-niAuZrwrjKck4+XhoCw6AAVQBENHftpXw9F4ryk66fTgYaKQ53R4FI7c9vUGGw5vQis1HKBHDR1gcYI/Bq1xvw== + version "12.20.28" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.28.tgz#4b20048c6052b5f51a8d5e0d2acbf63d5a17e1e2" + integrity sha512-cBw8gzxUPYX+/5lugXIPksioBSbE42k0fZ39p+4yRzfYjN6++eq9kAPdlY9qm+MXyfbk9EmvCYAYRn380sF46w== "@types/pbkdf2@^3.0.0": version "3.1.0" @@ -927,9 +925,9 @@ "@types/node" "*" "@types/prettier@^2.1.1": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.3.2.tgz#fc8c2825e4ed2142473b4a81064e6e081463d1b3" - integrity sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog== + version "2.4.1" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.1.tgz#e1303048d5389563e130f5bdd89d37a99acb75eb" + integrity sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw== "@types/resolve@^0.0.8": version "0.0.8" @@ -954,9 +952,9 @@ "@types/sinon" "*" "@types/sinon@*": - version "10.0.2" - resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.2.tgz#f360d2f189c0fd433d14aeb97b9d705d7e4cc0e4" - integrity sha512-BHn8Bpkapj8Wdfxvh2jWIUoaYB/9/XhsL0oOvBfRagJtKlSl9NWPcFOz2lRukI9szwGxFtYZCTejJSqsGDbdmw== + version "10.0.4" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.4.tgz#9332527665692b9f6826afe017f342a3ac6120f4" + integrity sha512-fOYjrxQv8zJsqOY6V6ecP4eZhQBxtY80X0er1VVnUIAIZo74jHm8e1vguG5Yt4Iv8W2Wr7TgibB8MfRe32k9pA== dependencies: "@sinonjs/fake-timers" "^7.1.0" @@ -1096,9 +1094,9 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.9.1: uri-js "^4.2.2" ajv@^8.0.1: - version "8.6.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.2.tgz#2fb45e0e5fcbc0813326c1c3da535d1881bb0571" - integrity sha512-9807RlWAgT564wT+DjeyU5OFMPjmzxVobvDFmNAhY+5zD6A2ly3jDp6sgnfyDtlIQ+7H97oc/DGCzzfu9rjw9w== + version "8.6.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.3.tgz#11a66527761dc3e9a3845ea775d2d3c0414e8764" + integrity sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -1142,10 +1140,10 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== -ansi-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" - integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^2.2.1: version "2.2.1" @@ -1323,10 +1321,10 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -available-typed-arrays@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz#9e0ae84ecff20caae6a94a1c3bc39b955649b7a9" - integrity sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA== +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== aws-sign2@~0.7.0: version "0.7.0" @@ -1338,6 +1336,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== +axios@^0.21.0: + version "0.21.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" + integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== + dependencies: + follow-redirects "^1.14.0" + babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -1919,11 +1924,11 @@ bech32@1.1.4: integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== big-integer@^1.6.42, big-integer@^1.6.43, big-integer@^1.6.48: - version "1.6.48" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e" - integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w== + version "1.6.49" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.49.tgz#f6817d3ea5d4f3fb19e24df9f4b1b4471a8328ce" + integrity sha512-KJ7VhqH+f/BOt9a3yMwJNmcZjG53ijWMTjSAGMveQWyLwqIiwkjNP5PFgDob3Snnx86SjDj6I89fIbv0dkQeNw== -bignumber.js@^9.0.0: +bignumber.js@^9.0.0, bignumber.js@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5" integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA== @@ -2172,9 +2177,9 @@ buffer@^5.0.5, buffer@^5.2.1, buffer@^5.5.0, buffer@^5.6.0: ieee754 "^1.1.13" bufferutil@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.3.tgz#66724b756bed23cd7c28c4d306d7994f9943cc6b" - integrity sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw== + version "4.0.4" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.4.tgz#ab81373d313a6ead0d734e98c448c722734ae7bb" + integrity sha512-VNxjXUCrF3LvbLgwfkTb5LsFvk6pGIn7OBb9x+3o+iJ6mKw0JTUp4chBFc88hi1aspeZGeZG9jAIbpFYPQSLZw== dependencies: node-gyp-build "^4.2.0" @@ -2263,9 +2268,9 @@ camelcase@^6.0.0: integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== caniuse-lite@^1.0.30000844: - version "1.0.30001251" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz#6853a606ec50893115db660f82c094d18f096d85" - integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A== + version "1.0.30001265" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz#0613c9e6c922e422792e6fcefdf9a3afeee4f8c3" + integrity sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw== caseless@~0.12.0: version "0.12.0" @@ -2304,6 +2309,14 @@ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -2689,9 +2702,9 @@ cookie@^0.4.1: integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== cookiejar@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c" - integrity sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA== + version "2.1.3" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.3.tgz#fc7a6216e408e74414b90230050842dacda75acc" + integrity sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ== copy-descriptor@^0.1.0: version "0.1.1" @@ -2699,20 +2712,25 @@ copy-descriptor@^0.1.0: integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js-pure@^3.0.1: - version "3.16.2" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.16.2.tgz#0ef4b79cabafb251ea86eb7d139b42bd98c533e8" - integrity sha512-oxKe64UH049mJqrKkynWp6Vu0Rlm/BTXO/bJZuN2mmR3RtOFNepLlSWDd1eo16PzHpQAoNG97rLU1V/YxesJjw== + version "3.18.2" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.18.2.tgz#d8cc11d4885ea919f3de776d45e720e4c769d406" + integrity sha512-4hMMLUlZhKJKOWbbGD1/VDUxGPEhEoN/T01k7bx271WiBKCvCfkgPzy0IeRS4PB50p6/N1q/SZL4B/TRsTE5bA== core-js@^2.4.0, core-js@^2.5.0: version "2.6.12" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== -core-util-is@1.0.2, core-util-is@~1.0.0: +core-util-is@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + cors@^2.8.1: version "2.8.5" resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" @@ -2834,7 +2852,7 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@4, debug@4.3.2, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.3.2" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== @@ -2897,9 +2915,9 @@ deep-equal@~1.1.1: regexp.prototype.flags "^1.2.0" deep-is@^0.1.3, deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== defer-to-connect@^1.0.1: version "1.1.3" @@ -3029,6 +3047,11 @@ dotenv@^10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dotenv@^8.2.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b" + integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== + dotignore@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/dotignore/-/dotignore-0.1.2.tgz#f942f2200d28c3a76fbdd6f0ee9f3257c8a2e905" @@ -3062,9 +3085,9 @@ ejs@^3.0.1, ejs@^3.1.6: jake "^10.6.1" electron-to-chromium@^1.3.47: - version "1.3.812" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.812.tgz#4c4fb407e0e1335056097f172e9f2c0a09efe77d" - integrity sha512-7KiUHsKAWtSrjVoTSzxQ0nPLr/a+qoxNZwkwd9LkylTOgOXSVXkQbpIVT0WAUQcI5gXq3SwOTCrK+WfINHOXQg== + version "1.3.860" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.860.tgz#d612e54ed75fa524c12af8da3ad8121ebfe2802b" + integrity sha512-gWwGZ+Wv4Mou2SJRH6JQzhTPjL5f95SX7n6VkLTQ/Q/INsZLZNQ1vH2GlZjozKyvT0kkFuCmWTwIoCj+/hUDPw== elliptic@6.5.4, elliptic@^6.4.0, elliptic@^6.5.2, elliptic@^6.5.3: version "6.5.4" @@ -3146,6 +3169,21 @@ env-paths@^2.2.0: resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== +envalid@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/envalid/-/envalid-6.0.2.tgz#7139770e089acc945c0e47b5075d72915d8683e8" + integrity sha512-ChJb9a5rjwZ/NkcXfBrzEl5cFZaGLg38N7MlWJkv5qsmSypX2WJe28LkoAWcklC60nKZXYKRlBbsjuJSjYw0Xg== + dependencies: + chalk "^3.0.0" + dotenv "^8.2.0" + meant "^1.0.1" + validator "^13.0.0" + +err-code@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" + integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== + errno@~0.1.1: version "0.1.8" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -3160,22 +3198,25 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.18.0-next.2, es-abstract@^1.18.5: - version "1.18.5" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.5.tgz#9b10de7d4c206a3581fd5b2124233e04db49ae19" - integrity sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA== +es-abstract@^1.18.5, es-abstract@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" + integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== dependencies: call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" has "^1.0.3" has-symbols "^1.0.2" internal-slot "^1.0.3" - is-callable "^1.2.3" + is-callable "^1.2.4" is-negative-zero "^2.0.1" - is-regex "^1.1.3" - is-string "^1.0.6" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.1" + is-string "^1.0.7" + is-weakref "^1.0.1" object-inspect "^1.11.0" object-keys "^1.1.1" object.assign "^4.1.2" @@ -3244,9 +3285,9 @@ eslint-config-prettier@^8.3.0: integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== eslint-plugin-prettier@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7" - integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw== + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz#e9ddb200efb6f3d05ffe83b1665a716af4a387e5" + integrity sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g== dependencies: prettier-linter-helpers "^1.0.0" @@ -3734,7 +3775,7 @@ ethereumjs-tx@^1.1.1, ethereumjs-tx@^1.2.0, ethereumjs-tx@^1.2.2, ethereumjs-tx@ ethereum-common "^0.0.18" ethereumjs-util "^5.0.0" -ethereumjs-util@6.2.1, ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@^6.2.0, ethereumjs-util@^6.2.1: +ethereumjs-util@6.2.1, ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@^6.2.0: version "6.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== @@ -3771,19 +3812,7 @@ ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereum rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-util@^7.0.10, ethereumjs-util@^7.0.2, ethereumjs-util@^7.0.7, ethereumjs-util@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz#e2b43a30bfcdbcb432a4eb42bd5f2393209b3fd5" - integrity sha512-kR+vhu++mUDARrsMMhsjjzPduRVAeundLGXucGRHF3B4oEltOUspfgCVco4kckucj3FMlLaZHUl9n7/kdmr6Tw== - dependencies: - "@types/bn.js" "^5.1.0" - bn.js "^5.1.2" - create-hash "^1.1.2" - ethereum-cryptography "^0.1.3" - ethjs-util "0.1.6" - rlp "^2.2.4" - -ethereumjs-util@^7.1.2: +ethereumjs-util@^7.0.10, ethereumjs-util@^7.0.2, ethereumjs-util@^7.1.0, ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.2.tgz#cfd79a9a3f5cdc042d1abf29964de9caf10ec238" integrity sha512-xCV3PTAhW8Q2k88XZn9VcO4OrjpeXAlDm5LQTaOLp81SjNSSY6+MwuGXrx6vafOMheWSmZGxIXUbue5e9UvUBw== @@ -3848,18 +3877,18 @@ ethereumjs-wallet@0.6.5: utf8 "^3.0.0" uuid "^3.3.2" -ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.2: - version "5.4.5" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.4.5.tgz#cec133b9f5b514dc55e2561ee7aa7218c33affd7" - integrity sha512-PPZ6flOAj230sXEWf/r/It6ZZ5c7EOVWx+PU87Glkbg79OtT7pLE1WgL4MRdwx6iF7HzSOvUUI+8cAmcdzo12w== +ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.2, ethers@^5.4.7: + version "5.4.7" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.4.7.tgz#0fd491a5da7c9793de2d6058d76b41b1e7efba8f" + integrity sha512-iZc5p2nqfWK1sj8RabwsPM28cr37Bpq7ehTQ5rWExBr2Y09Sn1lDKZOED26n+TsZMye7Y6mIgQ/1cwpSD8XZew== dependencies: - "@ethersproject/abi" "5.4.0" + "@ethersproject/abi" "5.4.1" "@ethersproject/abstract-provider" "5.4.1" "@ethersproject/abstract-signer" "5.4.1" "@ethersproject/address" "5.4.0" "@ethersproject/base64" "5.4.0" "@ethersproject/basex" "5.4.0" - "@ethersproject/bignumber" "5.4.1" + "@ethersproject/bignumber" "5.4.2" "@ethersproject/bytes" "5.4.0" "@ethersproject/constants" "5.4.0" "@ethersproject/contracts" "5.4.1" @@ -3867,11 +3896,11 @@ ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.2: "@ethersproject/hdnode" "5.4.0" "@ethersproject/json-wallets" "5.4.0" "@ethersproject/keccak256" "5.4.0" - "@ethersproject/logger" "5.4.0" + "@ethersproject/logger" "5.4.1" "@ethersproject/networks" "5.4.2" "@ethersproject/pbkdf2" "5.4.0" - "@ethersproject/properties" "5.4.0" - "@ethersproject/providers" "5.4.4" + "@ethersproject/properties" "5.4.1" + "@ethersproject/providers" "5.4.5" "@ethersproject/random" "5.4.0" "@ethersproject/rlp" "5.4.0" "@ethersproject/sha2" "5.4.0" @@ -3892,7 +3921,7 @@ ethjs-unit@0.1.6: bn.js "4.11.6" number-to-bn "1.7.0" -ethjs-util@0.1.6, ethjs-util@^0.1.3, ethjs-util@^0.1.6: +ethjs-util@0.1.6, ethjs-util@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== @@ -3991,11 +4020,11 @@ express@^4.14.0: vary "~1.1.2" ext@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" - integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + version "1.6.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" + integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== dependencies: - type "^2.0.0" + type "^2.5.0" extend-shallow@^2.0.1: version "2.0.1" @@ -4363,10 +4392,10 @@ fnv-plus@^1.3.1: resolved "https://registry.yarnpkg.com/fnv-plus/-/fnv-plus-1.3.1.tgz#c34cb4572565434acb08ba257e4044ce2b006d67" integrity sha512-Gz1EvfOneuFfk4yG458dJ3TLJ7gV19q3OM/vVvvHf7eT02Hm1DleB4edsia6ahbKgAYxO9gvyQ1ioWZR+a00Yw== -follow-redirects@^1.12.1: - version "1.14.2" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.2.tgz#cecb825047c00f5e66b142f90fed4f515dec789b" - integrity sha512-yLR6WaE2lbF0x4K2qE2p9PEXKLDjUjnR/xmjS3wHAYxtlsI9MLLBJUZirAHKzUZDGLxje7w/cXR49WOUo4rbsA== +follow-redirects@^1.12.1, follow-redirects@^1.14.0: + version "1.14.4" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379" + integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g== for-each@^0.3.3, for-each@~0.3.3: version "0.3.3" @@ -4586,6 +4615,14 @@ get-stream@^5.1.0: dependencies: pump "^3.0.0" +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -4629,7 +4666,7 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.1.7, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6, glob@~7.1.7: +glob@7.1.7, glob@~7.1.7: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== @@ -4641,6 +4678,18 @@ glob@7.1.7, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6, glob@~7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.2, glob@^7.1.3, glob@^7.1.6: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + global@~4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" @@ -4727,9 +4776,9 @@ har-validator@~5.1.3: har-schema "^2.0.0" hardhat@^2.3.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.6.0.tgz#a00a44d36559a880c170dca6363cc33f7545364b" - integrity sha512-NEM2pe11QXWXB7k49heOLQA9vxihG4DJ0712KjMT9NYSZgLOMcWswJ3tvn+/ND6vzLn6Z4pqr2x/kWSfllWFuw== + version "2.6.5" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.6.5.tgz#61d3e22da34e1b175bbe599f77396b32f9788b58" + integrity sha512-sBhREWZjQTtR/KMMp2F3ySuDqL0norjNq68geR3nlXRHXYKuNKeL7xqVsmldekt3sVB5Wh1WX7xDX79kvUr+fA== dependencies: "@ethereumjs/block" "^3.4.0" "@ethereumjs/blockchain" "^5.4.0" @@ -5003,9 +5052,9 @@ immediate@~3.2.3: integrity sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw= immutable@^4.0.0-rc.12: - version "4.0.0-rc.14" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.14.tgz#29ba96631ec10867d1348515ac4e6bdba462f071" - integrity sha512-pfkvmRKJSoW7JFx0QeYlAmT+kNYvn5j0u7bnpNq4N2RCvHSTlLT208G8jgaquNe+Q8kCPHKOSpxJkyvLDpYq0w== + version "4.0.0-rc.15" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.15.tgz#c30056f05eaaf5650fd15230586688fdd15c54bc" + integrity sha512-v8+A3sNyaieoP9dHegl3tEYnIZa7vqNiSv0U6D7YddiZi34VjKy4GsIxrRHj2d8+CS3MeiVja5QyNe4JO/aEXA== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" @@ -5154,7 +5203,7 @@ is-buffer@~2.0.3: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== -is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.3: +is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== @@ -5167,9 +5216,9 @@ is-ci@^2.0.0: ci-info "^2.0.0" is-core-module@^2.2.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19" - integrity sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ== + version "2.7.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.7.0.tgz#3c0ef7d31b4acfc574f80c58409d568a836848e3" + integrity sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ== dependencies: has "^1.0.3" @@ -5274,9 +5323,9 @@ is-generator-function@^1.0.7: has-tostringtag "^1.0.0" is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" @@ -5331,7 +5380,7 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" -is-regex@^1.0.4, is-regex@^1.1.3, is-regex@~1.1.3: +is-regex@^1.0.4, is-regex@^1.1.4, is-regex@~1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== @@ -5344,12 +5393,17 @@ is-retry-allowed@^1.0.0: resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg== +is-shared-array-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" + integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== + is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= -is-string@^1.0.5, is-string@^1.0.6: +is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== @@ -5363,12 +5417,12 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: dependencies: has-symbols "^1.0.2" -is-typed-array@^1.1.3, is-typed-array@^1.1.6: - version "1.1.7" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.7.tgz#881ddc660b13cb8423b2090fa88c0fe37a83eb2f" - integrity sha512-VxlpTBGknhQ3o7YiVjIhdLU6+oD8dPz/79vvvH4F+S/c8608UCVa9fgDpa1kZgFoUST2DCgacc70UszKgzKuvA== +is-typed-array@^1.1.3, is-typed-array@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.8.tgz#cbaa6585dc7db43318bc5b89523ea384a6f65e79" + integrity sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA== dependencies: - available-typed-arrays "^1.0.4" + available-typed-arrays "^1.0.5" call-bind "^1.0.2" es-abstract "^1.18.5" foreach "^2.0.5" @@ -5394,6 +5448,13 @@ is-utf8@^0.2.0: resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= +is-weakref@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2" + integrity sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ== + dependencies: + call-bind "^1.0.0" + is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -5630,7 +5691,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -keccak@3.0.1, keccak@^3.0.0: +keccak@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" integrity sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA== @@ -5648,6 +5709,15 @@ keccak@^2.0.0: nan "^2.14.0" safe-buffer "^5.2.0" +keccak@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" + integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + keyv@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" @@ -6101,11 +6171,9 @@ map-visit@^1.0.0: object-visit "^1.0.0" mcl-wasm@^0.7.1: - version "0.7.8" - resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.8.tgz#4d0dc5a92f7bd20892fd3fcd41764acf86fd1e6e" - integrity sha512-qNHlYO6wuEtSoH5A8TcZfCEHtw8gGPqF6hLZpQn2SVd/Mck0ELIKOkmj072D98S9B9CI/jZybTUC96q1P2/ZDw== - dependencies: - typescript "^4.3.4" + version "0.7.9" + resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" + integrity sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ== md5.js@^1.3.4: version "1.3.5" @@ -6116,6 +6184,11 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +meant@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/meant/-/meant-1.0.3.tgz#67769af9de1d158773e928ae82c456114903554c" + integrity sha512-88ZRGcNxAq4EH38cQ4D85PM57pikCwS8Z99EWHODxN7KBY+UuPiqzRTtZzS8KTXO/ywSWbdjjJST2Hly/EQxLw== + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -6203,7 +6276,7 @@ merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: rlp "^2.0.0" semaphore ">=1.0.1" -merkle-patricia-tree@^4.2.0: +merkle-patricia-tree@^4.2.0, merkle-patricia-tree@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.1.tgz#fc43e7b162e597a0720ccdd702bf1d49765691d2" integrity sha512-25reMgrT8PhJy0Ba0U7fMZD2oobS1FPWB9vQa0uBpJYIQYYuFXEHoqEkTqA/UzX+s9br3pmUVVY/TOsFt/x0oQ== @@ -6256,17 +6329,17 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@1.49.0: - version "1.49.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.49.0.tgz#f3dfde60c99e9cf3bc9701d687778f537001cbed" - integrity sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA== +mime-db@1.50.0: + version "1.50.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.50.0.tgz#abd4ac94e98d3c0e185016c67ab45d5fde40c11f" + integrity sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A== mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24: - version "2.1.32" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.32.tgz#1d00e89e7de7fe02008db61001d9e02852670fd5" - integrity sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A== + version "2.1.33" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.33.tgz#1fa12a904472fafd068e48d9e8401f74d3f70edb" + integrity sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g== dependencies: - mime-db "1.49.0" + mime-db "1.50.0" mime@1.6.0: version "1.6.0" @@ -6360,9 +6433,9 @@ mkdirp@0.5.5, mkdirp@^0.5.1, mkdirp@^0.5.5: minimist "^1.2.5" mnemonist@^0.38.0: - version "0.38.3" - resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.38.3.tgz#35ec79c1c1f4357cfda2fe264659c2775ccd7d9d" - integrity sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw== + version "0.38.4" + resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.38.4.tgz#5d2f2dc4386aef78bfadeea60ce704dcf0ef8f3d" + integrity sha512-mflgW0gEWmVLbDDE2gJbOh3+RltTN7CgV9jV25qyCnyLN9FtoltWr7ZtAEDeD9u8W4oFAoolR6fBWieXdn3u8Q== dependencies: obliterator "^1.6.1" @@ -6428,15 +6501,15 @@ mocha@^8.2.1: yargs-unparser "2.0.0" mocha@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.1.0.tgz#0a7aa6fc4f59d1015d4e11747d9104b752553c67" - integrity sha512-Kjg/XxYOFFUi0h/FwMOeb6RoroiZ+P1yOfya6NK7h3dNhahrJx1r2XIT3ge4ZQvJM86mdjNA+W5phqRQh7DwCg== + version "9.1.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.1.2.tgz#93f53175b0f0dc4014bd2d612218fccfcf3534d3" + integrity sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" chokidar "3.5.2" - debug "4.3.1" + debug "4.3.2" diff "5.0.0" escape-string-regexp "4.0.0" find-up "5.0.0" @@ -6447,12 +6520,11 @@ mocha@^9.1.0: log-symbols "4.1.0" minimatch "3.0.4" ms "2.1.3" - nanoid "3.1.23" + nanoid "3.1.25" serialize-javascript "6.0.0" strip-json-comments "3.1.1" supports-color "8.1.1" which "2.0.2" - wide-align "1.1.3" workerpool "6.1.5" yargs "16.2.0" yargs-parser "20.2.4" @@ -6548,10 +6620,10 @@ nanoid@3.1.20: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== -nanoid@3.1.23: - version "3.1.23" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81" - integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw== +nanoid@3.1.25: + version "3.1.25" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152" + integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q== nanomatch@^1.2.9: version "1.2.13" @@ -6603,11 +6675,18 @@ node-environment-flags@1.0.6: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@2.6.1, node-fetch@^2.6.0, node-fetch@^2.6.1: +node-fetch@2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== +node-fetch@^2.6.0, node-fetch@^2.6.1: + version "2.6.5" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.5.tgz#42735537d7f080a7e5f78b6c549b7146be1742fd" + integrity sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ== + dependencies: + whatwg-url "^5.0.0" + node-fetch@~1.7.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" @@ -6617,9 +6696,9 @@ node-fetch@~1.7.1: is-stream "^1.0.1" node-gyp-build@^4.2.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" - integrity sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg== + version "4.3.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" + integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q== normalize-package-data@^2.3.2: version "2.5.0" @@ -6731,13 +6810,13 @@ object.assign@^4.1.2: object-keys "^1.1.1" object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.2.tgz#1bd63aeacf0d5d2d2f31b5e393b03a7c601a23f7" - integrity sha512-WtxeKSzfBjlzL+F9b7M7hewDzMwy+C8NRssHd1YrNlzHzIDrXcXiNOMrezdAEM4UXixgV+vvnyBeN7Rygl2ttQ== + version "2.1.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.3.tgz#b223cf38e17fefb97a63c10c91df72ccb386df9e" + integrity sha512-VdDoCwvJI4QdC6ndjpqFmoL3/+HxffFBbcJzKi5hwLLqqx3mdbedRpfZDdK0SrOSauj8X4GzBvnDZl4vTN7dOw== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.18.0-next.2" + es-abstract "^1.19.1" object.pick@^1.3.0: version "1.3.0" @@ -6765,6 +6844,19 @@ oboe@2.1.5: dependencies: http-https "^1.0.0" +"omnibridge@git+https://github.com/peppersec/omnibridge.git#aa3a970c29752a4da5f3fc7ccf0733783c1acf0b": + version "1.1.0" + resolved "git+https://github.com/peppersec/omnibridge.git#aa3a970c29752a4da5f3fc7ccf0733783c1acf0b" + dependencies: + "@openzeppelin/contracts" "3.2.2-solc-0.7" + axios "^0.21.0" + bignumber.js "^9.0.1" + dotenv "^8.2.0" + envalid "^6.0.2" + promise-retry "^2.0.1" + querystring "^0.2.0" + web3 "1.3.1" + on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" @@ -7159,9 +7251,9 @@ prettier-linter-helpers@^1.0.0: fast-diff "^1.1.2" prettier-plugin-solidity@^1.0.0-beta.13: - version "1.0.0-beta.17" - resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.17.tgz#fc0fe977202b6503763a338383efeceaa6c7661e" - integrity sha512-YFkxV/rHi1mphi17/XKcJ9QjZlb+L/J0yY2erix21BZfzPv2BN9dfmSRGr/poDp/FBOFSW+jteP2BCMe7HndVQ== + version "1.0.0-beta.18" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.18.tgz#9705453bacd55b3242110d472f23f624ae6777fc" + integrity sha512-ezWdsG/jIeClmYBzg8V9Voy8jujt+VxWF8OS3Vld+C3c+3cPVib8D9l8ahTod7O5Df1anK9zo+WiiS5wb1mLmg== dependencies: "@solidity-parser/parser" "^0.13.2" emoji-regex "^9.2.2" @@ -7171,9 +7263,9 @@ prettier-plugin-solidity@^1.0.0-beta.13: string-width "^4.2.2" prettier@^2.1.2, prettier@^2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d" - integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ== + version "2.4.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" + integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA== printj@~1.1.0: version "1.1.2" @@ -7200,6 +7292,14 @@ progress@^2.0.0: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== +promise-retry@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-2.0.1.tgz#ff747a13620ab57ba688f5fc67855410c370da22" + integrity sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g== + dependencies: + err-code "^2.0.2" + retry "^0.12.0" + promise-to-callback@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/promise-to-callback/-/promise-to-callback-1.0.0.tgz#5d2a749010bfb67d963598fcd3960746a68feef7" @@ -7345,6 +7445,11 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= +querystring@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" + integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== + r1csfile@0.0.16: version "0.0.16" resolved "https://registry.yarnpkg.com/r1csfile/-/r1csfile-0.0.16.tgz#53c66a79b50eebc2d15a1048e39d548ce9da7ccd" @@ -7675,6 +7780,11 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== +retry@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= + rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" @@ -7941,9 +8051,9 @@ side-channel@^1.0.4: object-inspect "^1.9.0" signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + version "3.0.5" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.5.tgz#9e3e8cc0c75a99472b44321033a7702e7738252f" + integrity sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ== simple-concat@^1.0.0: version "1.0.1" @@ -8127,9 +8237,9 @@ source-map-support@^0.4.15: source-map "^0.5.6" source-map-support@^0.5.13: - version "0.5.19" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== + version "0.5.20" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.20.tgz#12166089f8f5e5e8c56926b377633392dd2cb6c9" + integrity sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -8261,23 +8371,23 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" - integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.0" + strip-ansi "^6.0.1" string.prototype.trim@~1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz#6014689baf5efaf106ad031a5fa45157666ed1bd" - integrity sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q== + version "1.2.5" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.5.tgz#a587bcc8bfad8cb9829a577f5de30dd170c1682c" + integrity sha512-Lnh17webJVsD6ECeovpVN17RlAKjmz4rF9S+8Y45CkMc/ufVpTkU3vZIyIC7sllQ1FCvObZnnCdNs/HXTUOTlg== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.18.0-next.2" + es-abstract "^1.19.1" string.prototype.trimend@^1.0.4: version "1.0.4" @@ -8335,12 +8445,12 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: - ansi-regex "^5.0.0" + ansi-regex "^5.0.1" strip-bom@^2.0.0: version "2.0.0" @@ -8432,16 +8542,16 @@ table@^5.2.3: string-width "^3.0.0" table@^6.0.9: - version "6.7.1" - resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2" - integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg== + version "6.7.2" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.2.tgz#a8d39b9f5966693ca8b0feba270a78722cbaf3b0" + integrity sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g== dependencies: ajv "^8.0.1" lodash.clonedeep "^4.5.0" lodash.truncate "^4.4.2" slice-ansi "^4.0.0" - string-width "^4.2.0" - strip-ansi "^6.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" tape@^4.6.3: version "4.14.0" @@ -8608,6 +8718,11 @@ tough-cookie@~2.5.0: psl "^1.1.28" punycode "^2.1.1" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" @@ -8665,7 +8780,7 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tweetnacl-util@^0.15.0, tweetnacl-util@^0.15.1: +tweetnacl-util@^0.15.0: version "0.15.1" resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz#b80fcdb5c97bcc508be18c44a4be50f022eea00b" integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== @@ -8727,7 +8842,7 @@ type@^1.0.1: resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== -type@^2.0.0: +type@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== @@ -8773,11 +8888,6 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^4.3.4: - version "4.3.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" - integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== - typewise-core@^1.2, typewise-core@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/typewise-core/-/typewise-core-1.2.0.tgz#97eb91805c7f55d2f941748fa50d315d991ef195" @@ -8908,9 +9018,9 @@ use@^3.1.0: integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== utf-8-validate@^5.0.2: - version "5.0.5" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.5.tgz#dd32c2e82c72002dc9f02eb67ba6761f43456ca1" - integrity sha512-+pnxRYsS/axEpkrrEpzYfNZGXp0IjC/9RIxwM5gntY4Koi8SHmUGSfxfWqxZdRxrtaoVstuOzUp/rbs3JSPELQ== + version "5.0.6" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.6.tgz#e1b3e0a5cc8648a3b44c1799fbb170d1aaaffe80" + integrity sha512-hoY0gOf9EkCw+nimK21FVKHUIG1BMqSiRwxB/q3A9yKZOrOI99PP77BxmarDqWz6rG3vVYiBWfhG8z2Tl+7fZA== dependencies: node-gyp-build "^4.2.0" @@ -8975,6 +9085,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +validator@^13.0.0: + version "13.6.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.6.0.tgz#1e71899c14cdc7b2068463cb24c1cc16f6ec7059" + integrity sha512-gVgKbdbHgtxpRyR8K0O6oFZPhhB5tT1jeEHZR0Znr9Svg03U0+r9DXWMrnRAB+HtCStDQKlaIZm42tVsVjqtjg== + varint@^5.0.0: version "5.0.2" resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" @@ -9026,9 +9141,9 @@ wasmcurves@0.0.5: blakejs "^1.1.0" web-worker@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.0.0.tgz#c7ced4e1eb6227636ada35056a9e5a477414e4d0" - integrity sha512-BzuMqeKVkKKwHV6tJuwePFcxYMxvC97D448mXTgh/CxXAB4sRtoV26gRPN+JDxsXRR7QZyioMV9O6NzQaASf7Q== + version "1.1.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.1.0.tgz#5cb84a7aab7c36da32965641cf6db6db8adfb794" + integrity sha512-BsAzCx5k71qqjPXD5+nBEiLaH/5glNV1OASF2kB+13qkajkScd70mo0E4U0GyhD9nUGgWmSq8dVUqlIOdfICUg== web3-bzz@1.2.11: version "1.2.11" @@ -9040,10 +9155,20 @@ web3-bzz@1.2.11: swarm-js "^0.1.40" underscore "1.9.1" -web3-bzz@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.5.2.tgz#a04feaa19462cff6d5a8c87dad1aca4619d9dfc8" - integrity sha512-W/sPCdA+XQ9duUYKHAwf/g69cbbV8gTCRsa1MpZwU7spXECiyJ2EvD/QzAZ+UpJk3GELXFF/fUByeZ3VRQKF2g== +web3-bzz@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.3.1.tgz#c7e13e5fbbbe4634b0d883e5440069fc58e58044" + integrity sha512-MN726zFpFpwhs3NMC35diJGkwTVUj+8LM/VWqooGX/MOjgYzNrJ7Wr8EzxoaTCy87edYNBprtxBkd0HzzLmung== + dependencies: + "@types/node" "^12.12.6" + got "9.6.0" + swarm-js "^0.1.40" + underscore "1.9.1" + +web3-bzz@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.6.0.tgz#584b51339f21eedff159abc9239b4b7ef6ded840" + integrity sha512-ugYV6BsinwhIi0CsLWINBz4mqN9wR9vNG0WmyEbdECjxcPyr6vkaWt4qi0zqlUxEnYAwGj4EJXNrbjPILntQTQ== dependencies: "@types/node" "^12.12.6" got "9.6.0" @@ -9058,13 +9183,22 @@ web3-core-helpers@1.2.11: web3-eth-iban "1.2.11" web3-utils "1.2.11" -web3-core-helpers@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.5.2.tgz#b6bd5071ca099ba3f92dfafb552eed2b70af2795" - integrity sha512-U7LJoeUdQ3aY9t5gU7t/1XpcApsWm+4AcW5qKl/44ZxD44w0Dmsq1c5zJm3GuLr/a9MwQfXK4lpmvxVQWHHQRg== +web3-core-helpers@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.3.1.tgz#ffd6f47c1b54a8523f00760a8d713f44d0f97e97" + integrity sha512-tMVU0ScyQUJd/HFWfZrvGf+QmPCodPyKQw1gQ+n9We/H3vPPbUxDjNeYnd4BbYy5O9ox+0XG6i3+JlwiSkgDkA== dependencies: - web3-eth-iban "1.5.2" - web3-utils "1.5.2" + underscore "1.9.1" + web3-eth-iban "1.3.1" + web3-utils "1.3.1" + +web3-core-helpers@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.6.0.tgz#77e161b6ba930a4008a0df804ab379e0aa7e1e7f" + integrity sha512-H/IAH/0mrgvad/oxVKiAMC7qDzMrPPe/nRKmJOoIsupRg9/frvL62kZZiHhqVD1HMyyswbQFC69QRl7JqWzvxg== + dependencies: + web3-eth-iban "1.6.0" + web3-utils "1.6.0" web3-core-method@1.2.11: version "1.2.11" @@ -9078,17 +9212,29 @@ web3-core-method@1.2.11: web3-core-subscriptions "1.2.11" web3-utils "1.2.11" -web3-core-method@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.5.2.tgz#d1d602657be1000a29d11e3ca3bf7bc778dea9a5" - integrity sha512-/mC5t9UjjJoQmJJqO5nWK41YHo+tMzFaT7Tp7jDCQsBkinE68KsUJkt0jzygpheW84Zra0DVp6q19gf96+cugg== +web3-core-method@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.3.1.tgz#c1d8bf1e2104a8d625c99caf94218ad2dc948c92" + integrity sha512-dA38tNVZWTxBFMlLFunLD5Az1AWRi5HqM+AtQrTIhxWCzg7rJSHuaYOZ6A5MHKGPWpdykLhzlna0SsNv5AVs8w== + dependencies: + "@ethersproject/transactions" "^5.0.0-beta.135" + underscore "1.9.1" + web3-core-helpers "1.3.1" + web3-core-promievent "1.3.1" + web3-core-subscriptions "1.3.1" + web3-utils "1.3.1" + +web3-core-method@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.6.0.tgz#ebe4ea51f5a4fa809bb68185576186359d3982e9" + integrity sha512-cHekyEil4mtcCOk6Q1Zh4y+2o5pTwsLIxP6Bpt4BRtZgdsyPiadYJpkLAVT/quch5xN7Qs5ZwG5AvRCS3VwD2g== dependencies: "@ethereumjs/common" "^2.4.0" "@ethersproject/transactions" "^5.0.0-beta.135" - web3-core-helpers "1.5.2" - web3-core-promievent "1.5.2" - web3-core-subscriptions "1.5.2" - web3-utils "1.5.2" + web3-core-helpers "1.6.0" + web3-core-promievent "1.6.0" + web3-core-subscriptions "1.6.0" + web3-utils "1.6.0" web3-core-promievent@1.2.11: version "1.2.11" @@ -9097,10 +9243,17 @@ web3-core-promievent@1.2.11: dependencies: eventemitter3 "4.0.4" -web3-core-promievent@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.5.2.tgz#2dc9fe0e5bbeb7c360fc1aac5f12b32d9949a59b" - integrity sha512-5DacbJXe98ozSor7JlkTNCy6G8945VunRRkPxMk98rUrg60ECVEM/vuefk1atACzjQsKx6tmLZuHxbJQ64TQeQ== +web3-core-promievent@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.3.1.tgz#b4da4b34cd9681e22fcda25994d7629280a1e046" + integrity sha512-jGu7TkwUqIHlvWd72AlIRpsJqdHBQnHMeMktrows2148gg5PBPgpJ10cPFmCCzKT6lDOVh9B7pZMf9eckMDmiA== + dependencies: + eventemitter3 "4.0.4" + +web3-core-promievent@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.6.0.tgz#8b6053ae83cb47164540167fc361469fc604d2dd" + integrity sha512-ZzsevjMXWkhqW9dnVfTfb1OUcK7jKcKPvPIbQ4boJccNgvNZPZKlo8xB4pkAX38n4c59O5mC7Lt/z2QL/M5CeQ== dependencies: eventemitter3 "4.0.4" @@ -9115,16 +9268,28 @@ web3-core-requestmanager@1.2.11: web3-providers-ipc "1.2.11" web3-providers-ws "1.2.11" -web3-core-requestmanager@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.5.2.tgz#43ccc00779394c941b28e6e07e217350fd1ded71" - integrity sha512-oRVW9OrAsXN2JIZt68OEg1Mb1A9a/L3JAGMv15zLEFEnJEGw0KQsGK1ET2kvZBzvpFd5G0EVkYCnx7WDe4HSNw== +web3-core-requestmanager@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.3.1.tgz#6dd2b5161ba778dfffe68994a4accff2decc54fe" + integrity sha512-9WTaN2SoyJX1amRyTzX2FtbVXsyWBI2Wef2Q3gPiWaEo/VRVm3e4Bq8MwxNTUMIJMO8RLGHjtdgsoDKPwfL73Q== + dependencies: + underscore "1.9.1" + util "^0.12.0" + web3-core-helpers "1.3.1" + web3-providers-http "1.3.1" + web3-providers-ipc "1.3.1" + web3-providers-ws "1.3.1" + +web3-core-requestmanager@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.6.0.tgz#8ef3a3b89cd08983bd94574f9c5893f70a8a6aea" + integrity sha512-CY5paPdiDXKTXPWaEUZekDfUXSuoE2vPxolwqzsvKwFWH5+H1NaXgrc+D5HpufgSvTXawTw0fy7IAicg8+PWqA== dependencies: util "^0.12.0" - web3-core-helpers "1.5.2" - web3-providers-http "1.5.2" - web3-providers-ipc "1.5.2" - web3-providers-ws "1.5.2" + web3-core-helpers "1.6.0" + web3-providers-http "1.6.0" + web3-providers-ipc "1.6.0" + web3-providers-ws "1.6.0" web3-core-subscriptions@1.2.11: version "1.2.11" @@ -9135,13 +9300,22 @@ web3-core-subscriptions@1.2.11: underscore "1.9.1" web3-core-helpers "1.2.11" -web3-core-subscriptions@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.5.2.tgz#8eaebde44f81fc13c45b555c4422fe79393da9cf" - integrity sha512-hapI4rKFk22yurtIv0BYvkraHsM7epA4iI8Np+HuH6P9DD0zj/llaps6TXLM9HyacLBRwmOLZmr+pHBsPopUnQ== +web3-core-subscriptions@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.3.1.tgz#be1103259f91b7fc7f4c6a867aa34dea70a636f7" + integrity sha512-eX3N5diKmrxshc6ZBZ8EJxxAhCxdYPbYXuF2EfgdIyHmxwmYqIVvKepzO8388Bx8JD3D0Id/pKE0dC/FnDIHTQ== dependencies: eventemitter3 "4.0.4" - web3-core-helpers "1.5.2" + underscore "1.9.1" + web3-core-helpers "1.3.1" + +web3-core-subscriptions@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.6.0.tgz#8c23b15b434a7c9f937652ecca45d7108e2c54df" + integrity sha512-kY9WZUY/m1URSOv3uTLshoZD9ZDiFKReIzHuPUkxFpD5oYNmr1/aPQNPCrrMxKODR7UVX/D90FxWwCYqHhLaxQ== + dependencies: + eventemitter3 "4.0.4" + web3-core-helpers "1.6.0" web3-core@1.2.11: version "1.2.11" @@ -9156,18 +9330,31 @@ web3-core@1.2.11: web3-core-requestmanager "1.2.11" web3-utils "1.2.11" -web3-core@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.5.2.tgz#ca2b9b1ed3cf84d48b31c9bb91f7628f97cfdcd5" - integrity sha512-sebMpQbg3kbh3vHUbHrlKGKOxDWqjgt8KatmTBsTAWj/HwWYVDzeX+2Q84+swNYsm2DrTBVFlqTErFUwPBvyaA== +web3-core@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.3.1.tgz#fb0fc5d952a7f3d580a7e6155d2f28be064e64cb" + integrity sha512-QlBwSyjl2pqYUBE7lH9PfLxa8j6AzzAtvLUqkgoaaFJYLP/+XavW1n6dhVCTq+U3L3eNc+bMp9GLjGDJNXMnGg== dependencies: "@types/bn.js" "^4.11.5" "@types/node" "^12.12.6" bignumber.js "^9.0.0" - web3-core-helpers "1.5.2" - web3-core-method "1.5.2" - web3-core-requestmanager "1.5.2" - web3-utils "1.5.2" + web3-core-helpers "1.3.1" + web3-core-method "1.3.1" + web3-core-requestmanager "1.3.1" + web3-utils "1.3.1" + +web3-core@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.6.0.tgz#144eb00f651c9812faf7176abd7ee99d5f45e212" + integrity sha512-o0WsLrJ2yD+HAAc29lGMWJef/MutTyuzpJC0UzLJtIAQJqtpDalzWINEu4j8XYXGk34N/V6vudtzRPo23QEE6g== + dependencies: + "@types/bn.js" "^4.11.5" + "@types/node" "^12.12.6" + bignumber.js "^9.0.0" + web3-core-helpers "1.6.0" + web3-core-method "1.6.0" + web3-core-requestmanager "1.6.0" + web3-utils "1.6.0" web3-eth-abi@1.2.11: version "1.2.11" @@ -9178,13 +9365,22 @@ web3-eth-abi@1.2.11: underscore "1.9.1" web3-utils "1.2.11" -web3-eth-abi@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.5.2.tgz#b627eada967f39ae4657ddd61b693cb00d55cb29" - integrity sha512-P3bJbDR5wib4kWGfVeBKBVi27T+AiHy4EJxYM6SMNbpm3DboLDdisu9YBd6INMs8rzxgnprBbGmmyn4jKIDKAA== +web3-eth-abi@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.3.1.tgz#d60fe5f15c7a3a426c553fdaa4199d07f1ad899c" + integrity sha512-ds4aTeKDUEqTXgncAtxvcfMpPiei9ey7+s2ZZ+OazK2CK5jWhFiJuuj9Q68kOT+hID7E1oSDVsNmJWFD/7lbMw== dependencies: "@ethersproject/abi" "5.0.7" - web3-utils "1.5.2" + underscore "1.9.1" + web3-utils "1.3.1" + +web3-eth-abi@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.6.0.tgz#4225608f61ebb0607d80849bb2b20f910780253d" + integrity sha512-fImomGE9McuTMJLwK8Tp0lTUzXqCkWeMm00qPVIwpJ/h7lCw9UFYV9+4m29wSqW6FF+FIZKwc6UBEf9dlx3orA== + dependencies: + "@ethersproject/abi" "5.0.7" + web3-utils "1.6.0" web3-eth-accounts@1.2.11: version "1.2.11" @@ -9203,10 +9399,27 @@ web3-eth-accounts@1.2.11: web3-core-method "1.2.11" web3-utils "1.2.11" -web3-eth-accounts@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.5.2.tgz#cf506c21037fa497fe42f1f055980ce4acf83731" - integrity sha512-F8mtzxgEhxfLc66vPi0Gqd6mpscvvk7Ua575bsJ1p9J2X/VtuKgDgpWcU4e4LKeROQ+ouCpAG9//0j9jQuij3A== +web3-eth-accounts@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.3.1.tgz#63b247461f1ae0ae46f9a5d5aa896ea80237143e" + integrity sha512-wsV3/0Pbn5+pI8PiCD1CYw7I1dkQujcP//aJ+ZH8PoaHQoG6HnJ7nTp7foqa0r/X5lizImz/g5S8D76t3Z9tHA== + dependencies: + crypto-browserify "3.12.0" + eth-lib "0.2.8" + ethereumjs-common "^1.3.2" + ethereumjs-tx "^2.1.1" + scrypt-js "^3.0.1" + underscore "1.9.1" + uuid "3.3.2" + web3-core "1.3.1" + web3-core-helpers "1.3.1" + web3-core-method "1.3.1" + web3-utils "1.3.1" + +web3-eth-accounts@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.6.0.tgz#530927f4c5b78df93b3ea1203abbb467de29cd04" + integrity sha512-2f6HS4KIH4laAsNCOfbNX3dRiQosqSY2TRK86C8jtAA/QKGdx+5qlPfYzbI2RjG81iayb2+mVbHIaEaBGZ8sGw== dependencies: "@ethereumjs/common" "^2.3.0" "@ethereumjs/tx" "^3.2.1" @@ -9215,10 +9428,10 @@ web3-eth-accounts@1.5.2: ethereumjs-util "^7.0.10" scrypt-js "^3.0.1" uuid "3.3.2" - web3-core "1.5.2" - web3-core-helpers "1.5.2" - web3-core-method "1.5.2" - web3-utils "1.5.2" + web3-core "1.6.0" + web3-core-helpers "1.6.0" + web3-core-method "1.6.0" + web3-utils "1.6.0" web3-eth-contract@1.2.11: version "1.2.11" @@ -9235,19 +9448,34 @@ web3-eth-contract@1.2.11: web3-eth-abi "1.2.11" web3-utils "1.2.11" -web3-eth-contract@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.5.2.tgz#ffbd799fd01e36596aaadefba323e24a98a23c2f" - integrity sha512-4B8X/IPFxZCTmtENpdWXtyw5fskf2muyc3Jm5brBQRb4H3lVh1/ZyQy7vOIkdphyaXu4m8hBLHzeyKkd37mOUg== +web3-eth-contract@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.3.1.tgz#05cb77bd2a671c5480897d20de487f3bae82e113" + integrity sha512-cHu9X1iGrK+Zbrj4wYKwHI1BtVGn/9O0JRsZqd9qcFGLwwAmaCJYy0sDn7PKCKDSL3qB+MDILoyI7FaDTWWTHg== dependencies: "@types/bn.js" "^4.11.5" - web3-core "1.5.2" - web3-core-helpers "1.5.2" - web3-core-method "1.5.2" - web3-core-promievent "1.5.2" - web3-core-subscriptions "1.5.2" - web3-eth-abi "1.5.2" - web3-utils "1.5.2" + underscore "1.9.1" + web3-core "1.3.1" + web3-core-helpers "1.3.1" + web3-core-method "1.3.1" + web3-core-promievent "1.3.1" + web3-core-subscriptions "1.3.1" + web3-eth-abi "1.3.1" + web3-utils "1.3.1" + +web3-eth-contract@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.6.0.tgz#deb946867ad86d32bcbba899d733b681b25ea674" + integrity sha512-ZUtO77zFnxuFtrc+D+iJ3AzNgFXAVcKnhEYN7f1PNz/mFjbtE6dJ+ujO0mvMbxIZF02t9IZv0CIXRpK0rDvZAw== + dependencies: + "@types/bn.js" "^4.11.5" + web3-core "1.6.0" + web3-core-helpers "1.6.0" + web3-core-method "1.6.0" + web3-core-promievent "1.6.0" + web3-core-subscriptions "1.6.0" + web3-eth-abi "1.6.0" + web3-utils "1.6.0" web3-eth-ens@1.2.11: version "1.2.11" @@ -9264,19 +9492,34 @@ web3-eth-ens@1.2.11: web3-eth-contract "1.2.11" web3-utils "1.2.11" -web3-eth-ens@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.5.2.tgz#ecb3708f0e8e2e847e9d89e8428da12c30bba6a4" - integrity sha512-/UrLL42ZOCYge+BpFBdzG8ICugaRS4f6X7PxJKO+zAt+TwNgBpjuWfW/ZYNcuqJun/ZyfcTuj03TXqA1RlNhZQ== +web3-eth-ens@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.3.1.tgz#ccfd621ddc1fecb44096bc8e60689499a9eb4421" + integrity sha512-MUQvYgUYQ5gAwbZyHwI7y+NTT6j98qG3MVhGCUf58inF5Gxmn9OlLJRw8Tofgf0K87Tk9Kqw1/2QxUE4PEZMMA== dependencies: content-hash "^2.5.2" eth-ens-namehash "2.0.8" - web3-core "1.5.2" - web3-core-helpers "1.5.2" - web3-core-promievent "1.5.2" - web3-eth-abi "1.5.2" - web3-eth-contract "1.5.2" - web3-utils "1.5.2" + underscore "1.9.1" + web3-core "1.3.1" + web3-core-helpers "1.3.1" + web3-core-promievent "1.3.1" + web3-eth-abi "1.3.1" + web3-eth-contract "1.3.1" + web3-utils "1.3.1" + +web3-eth-ens@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.6.0.tgz#af13852168d56fa71b9198eb097e96fb93831c2a" + integrity sha512-AG24PNv9qbYHSpjHcU2pViOII0jvIR7TeojJ2bxXSDqfcgHuRp3NZGKv6xFvT4uNI4LEQHUhSC7bzHoNF5t8CA== + dependencies: + content-hash "^2.5.2" + eth-ens-namehash "2.0.8" + web3-core "1.6.0" + web3-core-helpers "1.6.0" + web3-core-promievent "1.6.0" + web3-eth-abi "1.6.0" + web3-eth-contract "1.6.0" + web3-utils "1.6.0" web3-eth-iban@1.2.11: version "1.2.11" @@ -9286,13 +9529,21 @@ web3-eth-iban@1.2.11: bn.js "^4.11.9" web3-utils "1.2.11" -web3-eth-iban@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.5.2.tgz#f390ad244ef8a6c94de7c58736b0b80a484abc8e" - integrity sha512-C04YDXuSG/aDwOHSX+HySBGb0KraiAVt+/l1Mw7y/fCUrKC/K0yYzMYqY/uYOcvLtepBPsC4ZfUYWUBZ2PO8Vg== +web3-eth-iban@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.3.1.tgz#4351e1a658efa5f3218357f0a38d6d8cad82481e" + integrity sha512-RCQLfR9Z+DNfpw7oUauYHg1HcVoEljzhwxKn3vi15gK0ssWnTwRGqUiIyVTeSb836G6oakOd5zh7XYqy7pn+nw== dependencies: bn.js "^4.11.9" - web3-utils "1.5.2" + web3-utils "1.3.1" + +web3-eth-iban@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.6.0.tgz#edbe46cedc5b148d53fa455edea6b4eef53b2be7" + integrity sha512-HM/bKBS/e8qg0+Eh7B8C/JVG+GkR4AJty17DKRuwMtrh78YsonPj7GKt99zS4n5sDLFww1Imu/ZIk3+K5uJCjw== + dependencies: + bn.js "^4.11.9" + web3-utils "1.6.0" web3-eth-personal@1.2.11: version "1.2.11" @@ -9306,17 +9557,29 @@ web3-eth-personal@1.2.11: web3-net "1.2.11" web3-utils "1.2.11" -web3-eth-personal@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.5.2.tgz#043335a19ab59e119ba61e3bd6c3b8cde8120490" - integrity sha512-nH5N2GiVC0C5XeMEKU16PeFP3Hb3hkPvlR6Tf9WQ+pE+jw1c8eaXBO1CJQLr15ikhUF3s94ICyHcfjzkDsmRbA== +web3-eth-personal@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.3.1.tgz#cfe8af01588870d195dabf0a8d9e34956fb8856d" + integrity sha512-/vZEQpXJfBfYoy9KT911ItfoscEfF0Q2j8tsXzC2xmmasSZ6YvAUuPhflVmAo0IHQSX9rmxq0q1p3sbnE3x2pQ== dependencies: "@types/node" "^12.12.6" - web3-core "1.5.2" - web3-core-helpers "1.5.2" - web3-core-method "1.5.2" - web3-net "1.5.2" - web3-utils "1.5.2" + web3-core "1.3.1" + web3-core-helpers "1.3.1" + web3-core-method "1.3.1" + web3-net "1.3.1" + web3-utils "1.3.1" + +web3-eth-personal@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.6.0.tgz#b75a61c0737b8b8bcc11d05db2ed7bfce7e4b262" + integrity sha512-8ohf4qAwbShf4RwES2tLHVqa+pHZnS5Q6tV80sU//bivmlZeyO1W4UWyNn59vu9KPpEYvLseOOC6Muxuvr8mFQ== + dependencies: + "@types/node" "^12.12.6" + web3-core "1.6.0" + web3-core-helpers "1.6.0" + web3-core-method "1.6.0" + web3-net "1.6.0" + web3-utils "1.6.0" web3-eth@1.2.11: version "1.2.11" @@ -9337,23 +9600,42 @@ web3-eth@1.2.11: web3-net "1.2.11" web3-utils "1.2.11" -web3-eth@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.5.2.tgz#0f6470df60a2a7d04df4423ca7721db8ed5ad72b" - integrity sha512-DwWQ6TCOUqvYyo7T20S7HpQDPveNHNqOn2Q2F3E8ZFyEjmqT4XsGiwvm08kB/VgQ4e/ANyq/i8PPFSYMT8JKHg== +web3-eth@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.3.1.tgz#60ac4b58e5fd17b8dbbb8378abd63b02e8326727" + integrity sha512-e4iL8ovj0zNxzbv4LTHEv9VS03FxKlAZD+95MolwAqtVoUnKC2H9X6dli0w6eyXP0aKw+mwY0g0CWQHzqZvtXw== dependencies: - web3-core "1.5.2" - web3-core-helpers "1.5.2" - web3-core-method "1.5.2" - web3-core-subscriptions "1.5.2" - web3-eth-abi "1.5.2" - web3-eth-accounts "1.5.2" - web3-eth-contract "1.5.2" - web3-eth-ens "1.5.2" - web3-eth-iban "1.5.2" - web3-eth-personal "1.5.2" - web3-net "1.5.2" - web3-utils "1.5.2" + underscore "1.9.1" + web3-core "1.3.1" + web3-core-helpers "1.3.1" + web3-core-method "1.3.1" + web3-core-subscriptions "1.3.1" + web3-eth-abi "1.3.1" + web3-eth-accounts "1.3.1" + web3-eth-contract "1.3.1" + web3-eth-ens "1.3.1" + web3-eth-iban "1.3.1" + web3-eth-personal "1.3.1" + web3-net "1.3.1" + web3-utils "1.3.1" + +web3-eth@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.6.0.tgz#4c9d5fb4eccf9f8744828281757e6ea76af58cbd" + integrity sha512-qJMvai//r0be6I9ghU24/152f0zgJfYC23TMszN3Y6jse1JtjCBP2TlTibFcvkUN1RRdIUY5giqO7ZqAYAmp7w== + dependencies: + web3-core "1.6.0" + web3-core-helpers "1.6.0" + web3-core-method "1.6.0" + web3-core-subscriptions "1.6.0" + web3-eth-abi "1.6.0" + web3-eth-accounts "1.6.0" + web3-eth-contract "1.6.0" + web3-eth-ens "1.6.0" + web3-eth-iban "1.6.0" + web3-eth-personal "1.6.0" + web3-net "1.6.0" + web3-utils "1.6.0" web3-net@1.2.11: version "1.2.11" @@ -9364,14 +9646,23 @@ web3-net@1.2.11: web3-core-method "1.2.11" web3-utils "1.2.11" -web3-net@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.5.2.tgz#58915d7e2dad025d2a08f02c865f3abe61c48eff" - integrity sha512-VEc9c+jfoERhbJIxnx0VPlQDot8Lm4JW/tOWFU+ekHgIiu2zFKj5YxhURIth7RAbsaRsqCb79aE+M0eI8maxVQ== +web3-net@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.3.1.tgz#79374b1df37429b0839b83b0abc4440ac6181568" + integrity sha512-vuMMWMk+NWHlrNfszGp3qRjH/64eFLiNIwUi0kO8JXQ896SP3Ma0su5sBfSPxNCig047E9GQimrL9wvYAJSO5A== dependencies: - web3-core "1.5.2" - web3-core-method "1.5.2" - web3-utils "1.5.2" + web3-core "1.3.1" + web3-core-method "1.3.1" + web3-utils "1.3.1" + +web3-net@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.6.0.tgz#2c28f8787073110a7c2310336889d2dad647e500" + integrity sha512-LFfG95ovTT2sNHkO1TEfsaKpYcxOSUtbuwHQ0K3G0e5nevKDJkPEFIqIcob40yiwcWoqEjENJP9Bjk8CRrZ99Q== + dependencies: + web3-core "1.6.0" + web3-core-method "1.6.0" + web3-utils "1.6.0" web3-provider-engine@14.2.1: version "14.2.1" @@ -9407,12 +9698,20 @@ web3-providers-http@1.2.11: web3-core-helpers "1.2.11" xhr2-cookies "1.1.0" -web3-providers-http@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.5.2.tgz#94f95fe5572ca54aa2c2ffd42c63956436c9eb0a" - integrity sha512-dUNFJc9IMYDLZnkoQX3H4ZjvHjGO6VRVCqrBrdh84wPX/0da9dOA7DwIWnG0Gv3n9ybWwu5JHQxK4MNQ444lyA== +web3-providers-http@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.3.1.tgz#becbea61706b2fa52e15aca6fe519ee108a8fab9" + integrity sha512-DOujG6Ts7/hAMj0PW5p9/1vwxAIr+1CJ6ZWHshtfOq1v1KnMphVTGOrjcTTUvPT33/DA/so2pgGoPMrgaEIIvQ== dependencies: - web3-core-helpers "1.5.2" + web3-core-helpers "1.3.1" + xhr2-cookies "1.1.0" + +web3-providers-http@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.6.0.tgz#8db4e589abf7197f5d65b12af1bf9726c45f4160" + integrity sha512-sNxHFNv3lnxpmULt34AS6M36IYB/Hzm2Et4yPNzdP1XE644D8sQBZQZaJQdTaza5HfrlwoqU6AOK935armqGuA== + dependencies: + web3-core-helpers "1.6.0" xhr2-cookies "1.1.0" web3-providers-ipc@1.2.11: @@ -9424,13 +9723,22 @@ web3-providers-ipc@1.2.11: underscore "1.9.1" web3-core-helpers "1.2.11" -web3-providers-ipc@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.5.2.tgz#68a516883c998eeddf60df4cead77baca4fb4aaa" - integrity sha512-SJC4Sivt4g9LHKlRy7cs1jkJgp7bjrQeUndE6BKs0zNALKguxu6QYnzbmuHCTFW85GfMDjhvi24jyyZHMnBNXQ== +web3-providers-ipc@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.3.1.tgz#3cb2572fc5286ab2f3117e0a2dce917816c3dedb" + integrity sha512-BNPscLbvwo+u/tYJrLvPnl/g/SQVSnqP/TjEsB033n4IXqTC4iZ9Of8EDmI0U6ds/9nwNqOBx3KsxbinL46UZA== dependencies: oboe "2.1.5" - web3-core-helpers "1.5.2" + underscore "1.9.1" + web3-core-helpers "1.3.1" + +web3-providers-ipc@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.6.0.tgz#6a3410fd47a67c4a36719fb97f99534ae12aac98" + integrity sha512-ETYdfhpGiGoWpmmSJnONvnPfd3TPivHEGjXyuX+L5FUsbMOVZj9MFLNIS19Cx/YGL8UWJ/8alLJoTcWSIdz/aA== + dependencies: + oboe "2.1.5" + web3-core-helpers "1.6.0" web3-providers-ws@1.2.11: version "1.2.11" @@ -9442,13 +9750,23 @@ web3-providers-ws@1.2.11: web3-core-helpers "1.2.11" websocket "^1.0.31" -web3-providers-ws@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.5.2.tgz#d336a93ed608b40cdcadfadd1f1bc8d32ea046e0" - integrity sha512-xy9RGlyO8MbJDuKv2vAMDkg+en+OvXG0CGTCM2BTl6l1vIdHpCa+6A/9KV2rK8aU9OBZ7/Pf+Y19517kHVl9RA== +web3-providers-ws@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.3.1.tgz#a70140811d138a1a5cf3f0c39d11887c8e341c83" + integrity sha512-DAbVbiizv0Hr/bLKjyyKMHc/66ccVkudan3eRsf+R/PXWCqfXb7q6Lwodj4llvC047pEuLKR521ZKr5wbfk1KQ== dependencies: eventemitter3 "4.0.4" - web3-core-helpers "1.5.2" + underscore "1.9.1" + web3-core-helpers "1.3.1" + websocket "^1.0.32" + +web3-providers-ws@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.6.0.tgz#dc15dc18c30089efda992015fd5254bd2b77af5f" + integrity sha512-eNRmlhOPCpuVYwBrKBBQRLGPFb4U1Uo44r9EWV69Cpo4gP6XeBTl6nkawhLz6DS0fq79apyPfItJVuSfAy77pA== + dependencies: + eventemitter3 "4.0.4" + web3-core-helpers "1.6.0" websocket "^1.0.32" web3-shh@1.2.11: @@ -9461,15 +9779,25 @@ web3-shh@1.2.11: web3-core-subscriptions "1.2.11" web3-net "1.2.11" -web3-shh@1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.5.2.tgz#a72a3d903c0708a004db94a72d934a302d880aea" - integrity sha512-wOxOcYt4Sa0AHAI8gG7RulCwVuVjSRS/M/AbFsea3XfJdN6sU13/syY7OdZNjNYuKjYTzxKYrd3dU/K2iqffVw== +web3-shh@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.3.1.tgz#42294d684358c22aa48616cb9a3eb2e9c1e6362f" + integrity sha512-57FTQvOW1Zm3wqfZpIEqL4apEQIR5JAxjqA4RM4eL0jbdr+Zj5Y4J93xisaEVl6/jMtZNlsqYKTVswx8mHu1xw== dependencies: - web3-core "1.5.2" - web3-core-method "1.5.2" - web3-core-subscriptions "1.5.2" - web3-net "1.5.2" + web3-core "1.3.1" + web3-core-method "1.3.1" + web3-core-subscriptions "1.3.1" + web3-net "1.3.1" + +web3-shh@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.6.0.tgz#838a3435dce1039f669a48e53e948062de197931" + integrity sha512-ymN0OFL81WtEeSyb+PFpuUv39fR3frGwsZnIg5EVPZvrOIdaDSFcGSLDmafUt0vKSubvLMVYIBOCskRD6YdtEQ== + dependencies: + web3-core "1.6.0" + web3-core-method "1.6.0" + web3-core-subscriptions "1.6.0" + web3-net "1.6.0" web3-utils@1.2.11: version "1.2.11" @@ -9485,10 +9813,10 @@ web3-utils@1.2.11: underscore "1.9.1" utf8 "3.0.0" -web3-utils@1.5.2, web3-utils@^1.0.0-beta.31: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.5.2.tgz#150982dcb1918ffc54eba87528e28f009ebc03aa" - integrity sha512-quTtTeQJHYSxAwIBOCGEcQtqdVcFWX6mCFNoqnp+mRbq+Hxbs8CGgO/6oqfBx4OvxIOfCpgJWYVHswRXnbEu9Q== +web3-utils@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.3.1.tgz#9aa880dd8c9463fe5c099107889f86a085370c2e" + integrity sha512-9gPwFm8SXtIJuzdrZ37PRlalu40fufXxo+H2PiCwaO6RpKGAvlUlWU0qQbyToFNXg7W2H8djEgoAVac8NLMCKQ== dependencies: bn.js "^4.11.9" eth-lib "0.2.8" @@ -9496,6 +9824,20 @@ web3-utils@1.5.2, web3-utils@^1.0.0-beta.31: ethjs-unit "0.1.6" number-to-bn "1.7.0" randombytes "^2.1.0" + underscore "1.9.1" + utf8 "3.0.0" + +web3-utils@1.6.0, web3-utils@^1.0.0-beta.31: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.6.0.tgz#1975c5ee5b7db8a0836eb7004848a7cd962d1ddc" + integrity sha512-bgCAWAeQnJF035YTFxrcHJ5mGEfTi/McsjqldZiXRwlHK7L1PyOqvXiQLE053dlzvy1kdAxWl/sSSfLMyNUAXg== + dependencies: + bn.js "^4.11.9" + ethereum-bloom-filters "^1.0.6" + ethereumjs-util "^7.1.0" + ethjs-unit "0.1.6" + number-to-bn "1.7.0" + randombytes "^2.1.0" utf8 "3.0.0" web3@1.2.11: @@ -9511,18 +9853,36 @@ web3@1.2.11: web3-shh "1.2.11" web3-utils "1.2.11" -web3@^1.2.11: - version "1.5.2" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.5.2.tgz#736ca2f39048c63964203dd811f519400973e78d" - integrity sha512-aapKLdO8t7Cos6tZLeeQUtCJvTiPMlLcHsHHDLSBZ/VaJEucSTxzun32M8sp3BmF4waDEmhY+iyUM1BKvtAcVQ== +web3@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/web3/-/web3-1.3.1.tgz#f780138c92ae3c42ea45e1a3c6ae8844e0aa5054" + integrity sha512-lDJwOLSRWHYwhPy4h5TNgBRJ/lED7lWXyVOXHCHcEC8ai3coBNdgEXWBu/GGYbZMsS89EoUOJ14j3Ufi4dUkog== dependencies: - web3-bzz "1.5.2" - web3-core "1.5.2" - web3-eth "1.5.2" - web3-eth-personal "1.5.2" - web3-net "1.5.2" - web3-shh "1.5.2" - web3-utils "1.5.2" + web3-bzz "1.3.1" + web3-core "1.3.1" + web3-eth "1.3.1" + web3-eth-personal "1.3.1" + web3-net "1.3.1" + web3-shh "1.3.1" + web3-utils "1.3.1" + +web3@^1.2.11: + version "1.6.0" + resolved "https://registry.yarnpkg.com/web3/-/web3-1.6.0.tgz#d8fa0cd9e7bf252f9fe43bb77dc42bc6671affde" + integrity sha512-rWpXnO88MiVX5yTRqMBCVKASxc7QDkXZZUl1D48sKlbX4dt3BAV+nVMVUKCBKiluZ5Bp8pDrVCUdPx/jIYai5Q== + dependencies: + web3-bzz "1.6.0" + web3-core "1.6.0" + web3-eth "1.6.0" + web3-eth-personal "1.6.0" + web3-net "1.6.0" + web3-shh "1.6.0" + web3-utils "1.6.0" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= websocket@1.0.32: version "1.0.32" @@ -9553,6 +9913,14 @@ whatwg-fetch@2.0.4: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" @@ -9575,16 +9943,16 @@ which-module@^2.0.0: integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= which-typed-array@^1.1.2: - version "1.1.6" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.6.tgz#f3713d801da0720a7f26f50c596980a9f5c8b383" - integrity sha512-DdY984dGD5sQ7Tf+x1CkXzdg85b9uEel6nr4UkFg1LoE9OXv3uRuZhe5CoWdawhGACeFpEZXH8fFLQnDhbpm/Q== + version "1.1.7" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.7.tgz#2761799b9a22d4b8660b3c1b40abaa7739691793" + integrity sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw== dependencies: - available-typed-arrays "^1.0.4" + available-typed-arrays "^1.0.5" call-bind "^1.0.2" es-abstract "^1.18.5" foreach "^2.0.5" has-tostringtag "^1.0.0" - is-typed-array "^1.1.6" + is-typed-array "^1.1.7" which@1.3.1, which@^1.2.9: version "1.3.1" @@ -9701,9 +10069,9 @@ ws@^5.1.1: async-limiter "~1.0.0" ws@^7.4.6: - version "7.5.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" - integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg== + version "7.5.5" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" + integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== xhr-request-promise@^0.1.2: version "0.1.3"