From a88a814c7eaab5e0d931cb4cbdefebeea13aa002 Mon Sep 17 00:00:00 2001 From: Mike Ghen Date: Wed, 19 Oct 2022 11:19:36 -0400 Subject: [PATCH] USDCx > ibAlluoUSD REX Market (#133) * Copy twoway market * smartcontract integration for alluo * add generated ibAlluo interface * wip * working tests for 2.1 * saving work in progress * saving wip * saving wip * Alluo deploy script, misc. fixes, passing 1 and 2 tests * reduce fee * ibAlluoUSD<>ibAlluoBTC deployment * saving wip * refactor usdcx to iballuousd * upgrade sf SDK * working usdcx>>ibAlluoUSD market * USDCx>iballuoUSD market deploy script * Fix growing ration withdraw bug * added constant, remove unused code, edit config for alluo deploy --- contracts/REXMarket.sol | 31 +- contracts/REXTwoWayAlluoMarket.sol | 582 ++++ contracts/REXTwoWayAlluoUsdcxMarket.sol | 322 +++ contracts/alluo/IbAlluo.sol | 259 ++ hardhat.config.ts | 12 +- misc/Constants.ts | 18 +- misc/common.ts | 35 +- misc/helpers.ts | 37 - misc/setup.ts | 46 +- package-lock.json | 2341 ++++++++++------- package.json | 3 +- scripts/deploy-rextwowayalluomarket.ts | 77 + scripts/deploy-rextwowayalluousdmarket.ts | 75 + test/REXTwoWayAlluoMarket.test.ts | 915 +++++++ test/REXTwoWayAlluoUsdcxMarket.test.ts | 728 +++++ test/REXTwoWayMarket.test.ts | 20 +- .../superfluid/SuperfluidGovernanceII.json | 31 +- 17 files changed, 4418 insertions(+), 1114 deletions(-) create mode 100644 contracts/REXTwoWayAlluoMarket.sol create mode 100644 contracts/REXTwoWayAlluoUsdcxMarket.sol create mode 100644 contracts/alluo/IbAlluo.sol create mode 100644 scripts/deploy-rextwowayalluomarket.ts create mode 100644 scripts/deploy-rextwowayalluousdmarket.ts create mode 100644 test/REXTwoWayAlluoMarket.test.ts create mode 100644 test/REXTwoWayAlluoUsdcxMarket.test.ts diff --git a/contracts/REXMarket.sol b/contracts/REXMarket.sol index 4167ad0..dd58575 100644 --- a/contracts/REXMarket.sol +++ b/contracts/REXMarket.sol @@ -39,6 +39,7 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { struct ShareholderUpdate { address shareholder; + address affiliate; int96 previousFlowRate; int96 currentFlowRate; ISuperToken token; @@ -159,10 +160,6 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { /// @dev Drain contract's input and output tokens balance to owner if SuperApp dont have any input streams. function emergencyDrain(ISuperToken token) external virtual onlyOwner { - require( - cfa.getNetFlow(token, address(this)) == 0, - "!zeroStreamers" - ); require(host.isAppJailed(ISuperApp(address(this))), "!jailed"); token.transfer( @@ -406,9 +403,7 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { ) internal virtual returns (bytes memory _newCtx) { // We need to go through all the output tokens and update their IDA shares _newCtx = _ctx; - (uint128 userShares, uint128 daoShares, uint128 affiliateShares) = _getShareAllocations(_shareholderUpdate); - // updateOutputPools for (uint32 _index = 0; _index < market.numOutputPools; _index++) { _newCtx = _updateSubscriptionWithContext( @@ -427,12 +422,11 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { daoShares, market.outputPools[_index].token ); - address affiliate = referrals.getAffiliateAddress(_shareholderUpdate.shareholder); - if (affiliate != address(0)) { + if (_shareholderUpdate.affiliate != address(0)) { _newCtx = _updateSubscriptionWithContext( _newCtx, _index, - affiliate, + _shareholderUpdate.affiliate, // affiliate may get 0.2% affiliateShares, market.outputPools[_index].token @@ -449,9 +443,8 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { (,,daoShares,) = getIDAShares(market.outputPoolIndicies[_shareholderUpdate.token], owner()); daoShares *= market.outputPools[market.outputPoolIndicies[_shareholderUpdate.token]].shareScaler; - address affiliateAddress = referrals.getAffiliateAddress(_shareholderUpdate.shareholder); - if (address(0) != affiliateAddress) { - (,,affiliateShares,) = getIDAShares(market.outputPoolIndicies[_shareholderUpdate.token], affiliateAddress); + if (address(0) != _shareholderUpdate.affiliate) { + (,,affiliateShares,) = getIDAShares(market.outputPoolIndicies[_shareholderUpdate.token], _shareholderUpdate.affiliate); affiliateShares *= market.outputPools[market.outputPoolIndicies[_shareholderUpdate.token]].shareScaler; } @@ -463,7 +456,7 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { if(changeInFlowRate > 0) { // Add new shares to the DAO feeShares = uint128(uint256(int256(changeInFlowRate)) * market.feeRate / 1e6); - if (address(0) != affiliateAddress) { + if (address(0) != _shareholderUpdate.affiliate) { affiliateShares += feeShares * market.affiliateFee / 1e6; feeShares -= feeShares * market.affiliateFee / 1e6; } @@ -472,7 +465,7 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { // Make the rate positive changeInFlowRate = -1 * changeInFlowRate; feeShares = uint128(uint256(int256(changeInFlowRate)) * market.feeRate / 1e6); - if (address(0) != affiliateAddress) { + if (address(0) != _shareholderUpdate.affiliate) { affiliateShares -= (feeShares * market.affiliateFee / 1e6 > affiliateShares) ? affiliateShares : feeShares * market.affiliateFee / 1e6; feeShares -= feeShares * market.affiliateFee / 1e6; } @@ -743,9 +736,8 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { _registerReferral(_ctx, _shareholder); ShareholderUpdate memory _shareholderUpdate = ShareholderUpdate( - _shareholder, 0, _flowRate, _superToken + _shareholder, referrals.getAffiliateAddress(_shareholder), 0, _flowRate, _superToken ); - _newCtx = _updateShareholder(_newCtx, _shareholderUpdate); } @@ -778,7 +770,6 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { bytes calldata _cbdata, bytes calldata _ctx ) external virtual override returns (bytes memory _newCtx) { - _onlyHost(); if (!_isInputToken(_superToken) || !_isCFAv1(_agreementClass)) return _ctx; @@ -798,11 +789,12 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { } ShareholderUpdate memory _shareholderUpdate = ShareholderUpdate( - _shareholder, _beforeFlowRate, _flowRate, _superToken + _shareholder, referrals.getAffiliateAddress(_shareholder), _beforeFlowRate, _flowRate, _superToken ); // TODO: Udpate shareholder needs before and after flow rate _newCtx = _updateShareholder(_newCtx, _shareholderUpdate); + } // We need before agreement to get the uninvested amount using the flowRate before update @@ -845,7 +837,7 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { (uint256 _uninvestAmount, int96 _beforeFlowRate ) = abi.decode(_cbdata, (uint256, int96)); ShareholderUpdate memory _shareholderUpdate = ShareholderUpdate( - _shareholder, _beforeFlowRate, 0, _superToken + _shareholder, referrals.getAffiliateAddress(_shareholder), _beforeFlowRate, 0, _superToken ); _newCtx = _updateShareholder(_newCtx, _shareholderUpdate); @@ -853,7 +845,6 @@ abstract contract REXMarket is Ownable, SuperAppBase, Initializable { try _superToken.transferFrom(address(this), _shareholder, _uninvestAmount) // solhint-disable-next-line no-empty-blocks {} catch { - // Nothing to do, pass } } } diff --git a/contracts/REXTwoWayAlluoMarket.sol b/contracts/REXTwoWayAlluoMarket.sol new file mode 100644 index 0000000..404af17 --- /dev/null +++ b/contracts/REXTwoWayAlluoMarket.sol @@ -0,0 +1,582 @@ +// SPDX-License-Identifier: AGPLv3 +pragma solidity ^0.8.0; + +import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + +import "./REXMarket.sol"; +import './ISETHCustom.sol'; +import './alluo/IbAlluo.sol'; + +contract REXTwoWayAlluoMarket is REXMarket { + using SafeERC20 for ERC20; + + // DAI + address constant inputTokenAUnderlying = 0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063; + // // WBTC + // address constant inputTokenBUnderlying = 0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6; + // WETH + address constant inputTokenBUnderlying = 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619; + + ISuperToken inputTokenA; + ISuperToken inputTokenB; + uint32 constant OUTPUTA_INDEX = 0; + uint32 constant OUTPUTB_INDEX = 1; + uint32 constant SUBSIDYA_INDEX = 2; + uint32 constant SUBSIDYB_INDEX = 3; + uint256 lastDistributionTokenAAt; + uint256 lastDistributionTokenBAt; + ISuperToken subsidyToken; + // Quickswap + IUniswapV2Router02 router = + IUniswapV2Router02(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506); + ITellor tellor = ITellor(0xACC2d27400029904919ea54fFc0b18Bf07C57875); + + // REX Two Way Alluo Market + // - Accepts ibAlluoXXX and convert it to ibAlluoYYY (both directions) + // - Sources liquidity using UniswapV2 liquidity pools + + constructor( + address _owner, + ISuperfluid _host, + IConstantFlowAgreementV1 _cfa, + IInstantDistributionAgreementV1 _ida, + string memory _registrationKey, + IREXReferral _rexReferral + ) REXMarket(_owner, _host, _cfa, _ida, _registrationKey, _rexReferral) {} + + function initializeTwoWayMarket( + ISuperToken _inputTokenA, + uint256 _inputTokenARequestId, + uint128 _inputTokenAShareScaler, + ISuperToken _inputTokenB, + uint256 _inputTokenBRequestId, + uint128 _inputTokenBShareScaler, + uint128 _feeRate, + uint256 _rateTolerance + ) public onlyOwner initializer { + inputTokenA = _inputTokenA; + inputTokenB = _inputTokenB; + market.inputToken = _inputTokenA; // market.inputToken isn't used but is set bc of the REXMarket + market.rateTolerance = _rateTolerance; + oracle = tellor; + market.feeRate = _feeRate; + market.affiliateFee = 500000; + require( + _inputTokenAShareScaler >= 1e6 && _inputTokenBShareScaler >= 1e6, + "!scaleable" + ); + addOutputPool( + inputTokenA, + _feeRate, + 0, + _inputTokenARequestId, + _inputTokenAShareScaler + ); + addOutputPool( + inputTokenB, + _feeRate, + 0, + _inputTokenBRequestId, + _inputTokenBShareScaler + ); + market.outputPoolIndicies[inputTokenA] = OUTPUTA_INDEX; + market.outputPoolIndicies[inputTokenB] = OUTPUTB_INDEX; + + // Approve ibAlluoA to deposit inputTokenA + ERC20(inputTokenAUnderlying).safeIncreaseAllowance( + address(inputTokenA.getUnderlyingToken()), + 2**256 - 1 + ); + + // otherwise approve underlying for upgrade + ERC20(inputTokenBUnderlying).safeIncreaseAllowance( + address(inputTokenB.getUnderlyingToken()), + 2**256 - 1 + ); + + // Approve ibAlluoA to deposit inputTokenA + ERC20(inputTokenA.getUnderlyingToken()).safeIncreaseAllowance( + address(inputTokenA), + 2**256 - 1 + ); + ERC20(inputTokenB.getUnderlyingToken()).safeIncreaseAllowance( + address(inputTokenB), + 2**256 - 1 + ); + + ERC20(inputTokenAUnderlying).safeIncreaseAllowance( + address(router), + 2**256 - 1 + ); + ERC20(inputTokenBUnderlying).safeIncreaseAllowance( + address(router), + 2**256 - 1 + ); + + market.lastDistributionAt = block.timestamp; + } + + function initializeSubsidies( + uint256 _emissionRate, + ISuperToken _subsidyToken + ) public onlyOwner { + subsidyToken = _subsidyToken; + require( + address(market.outputPools[SUBSIDYA_INDEX].token) == address(0) && + address(market.outputPools[SUBSIDYB_INDEX].token) == address(0), + "already initialized" + ); + addOutputPool( + _subsidyToken, + 0, + _emissionRate, + 77, + market.outputPools[OUTPUTB_INDEX].shareScaler + ); + addOutputPool( + _subsidyToken, + 0, + _emissionRate, + 77, + market.outputPools[OUTPUTA_INDEX].shareScaler + ); + lastDistributionTokenAAt = block.timestamp; + lastDistributionTokenBAt = block.timestamp; + // Does not need to add subsidy token to outputPoolIndicies + // since these pools are hardcoded + } + + function addOutputPool( + ISuperToken _token, + uint128 _feeRate, + uint256 _emissionRate, + uint256 _requestId, + uint128 _shareScaler + ) public override onlyOwner { + // Only Allow 4 output pools, this overrides the block in REXMarket + // where there can't be two output pools of the same token + require(market.numOutputPools < 4, "too many pools"); + + OutputPool memory _newPool = OutputPool( + _token, + _feeRate, + _emissionRate, + _shareScaler + ); + market.outputPools[market.numOutputPools] = _newPool; + market.outputPoolIndicies[_token] = market.numOutputPools; + _createIndex(market.numOutputPools, _token); + market.numOutputPools++; + OracleInfo memory _newOracle = OracleInfo(_requestId, 0, 0); + market.oracles[_token] = _newOracle; + updateTokenPrice(_token); + } + + function distribute(bytes memory ctx) + public + override + returns (bytes memory newCtx) + { + newCtx = ctx; + + IbAlluo ibTokenA = IbAlluo(inputTokenA.getUnderlyingToken()); + IbAlluo ibTokenB = IbAlluo(inputTokenB.getUnderlyingToken()); + + require( + market + .oracles[market.outputPools[OUTPUTA_INDEX].token] + .lastUpdatedAt >= block.timestamp - 3600, + "!cva" + ); + require( + market + .oracles[market.outputPools[OUTPUTB_INDEX].token] + .lastUpdatedAt >= block.timestamp - 3600, + "!cvb" + ); + // At this point, we've got enough of tokenA and tokenB to perform the distribution + ibTokenA.updateRatio(); + ibTokenB.updateRatio(); + uint256 tokenAAmount = inputTokenA.balanceOf(address(this)) * ibTokenA.growingRatio() / 1e18; + uint256 tokenBAmount = inputTokenB.balanceOf(address(this)) * ibTokenB.growingRatio() / 1e18; + + // Check how much inputTokenA we have already from tokenB + uint256 tokenHave = (tokenBAmount * + market.oracles[inputTokenB].usdPrice) / + market.oracles[inputTokenA].usdPrice; + + uint256 minOutput; + // If we have more tokenA than we need, swap the surplus to inputTokenB + if (tokenHave < tokenAAmount) { + // tokenHave becomes tokenANeed + tokenHave = tokenAAmount - tokenHave; + // Convert token have A to ibAlluoA amount + inputTokenA.downgrade(tokenHave * 1e18 / ibTokenA.growingRatio()); + + ibTokenA.withdraw( + inputTokenAUnderlying, + tokenHave + ); + + _swap( + inputTokenAUnderlying, + inputTokenBUnderlying, + ERC20(inputTokenAUnderlying).balanceOf(address(this)), + 0, + block.timestamp + 3600 + ); + + ibTokenB.deposit(inputTokenBUnderlying, ERC20(inputTokenBUnderlying).balanceOf(address(this))); + inputTokenB.upgrade(ibTokenB.balanceOf(address(this))); + // Otherwise we have more tokenB than we need, swap the surplus to inputTokenA + } else { + tokenHave = + (tokenAAmount * market.oracles[inputTokenA].usdPrice) / + market.oracles[inputTokenB].usdPrice; + tokenHave = tokenBAmount - tokenHave; + + // Convert token have B to ibAlluoB amount + inputTokenB.downgrade(tokenHave * 1e18 / ibTokenB.growingRatio()); + + ibTokenB.withdrawTo( + address(this), + inputTokenBUnderlying, + tokenHave + ); + + + _swap( + inputTokenBUnderlying, + inputTokenAUnderlying, + ERC20(inputTokenBUnderlying).balanceOf(address(this)), + 0, + block.timestamp + 3600 + ); + // Deposit inputTokenAUnderlying + ibTokenA.deposit(inputTokenAUnderlying, ERC20(inputTokenAUnderlying).balanceOf(address(this))); + inputTokenA.upgrade(ibTokenA.balanceOf(address(this))); + + + } + + // At this point, we've got enough of tokenA and tokenB to perform the distribution + tokenAAmount = inputTokenA.balanceOf(address(this)); + tokenBAmount = inputTokenB.balanceOf(address(this)); + + if (tokenAAmount == 0 && tokenBAmount == 0) { + return newCtx; + } + + // Perform the distributions + uint256 feeCollected; + uint256 distAmount; + + (, , uint128 _totalUnitsApproved, uint128 _totalUnitsPending) = ida + .getIndex( + market.outputPools[OUTPUTA_INDEX].token, + address(this), + OUTPUTA_INDEX + ); + if (tokenAAmount > 0 && _totalUnitsApproved + _totalUnitsPending > 0) { + (tokenAAmount, ) = ida.calculateDistribution( + inputTokenA, + address(this), + OUTPUTA_INDEX, + tokenAAmount + ); + + // Distribute TokenA + require( + inputTokenA.balanceOf(address(this)) >= tokenAAmount, + "!enough" + ); + newCtx = _idaDistribute( + OUTPUTA_INDEX, + uint128(tokenAAmount), + inputTokenA, + newCtx + ); + emit Distribution(distAmount, feeCollected, address(inputTokenA)); + + // Distribution Subsidy + distAmount = + (block.timestamp - lastDistributionTokenAAt) * + market.outputPools[SUBSIDYA_INDEX].emissionRate; + if ( + distAmount < + market.outputPools[SUBSIDYA_INDEX].token.balanceOf( + address(this) + ) + ) { + newCtx = _idaDistribute( + SUBSIDYA_INDEX, + uint128(distAmount), + market.outputPools[SUBSIDYA_INDEX].token, + newCtx + ); + emit Distribution( + distAmount, + 0, + address(market.outputPools[SUBSIDYA_INDEX].token) + ); + } + lastDistributionTokenAAt = block.timestamp; + } + + (, , _totalUnitsApproved, _totalUnitsPending) = ida.getIndex( + market.outputPools[OUTPUTB_INDEX].token, + address(this), + OUTPUTB_INDEX + ); + if (tokenBAmount > 0 && _totalUnitsApproved + _totalUnitsPending > 0) { + (tokenBAmount, ) = ida.calculateDistribution( + inputTokenB, + address(this), + OUTPUTB_INDEX, + tokenBAmount + ); + + // Distribute TokenB + require( + inputTokenB.balanceOf(address(this)) >= tokenBAmount, + "!enough" + ); + newCtx = _idaDistribute( + OUTPUTB_INDEX, + uint128(tokenBAmount), + inputTokenB, + newCtx + ); + emit Distribution(distAmount, feeCollected, address(inputTokenB)); + + // Distribution Subsidy + distAmount = + (block.timestamp - lastDistributionTokenBAt) * + market.outputPools[SUBSIDYB_INDEX].emissionRate; + if ( + distAmount < + market.outputPools[SUBSIDYB_INDEX].token.balanceOf( + address(this) + ) + ) { + newCtx = _idaDistribute( + SUBSIDYB_INDEX, + uint128(distAmount), + market.outputPools[SUBSIDYB_INDEX].token, + newCtx + ); + emit Distribution( + distAmount, + 0, + address(market.outputPools[SUBSIDYB_INDEX].token) + ); + } + lastDistributionTokenBAt = block.timestamp; + } + + market.lastDistributionAt = block.timestamp; + } + + function beforeAgreementCreated( + ISuperToken _superToken, + address _agreementClass, + bytes32, //_agreementId, + bytes calldata _agreementData, + bytes calldata _ctx + ) external view virtual override returns (bytes memory _cbdata) { + _onlyHost(); + if (!_isInputToken(_superToken) || !_isCFAv1(_agreementClass)) + return _ctx; + (address shareholder, ) = abi.decode( + _agreementData, + (address, address) + ); + (, , uint128 shares, ) = getIDAShares(OUTPUTA_INDEX, shareholder); + require(shares == 0, "Already streaming"); + (, , shares, ) = getIDAShares(OUTPUTB_INDEX, shareholder); + require(shares == 0, "Already streaming"); + } + + function beforeAgreementTerminated( + ISuperToken _superToken, + address _agreementClass, + bytes32, //_agreementId, + bytes calldata _agreementData, + bytes calldata _ctx + ) external view virtual override returns (bytes memory _cbdata) { + _onlyHost(); + if (!_isInputToken(_superToken) || !_isCFAv1(_agreementClass)) + return _ctx; + + ( + address _shareholder, + int96 _flowRateMain, + uint256 _timestamp + ) = _getShareholderInfo(_agreementData, _superToken); + + uint256 _uinvestAmount = _calcUserUninvested( + _timestamp, + uint256(uint96(_flowRateMain)), + // Select the correct lastDistributionAt for this _superToken + _getLastDistributionAt(_superToken) + ); + _cbdata = abi.encode(_uinvestAmount, int256(_flowRateMain)); + } + + function _swap( + address input, + address output, + uint256 amount, + uint256 minOutput, + uint256 deadline + ) internal returns (uint256) { + address[] memory path; // The path to take + + // Assumes a direct path to swap input/output + path = new address[](2); + path[0] = input; + path[1] = output; + + router.swapExactTokensForTokens( + amount, + 0, + path, + address(this), + block.timestamp + 3600 + ); + } + + function _updateShareholder( + bytes memory _ctx, + ShareholderUpdate memory _shareholderUpdate + ) internal override returns (bytes memory _newCtx) { + // Check the input supertoken used and figure out the output Index + // inputTokenA maps the OUTPUTB_INDEX + // maybe a better way to do this + uint32 outputIndex; + uint32 subsidyIndex; + if ( + market.outputPoolIndicies[_shareholderUpdate.token] == OUTPUTA_INDEX + ) { + outputIndex = OUTPUTB_INDEX; + subsidyIndex = SUBSIDYB_INDEX; + _shareholderUpdate.token = inputTokenB; + } else { + outputIndex = OUTPUTA_INDEX; + subsidyIndex = SUBSIDYA_INDEX; + _shareholderUpdate.token = inputTokenA; + } + + ( + uint128 userShares, + uint128 daoShares, + uint128 affiliateShares + ) = _getShareAllocations(_shareholderUpdate); + + _newCtx = _ctx; + + // TODO: Update the fee taken by the DAO, Affiliate + _newCtx = _updateSubscriptionWithContext( + _newCtx, + outputIndex, + _shareholderUpdate.shareholder, + userShares, + market.outputPools[outputIndex].token + ); + _newCtx = _updateSubscriptionWithContext( + _newCtx, + subsidyIndex, + _shareholderUpdate.shareholder, + userShares, + subsidyToken + ); + _newCtx = _updateSubscriptionWithContext( + _newCtx, + outputIndex, + owner(), + daoShares, + market.outputPools[outputIndex].token + ); + + if (_shareholderUpdate.affiliate != address(0)) { + _newCtx = _updateSubscriptionWithContext( + _newCtx, + outputIndex, + _shareholderUpdate.affiliate, + affiliateShares, + market.outputPools[outputIndex].token + ); + + } + } + + function _isInputToken(ISuperToken _superToken) + internal + view + override + returns (bool) + { + return + address(_superToken) == address(inputTokenA) || + address(_superToken) == address(inputTokenB); + } + + function _getLastDistributionAt(ISuperToken _token) + internal + view + returns (uint256) + { + return + market.outputPoolIndicies[_token] == OUTPUTA_INDEX + ? lastDistributionTokenBAt + : lastDistributionTokenAAt; + } + + function _shouldDistribute() internal override returns (bool) { + // TODO: This section should be checked, + // since it only checks one IDA, + (, , uint128 _totalUnitsApproved, uint128 _totalUnitsPending) = ida + .getIndex( + market.outputPools[OUTPUTA_INDEX].token, + address(this), + OUTPUTA_INDEX + ); + if (_totalUnitsApproved + _totalUnitsPending > 0) { + (, , _totalUnitsApproved, _totalUnitsPending) = ida.getIndex( + market.outputPools[OUTPUTB_INDEX].token, + address(this), + OUTPUTB_INDEX + ); + if (_totalUnitsApproved + _totalUnitsPending > 0) { + return true; + } + } + + return false; + } + + function _onlyScalable(ISuperToken _superToken, int96 _flowRate) + internal + override + { + if (market.outputPoolIndicies[_superToken] == OUTPUTA_INDEX) { + require( + uint128(uint256(int256(_flowRate))) % + (market.outputPools[OUTPUTB_INDEX].shareScaler * 1e3) == + 0, + "notScalable" + ); + } else { + require( + uint128(uint256(int256(_flowRate))) % + (market.outputPools[OUTPUTA_INDEX].shareScaler * 1e3) == + 0, + "notScalable" + ); + } + } + + receive() external payable {} + +} diff --git a/contracts/REXTwoWayAlluoUsdcxMarket.sol b/contracts/REXTwoWayAlluoUsdcxMarket.sol new file mode 100644 index 0000000..98f104a --- /dev/null +++ b/contracts/REXTwoWayAlluoUsdcxMarket.sol @@ -0,0 +1,322 @@ +// SPDX-License-Identifier: AGPLv3 +pragma solidity ^0.8.0; + +import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; + +import "./REXMarket.sol"; +import './ISETHCustom.sol'; +import './alluo/IbAlluo.sol'; + +contract REXTwoWayAlluoUsdcxMarket is REXMarket { + using SafeERC20 for ERC20; + + ISuperToken inputTokenA; // USDCx + ISuperToken inputTokenB; // stibAlluoUSD + + uint32 constant OUTPUTB_INDEX = 0; + uint32 constant SUBSIDYB_INDEX = 1; + + ISuperToken subsidyToken; + + // REX Two Way Alluo Market + // - Accepts ibAlluoXXX and convert it to ibAlluoYYY (both directions) + // - Sources liquidity using UniswapV2 liquidity pools + + constructor( + address _owner, + ISuperfluid _host, + IConstantFlowAgreementV1 _cfa, + IInstantDistributionAgreementV1 _ida, + string memory _registrationKey, + IREXReferral _rexReferral + ) REXMarket(_owner, _host, _cfa, _ida, _registrationKey, _rexReferral) {} + + function initializeTwoWayMarket( + ISuperToken _inputTokenA, + uint256 _inputTokenARequestId, + uint128 _inputTokenAShareScaler, + ISuperToken _inputTokenB, + uint256 _inputTokenBRequestId, + uint128 _inputTokenBShareScaler, + uint128 _feeRate, + uint256 _rateTolerance + ) public onlyOwner initializer { + inputTokenA = _inputTokenA; + inputTokenB = _inputTokenB; + market.inputToken = _inputTokenA; // market.inputToken isn't used but is set bc of the REXMarket + market.rateTolerance = _rateTolerance; + market.feeRate = _feeRate; + market.affiliateFee = 500000; + addOutputPool( + inputTokenB, + _feeRate, + 0, + _inputTokenBRequestId, + _inputTokenBShareScaler + ); + market.outputPoolIndicies[inputTokenB] = OUTPUTB_INDEX; + + + // Approve stibAlluoUSD to upgrade ibAlluoUSD + ERC20(inputTokenB.getUnderlyingToken()).safeIncreaseAllowance( + address(inputTokenB), + 2**256 - 1 + ); + + // Approve USDC to deposit to ibAlluoUSD + ERC20(inputTokenA.getUnderlyingToken()).safeIncreaseAllowance( + address(inputTokenB.getUnderlyingToken()), + 2**256 - 1 + ); + + market.lastDistributionAt = block.timestamp; + } + + function initializeSubsidies( + uint256 _emissionRate, + ISuperToken _subsidyToken + ) public onlyOwner { + subsidyToken = _subsidyToken; + require( + address(market.outputPools[SUBSIDYB_INDEX].token) == address(0), + "already initialized" + ); + addOutputPool( + _subsidyToken, + 0, + _emissionRate, + 77, + market.outputPools[OUTPUTB_INDEX].shareScaler + ); + + market.lastDistributionAt = block.timestamp; + // Does not need to add subsidy token to outputPoolIndicies + // since these pools are hardcoded + } + + function addOutputPool( + ISuperToken _token, + uint128 _feeRate, + uint256 _emissionRate, + uint256 _requestId, + uint128 _shareScaler + ) public override onlyOwner { + // Only Allow 4 output pools, this overrides the block in REXMarket + // where there can't be two output pools of the same token + require(market.numOutputPools < 4, "too many pools"); + + OutputPool memory _newPool = OutputPool( + _token, + _feeRate, + _emissionRate, + _shareScaler + ); + market.outputPools[market.numOutputPools] = _newPool; + market.outputPoolIndicies[_token] = market.numOutputPools; + _createIndex(market.numOutputPools, _token); + market.numOutputPools++; + OracleInfo memory _newOracle = OracleInfo(_requestId, 0, 0); + market.oracles[_token] = _newOracle; + // updateTokenPrice(_token); + } + + function distribute(bytes memory ctx) + public + override + returns (bytes memory newCtx) + { + newCtx = ctx; + + IbAlluo ibTokenB = IbAlluo(inputTokenB.getUnderlyingToken()); + + // Get token amounts in terms of USD + uint256 tokenAAmount = inputTokenA.balanceOf(address(this)); + uint256 tokenBAmount; + + inputTokenA.downgrade(tokenAAmount - tokenBAmount); + ibTokenB.deposit(inputTokenA.getUnderlyingToken(), ERC20(inputTokenA.getUnderlyingToken()).balanceOf(address(this))); + inputTokenB.upgrade(ibTokenB.balanceOf(address(this))); + + // OK to distribute + + // At this point, we've got enough of tokenA and tokenB to perform the distribution + // tokenAAmount = inputTokenA.balanceOf(address(this)); + tokenBAmount = inputTokenB.balanceOf(address(this)); + + if (tokenBAmount == 0) { + return newCtx; + } else { + + (tokenBAmount, ) = ida.calculateDistribution( + inputTokenB, + address(this), + OUTPUTB_INDEX, + tokenBAmount + ); + + newCtx = _idaDistribute( + OUTPUTB_INDEX, + uint128(tokenBAmount), + inputTokenB, + newCtx + ); + emit Distribution(tokenBAmount, 0, address(inputTokenB)); + + // Distribution Subsidy + uint256 distAmount = + (block.timestamp - market.lastDistributionAt) * + market.outputPools[SUBSIDYB_INDEX].emissionRate; + if ( + distAmount < + market.outputPools[SUBSIDYB_INDEX].token.balanceOf( + address(this) + ) + ) { + newCtx = _idaDistribute( + SUBSIDYB_INDEX, + uint128(distAmount), + market.outputPools[SUBSIDYB_INDEX].token, + newCtx + ); + emit Distribution( + distAmount, + 0, + address(market.outputPools[SUBSIDYB_INDEX].token) + ); + } + + market.lastDistributionAt = block.timestamp; + } + } + + function beforeAgreementCreated( + ISuperToken _superToken, + address _agreementClass, + bytes32, //_agreementId, + bytes calldata _agreementData, + bytes calldata _ctx + ) external view virtual override returns (bytes memory _cbdata) { + _onlyHost(); + if (!_isInputToken(_superToken) || !_isCFAv1(_agreementClass)) + return _ctx; + (address shareholder, ) = abi.decode( + _agreementData, + (address, address) + ); + (, , uint128 shares, ) = getIDAShares(OUTPUTB_INDEX, shareholder); + require(shares == 0, "Already streaming"); + } + + function beforeAgreementTerminated( + ISuperToken _superToken, + address _agreementClass, + bytes32, //_agreementId, + bytes calldata _agreementData, + bytes calldata _ctx + ) external view virtual override returns (bytes memory _cbdata) { + _onlyHost(); + if (!_isInputToken(_superToken) || !_isCFAv1(_agreementClass)) + return _ctx; + + ( + address _shareholder, + int96 _flowRateMain, + uint256 _timestamp + ) = _getShareholderInfo(_agreementData, _superToken); + + uint256 _uinvestAmount = _calcUserUninvested( + _timestamp, + uint256(uint96(_flowRateMain)), + // Select the correct lastDistributionAt for this _superToken + _getLastDistributionAt(_superToken) + ); + _cbdata = abi.encode(_uinvestAmount, int256(_flowRateMain)); + } + + function _updateShareholder( + bytes memory _ctx, + ShareholderUpdate memory _shareholderUpdate + ) internal override returns (bytes memory _newCtx) { + // Check the input supertoken used and figure out the output Index + // inputTokenA maps the OUTPUTB_INDEX + // maybe a better way to do this + uint32 outputIndex; + uint32 subsidyIndex; + + _shareholderUpdate.token = inputTokenB; + + + ( + uint128 userShares, + uint128 daoShares, + uint128 affiliateShares + ) = _getShareAllocations(_shareholderUpdate); + + _newCtx = _ctx; + + // TODO: Update the fee taken by the DAO, Affiliate + _newCtx = _updateSubscriptionWithContext( + _newCtx, + OUTPUTB_INDEX, + _shareholderUpdate.shareholder, + uint128(uint256(int256(_shareholderUpdate.currentFlowRate))), + market.outputPools[OUTPUTB_INDEX].token + ); + _newCtx = _updateSubscriptionWithContext( + _newCtx, + SUBSIDYB_INDEX, + _shareholderUpdate.shareholder, + uint128(uint256(int256(_shareholderUpdate.currentFlowRate))), + subsidyToken + ); + } + + function _isInputToken(ISuperToken _superToken) + internal + view + override + returns (bool) + { + return address(_superToken) == address(inputTokenA); + } + + function _getLastDistributionAt(ISuperToken _token) + internal + view + returns (uint256) + { + return market.lastDistributionAt; + } + + function _shouldDistribute() internal override returns (bool) { + // TODO: This section should be checked, + // since it only checks one IDA, + + (, , uint128 _totalUnitsApproved, uint128 _totalUnitsPending) = ida.getIndex( + market.outputPools[OUTPUTB_INDEX].token, + address(this), + OUTPUTB_INDEX + ); + if (_totalUnitsApproved + _totalUnitsPending > 0) { + return true; + } + + return false; + } + + function _onlyScalable(ISuperToken _superToken, int96 _flowRate) + internal + override + { + // TODO: Required? + require( + uint128(uint256(int256(_flowRate))) % + (market.outputPools[OUTPUTB_INDEX].shareScaler * 1e3) == + 0, + "notScalable" + ); + + } + +} diff --git a/contracts/alluo/IbAlluo.sol b/contracts/alluo/IbAlluo.sol new file mode 100644 index 0000000..cd0016b --- /dev/null +++ b/contracts/alluo/IbAlluo.sol @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: UNLICENSED +// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.5. SEE SOURCE BELOW. !! +pragma solidity >=0.7.0 <0.9.0; + +interface IbAlluo { + event AdminChanged(address previousAdmin, address newAdmin); + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); + event BeaconUpgraded(address indexed beacon); + event BurnedForWithdraw(address indexed user, uint256 amount); + event CreateFlow( + address indexed from, + address indexed to, + int96 amountPerSecond + ); + event DeletedFlow(address indexed from, address indexed to); + event DepositTokenStatusChanged(address token, bool status); + event Deposited(address indexed user, address token, uint256 amount); + event Initialized(uint8 version); + event InterestChanged( + uint256 oldYearInterest, + uint256 newYearInterest, + uint256 oldInterestPerSecond, + uint256 newInterestPerSecond + ); + event NewHandlerSet(address oldHandler, address newHandler); + event Paused(address account); + event RoleAdminChanged( + bytes32 indexed role, + bytes32 indexed previousAdminRole, + bytes32 indexed newAdminRole + ); + event RoleGranted( + bytes32 indexed role, + address indexed account, + address indexed sender + ); + event RoleRevoked( + bytes32 indexed role, + address indexed account, + address indexed sender + ); + event Transfer(address indexed from, address indexed to, uint256 value); + event TransferAssetValue( + address indexed from, + address indexed to, + uint256 tokenAmount, + uint256 assetValue, + uint256 growingRatio + ); + event Unpaused(address account); + event UpdateTimeLimitSet(uint256 oldValue, uint256 newValue); + event UpdatedFlow( + address indexed from, + address indexed to, + int96 amountPerSecond + ); + event Upgraded(address indexed implementation); + + function CFA_ID() external view returns (bytes32); + + function DEFAULT_ADMIN_ROLE() external view returns (bytes32); + + function UPGRADER_ROLE() external view returns (bytes32); + + function allowance(address owner, address spender) + external + view + returns (uint256); + + function annualInterest() external view returns (uint256); + + function approve(address spender, uint256 amount) external returns (bool); + + function approveAssetValue(address spender, uint256 amount) + external + returns (bool); + + function balanceOf(address account) external view returns (uint256); + + function burn(address account, uint256 amount) external; + + function cfaV1Lib() external view returns (address host, address cfa); + + function changeTokenStatus(address _token, bool _status) external; + + function changeUpgradeStatus(bool _status) external; + + function convertToAssetValue(uint256 _amount) + external + view + returns (uint256); + + function createFlow( + address receiver, + int96 flowRate, + uint256 toWrap + ) external; + + function decimals() external view returns (uint8); + + function decreaseAllowance(address spender, uint256 subtractedValue) + external + returns (bool); + + function deleteFlow(address receiver) external; + + function deposit(address _token, uint256 _amount) external; + + function exchangeAddress() external view returns (address); + + function formatFlow( + address receiver, + int96 flowRate, + address agreement + ) external view returns (bytes memory); + + function formatPermissions() external view returns (bytes memory); + + function getBalance(address _address) external view returns (int256); + + function getBalanceForTransfer(address _address) + external + view + returns (int256); + + function getListSupportedTokens() external view returns (address[] memory); + + function getRoleAdmin(bytes32 role) external view returns (bytes32); + + function grantRole(bytes32 role, address account) external; + + function growingRatio() external view returns (uint256); + + function hasRole(bytes32 role, address account) + external + view + returns (bool); + + function increaseAllowance(address spender, uint256 addedValue) + external + returns (bool); + + function initialize( + string memory _name, + string memory _symbol, + address _multiSigWallet, + address _handler, + address[] memory _supportedTokens, + uint256 _interestPerSecond, + uint256 _annualInterest, + address _trustedForwarder, + address _exchangeAddress + ) external; + + function interestPerSecond() external view returns (uint256); + + function isTrustedForwarder(address forwarder) external view returns (bool); + + function lastInterestCompound() external view returns (uint256); + + function liquidityHandler() external view returns (address); + + function mint(address account, uint256 amount) external; + + function name() external view returns (string memory); + + function pause() external; + + function paused() external view returns (bool); + + function proxiableUUID() external view returns (bytes32); + + function renounceRole(bytes32 role, address account) external; + + function revokeRole(bytes32 role, address account) external; + + function setExchangeAddress(address newExchangeAddress) external; + + function setInterest( + uint256 _newAnnualInterest, + uint256 _newInterestPerSecond + ) external; + + function setLiquidityHandler(address newHandler) external; + + function setSuperToken(address _superToken) external; + + function setTrustedForwarder(address newTrustedForwarder) external; + + function setUpdateTimeLimit(uint256 _newLimit) external; + + function superToken() external view returns (address); + + function supportsInterface(bytes4 interfaceId) external view returns (bool); + + function symbol() external view returns (string memory); + + function totalAssetSupply() external view returns (uint256); + + function totalSupply() external view returns (uint256); + + function transfer(address to, uint256 amount) external returns (bool); + + function transferAssetValue(address to, uint256 amount) + external + returns (bool); + + function transferFrom( + address from, + address to, + uint256 amount + ) external returns (bool); + + function transferFromAssetValue( + address from, + address to, + uint256 amount + ) external returns (bool); + + function trustedForwarder() external view returns (address); + + function unpause() external; + + function updateFlow( + address receiver, + int96 flowRate, + uint256 toWrap + ) external; + + function updateRatio() external; + + function updateTimeLimit() external view returns (uint256); + + function upgradeStatus() external view returns (bool); + + function upgradeTo(address newImplementation) external; + + function upgradeToAndCall(address newImplementation, bytes memory data) + external + payable; + + function withdraw(address _targetToken, uint256 _amount) external; + + function withdrawTo( + address _recipient, + address _targetToken, + uint256 _amount + ) external; +} + +// THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: +// https://polygonscan.com/address/0x97d38f50c74cbd7db0f95440f0905ae01e8462db#code +/* +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BurnedForWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"int96","name":"amountPerSecond","type":"int96"}],"name":"CreateFlow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"DeletedFlow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"DepositTokenStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldYearInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newYearInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldInterestPerSecond","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newInterestPerSecond","type":"uint256"}],"name":"InterestChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldHandler","type":"address"},{"indexed":false,"internalType":"address","name":"newHandler","type":"address"}],"name":"NewHandlerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"assetValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"growingRatio","type":"uint256"}],"name":"TransferAssetValue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"UpdateTimeLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"int96","name":"amountPerSecond","type":"int96"}],"name":"UpdatedFlow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"CFA_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"annualInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveAssetValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cfaV1Lib","outputs":[{"internalType":"contract ISuperfluid","name":"host","type":"address"},{"internalType":"contract IConstantFlowAgreementV1","name":"cfa","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"changeTokenStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"changeUpgradeStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"convertToAssetValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"int96","name":"flowRate","type":"int96"},{"internalType":"uint256","name":"toWrap","type":"uint256"}],"name":"createFlow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"deleteFlow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchangeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"int96","name":"flowRate","type":"int96"},{"internalType":"address","name":"agreement","type":"address"}],"name":"formatFlow","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"formatPermissions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getBalance","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getBalanceForTransfer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getListSupportedTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"growingRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_multiSigWallet","type":"address"},{"internalType":"address","name":"_handler","type":"address"},{"internalType":"address[]","name":"_supportedTokens","type":"address[]"},{"internalType":"uint256","name":"_interestPerSecond","type":"uint256"},{"internalType":"uint256","name":"_annualInterest","type":"uint256"},{"internalType":"address","name":"_trustedForwarder","type":"address"},{"internalType":"address","name":"_exchangeAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"interestPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastInterestCompound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityHandler","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newExchangeAddress","type":"address"}],"name":"setExchangeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newAnnualInterest","type":"uint256"},{"internalType":"uint256","name":"_newInterestPerSecond","type":"uint256"}],"name":"setInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newHandler","type":"address"}],"name":"setLiquidityHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_superToken","type":"address"}],"name":"setSuperToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newTrustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newLimit","type":"uint256"}],"name":"setUpdateTimeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"superToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssetSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAssetValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFromAssetValue","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"int96","name":"flowRate","type":"int96"},{"internalType":"uint256","name":"toWrap","type":"uint256"}],"name":"updateFlow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateTimeLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"upgradeStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_targetToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_targetToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawTo","outputs":[],"stateMutability":"nonpayable","type":"function"}] +*/ diff --git a/hardhat.config.ts b/hardhat.config.ts index 2d4fd07..33d2c0c 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -8,14 +8,14 @@ import "@nomiclabs/hardhat-etherscan"; import "@nomiclabs/hardhat-waffle"; import "@nomiclabs/hardhat-web3"; import "@nomiclabs/hardhat-ethers"; -import "@openzeppelin/hardhat-upgrades"; +// import "@openzeppelin/hardhat-upgrades"; import "hardhat-contract-sizer"; import "hardhat-gas-reporter"; import "@nomiclabs/hardhat-etherscan"; import "@typechain/hardhat"; import "solidity-coverage"; import { ethers } from "ethers"; - +require("hardhat-tracer"); dotenv.config(); @@ -69,7 +69,11 @@ const config: HardhatUserConfig = { url: process.env.POLYGON_NODE_URL || "", accounts: process.env.POLYGON_PRIVATE_KEY !== undefined ? [process.env.POLYGON_PRIVATE_KEY] : [], enabled: true, - blockNumber: 22877930 // Essential for mainnet forking !! + // blockNumber: 33013602, //32812267, + // standard rex market block number + // 22877930 + // ibAlluo market test block + blockNumber: 31926750 // Essential for mainnet forking !! }, // blockGasLimit: 20000000, // gasPrice: 30000000000, @@ -83,7 +87,7 @@ const config: HardhatUserConfig = { url: process.env.POLYGON_NODE_URL, accounts: process.env.POLYGON_PRIVATE_KEY !== undefined ? [process.env.POLYGON_PRIVATE_KEY] : [], blockGasLimit: 20000000, - gasPrice: 35000000000 // 35 Gwei + gasPrice: 55000000000 // 35 Gwei }, localhost: { accounts: process.env.POLYGON_PRIVATE_KEY !== undefined ? [process.env.POLYGON_PRIVATE_KEY] : [], diff --git a/misc/Constants.ts b/misc/Constants.ts index c4b1193..8b81f2c 100644 --- a/misc/Constants.ts +++ b/misc/Constants.ts @@ -1,5 +1,6 @@ export const Constants = { SF_RESOLVER: "0xE0cc76334405EE8b39213E620587d815967af39C", + HOST_SUPERFLUID_ADDRESS: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7", IDA_SUPERFLUID_ADDRESS: "0xB0aABBA4B2783A72C52956CDEF62d438ecA2d7a1", CFA_SUPERFLUID_ADDRESS: "0x6EeE6060f715257b970700bc2656De21dEdF074C", SUSHISWAP_ROUTER_ADDRESS: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506", @@ -17,13 +18,24 @@ export const Constants = { * Tokens Adresses */ RIC_TOKEN_ADDRESS: "0x263026E7e53DBFDce5ae55Ade22493f828922965", + USDCX_ADDRESS: "0xCAa7349CEA390F89641fe306D93591f87595dc1F", + // These are the supertoken versions + IBALLUOUSD_ADDRESS: "0xE9E759B969B991F2bFae84308385405B9Ab01541", + IBALLUOETH_ADDRESS: "0x2D4Dc956FBd0044a4EBA945e8bbaf98a14025C2d", + IBALLUOBTC_ADDRESS: "0x3E70E15c189e1FFe8FF44d713605528dC1701b63", + // random address from polygonscan that have a lot of usdcx USDCX_SOURCE_ADDRESS: "0x81ea02098336435d5e92e032c029aab850304f5d", // 0x81ea02098336435d5e92e032c029aab850304f5d // IMP --> the contract address can't be used - ETHX_SOURCE_ADDRESS: "0x664dd5bcf28bbb3518ff532a384849830f2154ea", // "0x0154d25120Ed20A516fE43991702e7463c5A6F6e", + // TwoWay Market + // ETHX_SOURCE_ADDRESS: "0x664dd5bcf28bbb3518ff532a384849830f2154ea", + // TwoWay Alluo Market + ETHX_SOURCE_ADDRESS: "0x0154d25120Ed20A516fE43991702e7463c5A6F6e", WBTC_SOURCE_ADDRESS: "0x5c2ed810328349100A66B82b78a1791B101C9D61", USDC_SOURCE_ADDRESS: "0x1a13f4ca1d028320a707d99520abfefca3998b7f", MATICX_SOURCE_ADDRESS: "0xDA344364c9D8cF0C230d24552c61B5a978cbdDc5", + IBALLUOUSD_SOURCE_ADDRESS: "0x781c9e6f0eeedfe16329880731e25fd57fe27e13", + IBALLUOETH_SOURCE_ADDRESS: "0xabfe4d45c6381908f09ef7c501cc36e38d34c0d4", OUTPUT_TOKEN_ADDRESS: "0xB63E38D21B31719e6dF314D3d2c351dF0D4a9162", // IDLE /** @@ -34,5 +46,7 @@ export const Constants = { ALICE_ADDRESS: "0x9f348cdD00dcD61EE7917695D2157ef6af2d7b9B", OWNER_ADDRESS: "0x3226C9EaC0379F04Ba2b1E1e1fcD52ac26309aeA", REPORTER_ADDRESS: "0xeA74b2093280bD1E6ff887b8f2fE604892EBc89f", - KAREN_ADDRESS: "0xbf188ab46C1ca9d9e47a7996d585566ECeDdAeAb" + KAREN_ADDRESS: "0xbf188ab46C1ca9d9e47a7996d585566ECeDdAeAb", + + REX_REFERRAL_ADDRESS: "0xA0eC9E1542485700110688b3e6FbebBDf23cd901", } as const; diff --git a/misc/common.ts b/misc/common.ts index db9ba03..cac919a 100644 --- a/misc/common.ts +++ b/misc/common.ts @@ -10,26 +10,8 @@ const { defaultAbiCoder, keccak256 } = require("ethers/lib/utils"); const { web3tx, wad4human } = require("@decentral.ee/web3-helpers"); const SuperfluidGovernanceBase = require("../test/artifacts/superfluid/SuperfluidGovernanceII.json"); -export const createSFRegistrationKey = async (sf: any, deployerAddr: any) => { - console.log("address", deployerAddr); - const host = await ethers.getContractAt( - hostABI, - sf.host.hostContract.address - ); - const registrationKey = `testKey-${Date.now()}`; - console.log("registration key: ", registrationKey); - - const encodedKey = ethers.utils.keccak256( - ethers.utils.defaultAbiCoder.encode( - ["string", "address", "string"], - [ - "org.superfluid-finance.superfluid.appWhiteListing.registrationKey", - deployerAddr, - registrationKey, - ] - ) - ); -} +const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; + export const common = async () => { const { superfluid, users, tokens, superTokens, contracts } = await setup(); @@ -214,7 +196,7 @@ export const common = async () => { console.log("address", deployerAddr); const host = await ethers.getContractAt( hostABI, - sf.host.hostContract.address + sf.settings.config.hostAddress ); const registrationKey = `testKey-${Date.now()}`; console.log("resigration ?? key", registrationKey); @@ -241,10 +223,15 @@ export const common = async () => { governance, govOwnerSigner ); + + let expirationTs = Math.floor(Date.now() / 1000) + 3600 * 24 * 90; // 90 days from now + //console.log("sf governance", sfGovernance.whiteListNewApp); - await sfGovernance.whiteListNewApp( - sf.host.hostContract.address, - encodedKey + await sfGovernance.setConfig( + sf.settings.config.hostAddress, + ZERO_ADDRESS, + encodedKey, + expirationTs ); return registrationKey; diff --git a/misc/helpers.ts b/misc/helpers.ts index c3133c0..424e9ba 100644 --- a/misc/helpers.ts +++ b/misc/helpers.ts @@ -151,43 +151,6 @@ export async function initSuperfluid(): Promise { return sf; } -export async function createSFRegistrationKey(sf: Framework, deployer: SignerWithAddress): Promise { - const registrationKey = `testKey-${Date.now()}`; - console.log("_________ Inside createSFRegistrationKey ___________"); - // const encodedKey = ethers.utils.keccak256( - // ethers.utils.defaultAbiCoder.encode( - // ["string", "address", "string"], - - // const appKey = ethers.utils.solidityKeccak256( - // ethers.utils.defaultAbiCoder.encode( - // ['string', 'address', 'string'], - // [ - // 'org.superfluid-finance.superfluid.appWhiteListing.registrationKey', - // // deployer.address, - // Constants.OWNER_ADDRESS, // temp. - // registrationKey, - // ], - // ) - // ); - - const governance = await sf.host.hostContract.getGovernance(); - console.log(`SF Governance: ${governance}`); - - const sfGovernanceRO = await ethers - .getContractAt(SuperfluidGovernanceBase.abi, governance); - - const govOwner = await sfGovernanceRO.owner(); - await impersonateAndSetBalance(govOwner); - - const sfGovernance = await ethers - .getContractAt(SuperfluidGovernanceBase.abi, governance, await ethers.getSigner(govOwner)); - - // await sfGovernance.whiteListNewApp(sf.host.address, appKey); - await sfGovernance.whiteListNewApp(sf.host.hostContract.address, registrationKey); // appKey); - - return registrationKey; -} - // export async function approveSubscriptions( // // users = [u.alice.address, u.bob.address, u.carl.address, u.karen.address, u.admin.address], // framework: Framework, users: SignerWithAddress[], tokens: ISuperToken[] diff --git a/misc/setup.ts b/misc/setup.ts index 1553135..ab2e803 100644 --- a/misc/setup.ts +++ b/misc/setup.ts @@ -33,6 +33,8 @@ export interface ISuperToken { daix: SuperToken; ric: SuperToken; maticx: SuperToken; + ibAlluoUSD: SuperToken; + ibAlluoETH: SuperToken; } export interface IUser { @@ -59,6 +61,8 @@ export const setup = async () => { "SF_RESOLVER": Constants.SF_RESOLVER, "USDCX_SOURCE_ADDRESS": Constants.USDCX_SOURCE_ADDRESS, "MATICX_SOURCE_ADDRESS": Constants.MATICX_SOURCE_ADDRESS, + "IBALLUOUSD_SOURCE_ADDRESS": Constants.IBALLUOUSD_SOURCE_ADDRESS, + "IBALLUOETH_SOURCE_ADDRESS": Constants.IBALLUOETH_SOURCE_ADDRESS, "TELLOR_ORACLE_ADDRESS": Constants.TELLOR_ORACLE_ADDRESS, "SUSHISWAP_ROUTER_ADDRESS": Constants.SUSHISWAP_ROUTER_ADDRESS, "TELLOR_ETH_REQUEST_ID": Constants.TELLOR_ETH_REQUEST_ID.toString(), @@ -76,11 +80,13 @@ export const setup = async () => { Constants.USDCX_SOURCE_ADDRESS, Constants.ETHX_SOURCE_ADDRESS, Constants.MATICX_SOURCE_ADDRESS, + Constants.IBALLUOUSD_SOURCE_ADDRESS, + Constants.IBALLUOETH_SOURCE_ADDRESS, Constants.SF_RESOLVER, ]; const accounts: SignerWithAddress[] = await impersonateAccounts(accountAddrs); - const names = ["admin", "alice", "bob", "carl", "karen", "usdcxspender", "ethxspender", "maticxspender"]; + const names = ["admin", "alice", "bob", "carl", "karen", "usdcxspender", "ethxspender", "maticxspender", "ibAlluoUSDspender", "ibAlluoETHspender"]; // Initialize superfluid sdk const superfluid = await Framework.create({ @@ -88,7 +94,8 @@ export const setup = async () => { resolverAddress: Constants.SF_RESOLVER, networkName: "hardhat", dataMode: "WEB3_ONLY", - protocolReleaseVersion: "v1" + protocolReleaseVersion: "v1", + chainId: 31337 }); // Declare supertokens as ERC 20 contracts @@ -108,11 +115,24 @@ export const setup = async () => { daix: await superfluid.loadSuperToken( "0x1305f6b6df9dc47159d12eb7ac2804d4a33173c2" ), + stIbAlluoUSD: await superfluid.loadSuperToken( + "0xE9E759B969B991F2bFae84308385405B9Ab01541" + ), + stIbAlluoETH: await superfluid.loadSuperToken( + "0x2D4Dc956FBd0044a4EBA945e8bbaf98a14025C2d" + ), + // ibAlluoUSD: await ethers.getContractAt( + // "IbAlluo", "0xC2DbaAEA2EfA47EBda3E572aa0e55B742E408BF6" + // ), + // ibAlluoETH: await ethers.getContractAt( + // "IbAlluo", "0xc677B0918a96ad258A68785C2a3955428DeA7e50" + // ), ric: await superfluid.loadSuperToken( Constants.RIC_TOKEN_ADDRESS ) }; + // Declare all users for transactions (usdcx) for (let i = 0; i < names.length; i += 1) { users[names[i]] = { @@ -122,14 +142,15 @@ export const setup = async () => { }; } + // console.log(superTokens.ethx) // Declare ERC 20 tokens tokens.ric = await ethers.getContractAt( "ERC20", Constants.RIC_TOKEN_ADDRESS ); - tokens.weth = await ethers.getContractAt( - "ERC20", - await superTokens.ethx.underlyingToken.address - ); + // tokens.weth = await ethers.getContractAt( + // "ERC20", + // await superTokens.ethx.underlyingToken.address + // ); tokens.wbtc = await ethers.getContractAt( "ERC20", await superTokens.wbtcx.underlyingToken.address @@ -142,7 +163,16 @@ export const setup = async () => { "ERC20", await superTokens.maticx.underlyingToken.address ); - // let var2:string = tokens.usdc; + tokens.ibAlluoUSD = await ethers.getContractAt( + "ERC20", + await superTokens.stIbAlluoUSD.underlyingToken.address + ); + tokens.ibAlluoETH = await ethers.getContractAt( + "ERC20", + await superTokens.stIbAlluoETH.underlyingToken.address + ); + + let var2:string = tokens.usdc; tokens.ric = tokens.ric.connect(accounts[0]); // Trellor Protocol to determine the price @@ -158,6 +188,6 @@ export const setup = async () => { superTokens, contracts, constants, - tellor + tellor, }; }; diff --git a/package-lock.json b/package-lock.json index ae6c248..6785d86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,12 @@ "license": "ISC", "dependencies": { "@openzeppelin/contracts-upgradeable": "^4.1.0", - "@superfluid-finance/sdk-core": "^0.3.0", + "@superfluid-finance/sdk-core": "^0.5.6", "@truffle/abi-utils": "^0.2.3", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", "hardhat-contract-sizer": "^2.0.3", + "hardhat-tracer": "^1.1.0-rc.6", "ricochet-exchange-sfcontracts-used": "^1.0.2", "usingtellor": "^3.0.2" }, @@ -352,6 +353,30 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/parser": { "version": "7.16.6", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz", @@ -1352,9 +1377,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node_modules/@ethersproject/abi": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", - "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", + "version": "5.6.4", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.4.tgz", + "integrity": "sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg==", "funding": [ { "type": "individual", @@ -1366,21 +1391,21 @@ } ], "dependencies": { - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/abstract-provider": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", - "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", + "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", "funding": [ { "type": "individual", @@ -1392,19 +1417,19 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/networks": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/web": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/networks": "^5.6.3", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1" } }, "node_modules/@ethersproject/abstract-signer": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", - "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", + "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", "funding": [ { "type": "individual", @@ -1416,17 +1441,17 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0" + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0" } }, "node_modules/@ethersproject/address": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", - "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", "funding": [ { "type": "individual", @@ -1438,17 +1463,17 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/rlp": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/rlp": "^5.6.1" } }, "node_modules/@ethersproject/base64": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", - "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", + "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", "funding": [ { "type": "individual", @@ -1460,13 +1485,13 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0" + "@ethersproject/bytes": "^5.6.1" } }, "node_modules/@ethersproject/basex": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.5.0.tgz", - "integrity": "sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.1.tgz", + "integrity": "sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA==", "funding": [ { "type": "individual", @@ -1478,14 +1503,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/properties": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/properties": "^5.6.0" } }, "node_modules/@ethersproject/bignumber": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", - "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", + "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", "funding": [ { "type": "individual", @@ -1497,15 +1522,20 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "bn.js": "^4.11.9" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "bn.js": "^5.2.1" } }, + "node_modules/@ethersproject/bignumber/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, "node_modules/@ethersproject/bytes": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", - "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", + "integrity": "sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g==", "funding": [ { "type": "individual", @@ -1517,13 +1547,13 @@ } ], "dependencies": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/constants": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", - "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", + "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", "funding": [ { "type": "individual", @@ -1535,13 +1565,13 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2" } }, "node_modules/@ethersproject/contracts": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.5.0.tgz", - "integrity": "sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.2.tgz", + "integrity": "sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g==", "funding": [ { "type": "individual", @@ -1553,22 +1583,22 @@ } ], "dependencies": { - "@ethersproject/abi": "^5.5.0", - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/transactions": "^5.5.0" + "@ethersproject/abi": "^5.6.3", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/transactions": "^5.6.2" } }, "node_modules/@ethersproject/hash": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", - "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", + "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", "funding": [ { "type": "individual", @@ -1580,20 +1610,20 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/hdnode": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.5.0.tgz", - "integrity": "sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.2.tgz", + "integrity": "sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q==", "funding": [ { "type": "individual", @@ -1605,24 +1635,24 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/basex": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/pbkdf2": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/sha2": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0", - "@ethersproject/strings": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/wordlists": "^5.5.0" + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "node_modules/@ethersproject/json-wallets": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz", - "integrity": "sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz", + "integrity": "sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ==", "funding": [ { "type": "individual", @@ -1634,25 +1664,25 @@ } ], "dependencies": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/hdnode": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/pbkdf2": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/random": "^5.5.0", - "@ethersproject/strings": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", "aes-js": "3.0.0", "scrypt-js": "3.0.1" } }, "node_modules/@ethersproject/keccak256": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", - "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", + "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", "funding": [ { "type": "individual", @@ -1664,14 +1694,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", + "@ethersproject/bytes": "^5.6.1", "js-sha3": "0.8.0" } }, "node_modules/@ethersproject/logger": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", - "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.6.0.tgz", + "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==", "funding": [ { "type": "individual", @@ -1684,9 +1714,9 @@ ] }, "node_modules/@ethersproject/networks": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", - "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", + "version": "5.6.4", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.4.tgz", + "integrity": "sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ==", "funding": [ { "type": "individual", @@ -1698,13 +1728,13 @@ } ], "dependencies": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/pbkdf2": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz", - "integrity": "sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz", + "integrity": "sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ==", "funding": [ { "type": "individual", @@ -1716,14 +1746,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/sha2": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/sha2": "^5.6.1" } }, "node_modules/@ethersproject/properties": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", - "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.6.0.tgz", + "integrity": "sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg==", "funding": [ { "type": "individual", @@ -1735,13 +1765,13 @@ } ], "dependencies": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/providers": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.1.tgz", - "integrity": "sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ==", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.8.tgz", + "integrity": "sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w==", "funding": [ { "type": "individual", @@ -1753,23 +1783,24 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/basex": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/networks": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/random": "^5.5.0", - "@ethersproject/rlp": "^5.5.0", - "@ethersproject/sha2": "^5.5.0", - "@ethersproject/strings": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/web": "^5.5.0", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/networks": "^5.6.3", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1", "bech32": "1.1.4", "ws": "7.4.6" } @@ -1795,9 +1826,9 @@ } }, "node_modules/@ethersproject/random": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.0.tgz", - "integrity": "sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.1.tgz", + "integrity": "sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA==", "funding": [ { "type": "individual", @@ -1809,14 +1840,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/rlp": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", - "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", + "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", "funding": [ { "type": "individual", @@ -1828,14 +1859,14 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/sha2": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.5.0.tgz", - "integrity": "sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.1.tgz", + "integrity": "sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g==", "funding": [ { "type": "individual", @@ -1847,15 +1878,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", "hash.js": "1.1.7" } }, "node_modules/@ethersproject/signing-key": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", - "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", + "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", "funding": [ { "type": "individual", @@ -1867,18 +1898,23 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "bn.js": "^4.11.9", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" } }, + "node_modules/@ethersproject/signing-key/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, "node_modules/@ethersproject/solidity": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.5.0.tgz", - "integrity": "sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.1.tgz", + "integrity": "sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g==", "funding": [ { "type": "individual", @@ -1890,18 +1926,18 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/sha2": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/strings": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", - "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", + "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", "funding": [ { "type": "individual", @@ -1913,15 +1949,15 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/transactions": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", - "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", + "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", "funding": [ { "type": "individual", @@ -1933,21 +1969,21 @@ } ], "dependencies": { - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/rlp": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0" + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2" } }, "node_modules/@ethersproject/units": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.5.0.tgz", - "integrity": "sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.1.tgz", + "integrity": "sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw==", "funding": [ { "type": "individual", @@ -1959,15 +1995,15 @@ } ], "dependencies": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "node_modules/@ethersproject/wallet": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.5.0.tgz", - "integrity": "sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.2.tgz", + "integrity": "sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg==", "funding": [ { "type": "individual", @@ -1979,27 +2015,27 @@ } ], "dependencies": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/hdnode": "^5.5.0", - "@ethersproject/json-wallets": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/random": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/wordlists": "^5.5.0" + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/json-wallets": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "node_modules/@ethersproject/web": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", - "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", + "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", "funding": [ { "type": "individual", @@ -2011,17 +2047,17 @@ } ], "dependencies": { - "@ethersproject/base64": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/base64": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@ethersproject/wordlists": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.5.0.tgz", - "integrity": "sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.1.tgz", + "integrity": "sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw==", "funding": [ { "type": "individual", @@ -2033,11 +2069,11 @@ } ], "dependencies": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "node_modules/@humanwhocodes/config-array": { @@ -2330,21 +2366,6 @@ "solidity-ast": "^0.4.15" } }, - "node_modules/@openzeppelin/upgrades-core/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@openzeppelin/upgrades-core/node_modules/bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -2363,49 +2384,6 @@ "node": ">=12.19" } }, - "node_modules/@openzeppelin/upgrades-core/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@openzeppelin/upgrades-core/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@openzeppelin/upgrades-core/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/@openzeppelin/upgrades-core/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/@openzeppelin/upgrades-core/node_modules/nofilter": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", @@ -2415,18 +2393,6 @@ "node": ">=12.19" } }, - "node_modules/@openzeppelin/upgrades-core/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@resolver-engine/core": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@resolver-engine/core/-/core-0.3.3.tgz", @@ -3497,43 +3463,30 @@ "node": ">=8.0.0" } }, + "node_modules/@superfluid-finance/metadata": { + "version": "1.1.0", + "resolved": "git+ssh://git@github.com/superfluid-finance/metadata.git#edd18b65e170417d2abff336fc14b6683fcf5e94", + "license": "MIT" + }, "node_modules/@superfluid-finance/sdk-core": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@superfluid-finance/sdk-core/-/sdk-core-0.3.0.tgz", - "integrity": "sha512-xON7MKl9PTfHGynGtWuobFbrHF4vz7MB2EQIBfEZshGx83JCF+Gof73PneGg7gDXkwhfSQQWOYiYGnZ5jD2o4Q==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@superfluid-finance/sdk-core/-/sdk-core-0.5.6.tgz", + "integrity": "sha512-PeaIgGu/hcM/fnSZwAGOT8BlRxH/RnLxpaC7yhsTjFZXIGIhJYIEjbUHNWVpgwKqOTX5+JTnesLwIEQdNUF0wA==", "dependencies": { - "@ethersproject/providers": "^5.5.1", - "ajv": "^8.8.2", + "@superfluid-finance/metadata": "git+https://github.com/superfluid-finance/metadata.git", "browserify": "^17.0.0", - "ethers": "^5.5.2", - "graphql-request": "^3.7.0", + "graphql-request": "^4.3.0", "lodash": "^4.17.21", "tsify": "^5.0.4" }, "engines": { "node": ">=12" - } - }, - "node_modules/@superfluid-finance/sdk-core/node_modules/ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "peerDependencies": { + "ethers": "^5.6.9", + "graphql": "^16.0.0" } }, - "node_modules/@superfluid-finance/sdk-core/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - }, "node_modules/@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", @@ -4113,6 +4066,32 @@ "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", "dev": true }, + "node_modules/@truffle/debug-utils/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@truffle/debug-utils/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@truffle/error": { "version": "0.0.14", "resolved": "https://registry.npmjs.org/@truffle/error/-/error-0.0.14.tgz", @@ -4979,6 +4958,32 @@ "node": ">=4" } }, + "node_modules/@trufflesuite/chromafi/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@trufflesuite/chromafi/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@trufflesuite/eth-json-rpc-filters": { "version": "4.1.2-1", "resolved": "https://registry.npmjs.org/@trufflesuite/eth-json-rpc-filters/-/eth-json-rpc-filters-4.1.2-1.tgz", @@ -6091,6 +6096,32 @@ "super-split": "^1.1.0" } }, + "node_modules/ansi-mark/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-mark/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", @@ -7441,18 +7472,50 @@ } }, "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, + "node_modules/chalk/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "node_modules/change-case": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-3.0.2.tgz", @@ -7899,6 +7962,32 @@ "node": ">=8" } }, + "node_modules/command-line-usage/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/command-line-usage/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/command-line-usage/node_modules/typical": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", @@ -9799,55 +9888,6 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -9860,15 +9900,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/eslint/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -9920,18 +9951,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/eslint/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -11115,9 +11134,9 @@ "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" }, "node_modules/ethers": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.2.tgz", - "integrity": "sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw==", + "version": "5.6.9", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.9.tgz", + "integrity": "sha512-lMGC2zv9HC5EC+8r429WaWu3uWJUCgUCt8xxKCFqkrFuBDZXDYIdzDUECxzjf2BMF8IVBByY1EBoGSL3RTm8RA==", "funding": [ { "type": "individual", @@ -11129,36 +11148,36 @@ } ], "dependencies": { - "@ethersproject/abi": "5.5.0", - "@ethersproject/abstract-provider": "5.5.1", - "@ethersproject/abstract-signer": "5.5.0", - "@ethersproject/address": "5.5.0", - "@ethersproject/base64": "5.5.0", - "@ethersproject/basex": "5.5.0", - "@ethersproject/bignumber": "5.5.0", - "@ethersproject/bytes": "5.5.0", - "@ethersproject/constants": "5.5.0", - "@ethersproject/contracts": "5.5.0", - "@ethersproject/hash": "5.5.0", - "@ethersproject/hdnode": "5.5.0", - "@ethersproject/json-wallets": "5.5.0", - "@ethersproject/keccak256": "5.5.0", - "@ethersproject/logger": "5.5.0", - "@ethersproject/networks": "5.5.1", - "@ethersproject/pbkdf2": "5.5.0", - "@ethersproject/properties": "5.5.0", - "@ethersproject/providers": "5.5.1", - "@ethersproject/random": "5.5.0", - "@ethersproject/rlp": "5.5.0", - "@ethersproject/sha2": "5.5.0", - "@ethersproject/signing-key": "5.5.0", - "@ethersproject/solidity": "5.5.0", - "@ethersproject/strings": "5.5.0", - "@ethersproject/transactions": "5.5.0", - "@ethersproject/units": "5.5.0", - "@ethersproject/wallet": "5.5.0", - "@ethersproject/web": "5.5.1", - "@ethersproject/wordlists": "5.5.0" + "@ethersproject/abi": "5.6.4", + "@ethersproject/abstract-provider": "5.6.1", + "@ethersproject/abstract-signer": "5.6.2", + "@ethersproject/address": "5.6.1", + "@ethersproject/base64": "5.6.1", + "@ethersproject/basex": "5.6.1", + "@ethersproject/bignumber": "5.6.2", + "@ethersproject/bytes": "5.6.1", + "@ethersproject/constants": "5.6.1", + "@ethersproject/contracts": "5.6.2", + "@ethersproject/hash": "5.6.1", + "@ethersproject/hdnode": "5.6.2", + "@ethersproject/json-wallets": "5.6.1", + "@ethersproject/keccak256": "5.6.1", + "@ethersproject/logger": "5.6.0", + "@ethersproject/networks": "5.6.4", + "@ethersproject/pbkdf2": "5.6.1", + "@ethersproject/properties": "5.6.0", + "@ethersproject/providers": "5.6.8", + "@ethersproject/random": "5.6.1", + "@ethersproject/rlp": "5.6.1", + "@ethersproject/sha2": "5.6.1", + "@ethersproject/signing-key": "5.6.2", + "@ethersproject/solidity": "5.6.1", + "@ethersproject/strings": "5.6.1", + "@ethersproject/transactions": "5.6.2", + "@ethersproject/units": "5.6.1", + "@ethersproject/wallet": "5.6.2", + "@ethersproject/web": "5.6.1", + "@ethersproject/wordlists": "5.6.1" } }, "node_modules/ethjs-abi": { @@ -22295,6 +22314,32 @@ "testrpc-sc": "index.js" } }, + "node_modules/ghost-testrpc/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ghost-testrpc/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -22442,20 +22487,20 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, "node_modules/graphql": { - "version": "16.3.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.3.0.tgz", - "integrity": "sha512-xm+ANmA16BzCT5pLjuXySbQVFwH3oJctUVdy81w1sV0vBU0KgDdBGtxQOUd5zqOBk/JayAFeG8Dlmeq74rjm/A==", + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", "peer": true, "engines": { - "node": "^12.22.0 || ^14.16.0 || >=16.0.0" + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, "node_modules/graphql-request": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-3.7.0.tgz", - "integrity": "sha512-dw5PxHCgBneN2DDNqpWu8QkbbJ07oOziy8z+bK/TAXufsOLaETuVO4GkXrbs0WjhdKhBMN3BkpN/RIvUHkmNUQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", + "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", "dependencies": { - "cross-fetch": "^3.0.6", + "cross-fetch": "^3.1.5", "extract-files": "^9.0.0", "form-data": "^3.0.0" }, @@ -22607,6 +22652,43 @@ "hardhat": "^2.0.2" } }, + "node_modules/hardhat-tracer": { + "version": "1.1.0-rc.6", + "resolved": "https://registry.npmjs.org/hardhat-tracer/-/hardhat-tracer-1.1.0-rc.6.tgz", + "integrity": "sha512-u1d8YpyYBCj/7xVMPDxsx+H1gBaothk/XNLeTYuEmxC6WmVMEwVjpdnmTYZiRQ2ntUfwSIjwKhDkLOqewBqaQA==", + "dependencies": { + "ethers": "^5.6.1" + }, + "peerDependencies": { + "chalk": "4.x", + "ethers": "5.x", + "hardhat": "2.x" + } + }, + "node_modules/hardhat/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hardhat/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -23099,6 +23181,20 @@ "node": ">=6" } }, + "node_modules/inquirer/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/inquirer/node_modules/strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -23111,6 +23207,18 @@ "node": ">=6" } }, + "node_modules/inquirer/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/insert-module-globals": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", @@ -24324,6 +24432,30 @@ "node": ">=8" } }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -25999,6 +26131,20 @@ "npm": ">5" } }, + "node_modules/patch-package/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/patch-package/node_modules/cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -26063,6 +26209,18 @@ "node": ">=6" } }, + "node_modules/patch-package/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -28091,6 +28249,20 @@ "node": ">=4" } }, + "node_modules/solhint/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/solhint/node_modules/commander": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", @@ -28422,6 +28594,18 @@ "node": ">=6" } }, + "node_modules/solhint/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/solhint/node_modules/table": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", @@ -28500,6 +28684,20 @@ "antlr4ts": "^0.5.0-alpha.4" } }, + "node_modules/solidity-coverage/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/solidity-coverage/node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -28541,6 +28739,18 @@ "node": ">=10" } }, + "node_modules/solidity-coverage/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/solidity-coverage/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -29062,14 +29272,22 @@ "dev": true }, "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" + } + }, + "node_modules/supports-color/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" } }, "node_modules/swap-case": { @@ -29730,76 +29948,6 @@ "write-markdown": "dist/write-markdown.js" } }, - "node_modules/ts-command-line-args/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/ts-command-line-args/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ts-command-line-args/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/ts-command-line-args/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/ts-command-line-args/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-command-line-args/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/ts-essentials": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-1.0.4.tgz", @@ -29826,6 +29974,32 @@ "ts-generator": "dist/cli/run.js" } }, + "node_modules/ts-generator/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ts-generator/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/ts-node": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", @@ -32816,6 +32990,26 @@ "@babel/helper-validator-identifier": "^7.15.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } } }, "@babel/parser": { @@ -33679,234 +33873,242 @@ } }, "@ethersproject/abi": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", - "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", + "version": "5.6.4", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.4.tgz", + "integrity": "sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg==", "requires": { - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/abstract-provider": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", - "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz", + "integrity": "sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ==", "requires": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/networks": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/web": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/networks": "^5.6.3", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1" } }, "@ethersproject/abstract-signer": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", - "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz", + "integrity": "sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ==", "requires": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0" + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0" } }, "@ethersproject/address": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", - "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.1.tgz", + "integrity": "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q==", "requires": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/rlp": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/rlp": "^5.6.1" } }, "@ethersproject/base64": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", - "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.1.tgz", + "integrity": "sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw==", "requires": { - "@ethersproject/bytes": "^5.5.0" + "@ethersproject/bytes": "^5.6.1" } }, "@ethersproject/basex": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.5.0.tgz", - "integrity": "sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.1.tgz", + "integrity": "sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/properties": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/properties": "^5.6.0" } }, "@ethersproject/bignumber": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", - "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.2.tgz", + "integrity": "sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "bn.js": "^4.11.9" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "bn.js": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } } }, "@ethersproject/bytes": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", - "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", + "integrity": "sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g==", "requires": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/constants": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", - "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.1.tgz", + "integrity": "sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg==", "requires": { - "@ethersproject/bignumber": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2" } }, "@ethersproject/contracts": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.5.0.tgz", - "integrity": "sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg==", - "requires": { - "@ethersproject/abi": "^5.5.0", - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/transactions": "^5.5.0" + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.2.tgz", + "integrity": "sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g==", + "requires": { + "@ethersproject/abi": "^5.6.3", + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/transactions": "^5.6.2" } }, "@ethersproject/hash": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", - "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.1.tgz", + "integrity": "sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA==", "requires": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/hdnode": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.5.0.tgz", - "integrity": "sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q==", - "requires": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/basex": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/pbkdf2": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/sha2": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0", - "@ethersproject/strings": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/wordlists": "^5.5.0" + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.2.tgz", + "integrity": "sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q==", + "requires": { + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "@ethersproject/json-wallets": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz", - "integrity": "sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ==", - "requires": { - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/hdnode": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/pbkdf2": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/random": "^5.5.0", - "@ethersproject/strings": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz", + "integrity": "sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ==", + "requires": { + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/pbkdf2": "^5.6.1", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", "aes-js": "3.0.0", "scrypt-js": "3.0.1" } }, "@ethersproject/keccak256": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", - "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.1.tgz", + "integrity": "sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA==", "requires": { - "@ethersproject/bytes": "^5.5.0", + "@ethersproject/bytes": "^5.6.1", "js-sha3": "0.8.0" } }, "@ethersproject/logger": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", - "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.6.0.tgz", + "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==" }, "@ethersproject/networks": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", - "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", + "version": "5.6.4", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.4.tgz", + "integrity": "sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ==", "requires": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/pbkdf2": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz", - "integrity": "sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz", + "integrity": "sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/sha2": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/sha2": "^5.6.1" } }, "@ethersproject/properties": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", - "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.6.0.tgz", + "integrity": "sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg==", "requires": { - "@ethersproject/logger": "^5.5.0" + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/providers": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.1.tgz", - "integrity": "sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ==", - "requires": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/basex": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/networks": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/random": "^5.5.0", - "@ethersproject/rlp": "^5.5.0", - "@ethersproject/sha2": "^5.5.0", - "@ethersproject/strings": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/web": "^5.5.0", + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.8.tgz", + "integrity": "sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w==", + "requires": { + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/base64": "^5.6.1", + "@ethersproject/basex": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/networks": "^5.6.3", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/web": "^5.6.1", "bech32": "1.1.4", "ws": "7.4.6" }, @@ -33920,139 +34122,146 @@ } }, "@ethersproject/random": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.0.tgz", - "integrity": "sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.1.tgz", + "integrity": "sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/rlp": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", - "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.1.tgz", + "integrity": "sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/sha2": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.5.0.tgz", - "integrity": "sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.1.tgz", + "integrity": "sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", "hash.js": "1.1.7" } }, "@ethersproject/signing-key": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", - "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", - "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "bn.js": "^4.11.9", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.2.tgz", + "integrity": "sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ==", + "requires": { + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "bn.js": "^5.2.1", "elliptic": "6.5.4", "hash.js": "1.1.7" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } } }, "@ethersproject/solidity": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.5.0.tgz", - "integrity": "sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.1.tgz", + "integrity": "sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g==", "requires": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/sha2": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/sha2": "^5.6.1", + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/strings": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", - "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.1.tgz", + "integrity": "sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/transactions": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", - "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.2.tgz", + "integrity": "sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q==", "requires": { - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/rlp": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0" + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/rlp": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2" } }, "@ethersproject/units": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.5.0.tgz", - "integrity": "sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.1.tgz", + "integrity": "sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw==", "requires": { - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/constants": "^5.5.0", - "@ethersproject/logger": "^5.5.0" + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/constants": "^5.6.1", + "@ethersproject/logger": "^5.6.0" } }, "@ethersproject/wallet": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.5.0.tgz", - "integrity": "sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q==", - "requires": { - "@ethersproject/abstract-provider": "^5.5.0", - "@ethersproject/abstract-signer": "^5.5.0", - "@ethersproject/address": "^5.5.0", - "@ethersproject/bignumber": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/hdnode": "^5.5.0", - "@ethersproject/json-wallets": "^5.5.0", - "@ethersproject/keccak256": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/random": "^5.5.0", - "@ethersproject/signing-key": "^5.5.0", - "@ethersproject/transactions": "^5.5.0", - "@ethersproject/wordlists": "^5.5.0" + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.2.tgz", + "integrity": "sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg==", + "requires": { + "@ethersproject/abstract-provider": "^5.6.1", + "@ethersproject/abstract-signer": "^5.6.2", + "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.6.2", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/hdnode": "^5.6.2", + "@ethersproject/json-wallets": "^5.6.1", + "@ethersproject/keccak256": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/random": "^5.6.1", + "@ethersproject/signing-key": "^5.6.2", + "@ethersproject/transactions": "^5.6.2", + "@ethersproject/wordlists": "^5.6.1" } }, "@ethersproject/web": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", - "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.1.tgz", + "integrity": "sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA==", "requires": { - "@ethersproject/base64": "^5.5.0", - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/base64": "^5.6.1", + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "@ethersproject/wordlists": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.5.0.tgz", - "integrity": "sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.1.tgz", + "integrity": "sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw==", "requires": { - "@ethersproject/bytes": "^5.5.0", - "@ethersproject/hash": "^5.5.0", - "@ethersproject/logger": "^5.5.0", - "@ethersproject/properties": "^5.5.0", - "@ethersproject/strings": "^5.5.0" + "@ethersproject/bytes": "^5.6.1", + "@ethersproject/hash": "^5.6.1", + "@ethersproject/logger": "^5.6.0", + "@ethersproject/properties": "^5.6.0", + "@ethersproject/strings": "^5.6.1" } }, "@humanwhocodes/config-array": { @@ -34284,15 +34493,6 @@ "solidity-ast": "^0.4.15" }, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, "bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -34308,51 +34508,11 @@ "nofilter": "^3.1.0" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "nofilter": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", "integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==", "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, @@ -35294,36 +35454,20 @@ } } }, + "@superfluid-finance/metadata": { + "version": "git+ssh://git@github.com/superfluid-finance/metadata.git#edd18b65e170417d2abff336fc14b6683fcf5e94", + "from": "@superfluid-finance/metadata@git+https://github.com/superfluid-finance/metadata.git" + }, "@superfluid-finance/sdk-core": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@superfluid-finance/sdk-core/-/sdk-core-0.3.0.tgz", - "integrity": "sha512-xON7MKl9PTfHGynGtWuobFbrHF4vz7MB2EQIBfEZshGx83JCF+Gof73PneGg7gDXkwhfSQQWOYiYGnZ5jD2o4Q==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@superfluid-finance/sdk-core/-/sdk-core-0.5.6.tgz", + "integrity": "sha512-PeaIgGu/hcM/fnSZwAGOT8BlRxH/RnLxpaC7yhsTjFZXIGIhJYIEjbUHNWVpgwKqOTX5+JTnesLwIEQdNUF0wA==", "requires": { - "@ethersproject/providers": "^5.5.1", - "ajv": "^8.8.2", + "@superfluid-finance/metadata": "git+https://github.com/superfluid-finance/metadata.git", "browserify": "^17.0.0", - "ethers": "^5.5.2", - "graphql-request": "^3.7.0", + "graphql-request": "^4.3.0", "lodash": "^4.17.21", "tsify": "^5.0.4" - }, - "dependencies": { - "ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" - } } }, "@szmarczak/http-timer": { @@ -35839,6 +35983,26 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -36596,6 +36760,26 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -37501,6 +37685,28 @@ "chalk": "^2.3.2", "strip-ansi": "^4.0.0", "super-split": "^1.1.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "ansi-regex": { @@ -38619,13 +38825,35 @@ "requires": {} }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + } } }, "change-case": { @@ -38999,6 +39227,26 @@ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", "dev": true }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "typical": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", @@ -40173,52 +40421,12 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -40252,15 +40460,6 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -41743,40 +41942,40 @@ } }, "ethers": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.2.tgz", - "integrity": "sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw==", - "requires": { - "@ethersproject/abi": "5.5.0", - "@ethersproject/abstract-provider": "5.5.1", - "@ethersproject/abstract-signer": "5.5.0", - "@ethersproject/address": "5.5.0", - "@ethersproject/base64": "5.5.0", - "@ethersproject/basex": "5.5.0", - "@ethersproject/bignumber": "5.5.0", - "@ethersproject/bytes": "5.5.0", - "@ethersproject/constants": "5.5.0", - "@ethersproject/contracts": "5.5.0", - "@ethersproject/hash": "5.5.0", - "@ethersproject/hdnode": "5.5.0", - "@ethersproject/json-wallets": "5.5.0", - "@ethersproject/keccak256": "5.5.0", - "@ethersproject/logger": "5.5.0", - "@ethersproject/networks": "5.5.1", - "@ethersproject/pbkdf2": "5.5.0", - "@ethersproject/properties": "5.5.0", - "@ethersproject/providers": "5.5.1", - "@ethersproject/random": "5.5.0", - "@ethersproject/rlp": "5.5.0", - "@ethersproject/sha2": "5.5.0", - "@ethersproject/signing-key": "5.5.0", - "@ethersproject/solidity": "5.5.0", - "@ethersproject/strings": "5.5.0", - "@ethersproject/transactions": "5.5.0", - "@ethersproject/units": "5.5.0", - "@ethersproject/wallet": "5.5.0", - "@ethersproject/web": "5.5.1", - "@ethersproject/wordlists": "5.5.0" + "version": "5.6.9", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.9.tgz", + "integrity": "sha512-lMGC2zv9HC5EC+8r429WaWu3uWJUCgUCt8xxKCFqkrFuBDZXDYIdzDUECxzjf2BMF8IVBByY1EBoGSL3RTm8RA==", + "requires": { + "@ethersproject/abi": "5.6.4", + "@ethersproject/abstract-provider": "5.6.1", + "@ethersproject/abstract-signer": "5.6.2", + "@ethersproject/address": "5.6.1", + "@ethersproject/base64": "5.6.1", + "@ethersproject/basex": "5.6.1", + "@ethersproject/bignumber": "5.6.2", + "@ethersproject/bytes": "5.6.1", + "@ethersproject/constants": "5.6.1", + "@ethersproject/contracts": "5.6.2", + "@ethersproject/hash": "5.6.1", + "@ethersproject/hdnode": "5.6.2", + "@ethersproject/json-wallets": "5.6.1", + "@ethersproject/keccak256": "5.6.1", + "@ethersproject/logger": "5.6.0", + "@ethersproject/networks": "5.6.4", + "@ethersproject/pbkdf2": "5.6.1", + "@ethersproject/properties": "5.6.0", + "@ethersproject/providers": "5.6.8", + "@ethersproject/random": "5.6.1", + "@ethersproject/rlp": "5.6.1", + "@ethersproject/sha2": "5.6.1", + "@ethersproject/signing-key": "5.6.2", + "@ethersproject/solidity": "5.6.1", + "@ethersproject/strings": "5.6.1", + "@ethersproject/transactions": "5.6.2", + "@ethersproject/units": "5.6.1", + "@ethersproject/wallet": "5.6.2", + "@ethersproject/web": "5.6.1", + "@ethersproject/wordlists": "5.6.1" } }, "ethjs-abi": { @@ -50329,6 +50528,28 @@ "requires": { "chalk": "^2.4.2", "node-emoji": "^1.10.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "glob": { @@ -50446,17 +50667,17 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, "graphql": { - "version": "16.3.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.3.0.tgz", - "integrity": "sha512-xm+ANmA16BzCT5pLjuXySbQVFwH3oJctUVdy81w1sV0vBU0KgDdBGtxQOUd5zqOBk/JayAFeG8Dlmeq74rjm/A==", + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", + "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", "peer": true }, "graphql-request": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-3.7.0.tgz", - "integrity": "sha512-dw5PxHCgBneN2DDNqpWu8QkbbJ07oOziy8z+bK/TAXufsOLaETuVO4GkXrbs0WjhdKhBMN3BkpN/RIvUHkmNUQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-4.3.0.tgz", + "integrity": "sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow==", "requires": { - "cross-fetch": "^3.0.6", + "cross-fetch": "^3.1.5", "extract-files": "^9.0.0", "form-data": "^3.0.0" }, @@ -50555,6 +50776,26 @@ "tsort": "0.0.1", "uuid": "^8.3.2", "ws": "^7.4.6" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } } }, "hardhat-contract-sizer": { @@ -50577,6 +50818,14 @@ "sha1": "^1.1.1" } }, + "hardhat-tracer": { + "version": "1.1.0-rc.6", + "resolved": "https://registry.npmjs.org/hardhat-tracer/-/hardhat-tracer-1.1.0-rc.6.tgz", + "integrity": "sha512-u1d8YpyYBCj/7xVMPDxsx+H1gBaothk/XNLeTYuEmxC6WmVMEwVjpdnmTYZiRQ2ntUfwSIjwKhDkLOqewBqaQA==", + "requires": { + "ethers": "^5.6.1" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -50959,6 +51208,17 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -50967,6 +51227,15 @@ "requires": { "ansi-regex": "^4.1.0" } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -51895,6 +52164,26 @@ "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", "requires": { "chalk": "^2.4.2" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + } } }, "longest": { @@ -53270,6 +53559,17 @@ "tmp": "^0.0.33" }, "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -53315,6 +53615,15 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, @@ -54882,6 +55191,17 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "commander": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz", @@ -55141,6 +55461,15 @@ } } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "table": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", @@ -55212,6 +55541,17 @@ "antlr4ts": "^0.5.0-alpha.4" } }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -55241,6 +55581,15 @@ "lru-cache": "^6.0.0" } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -55706,11 +56055,18 @@ "dev": true }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + } } }, "swap-case": { @@ -56265,57 +56621,6 @@ "command-line-args": "^5.1.1", "command-line-usage": "^6.1.0", "string-format": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "ts-essentials": { @@ -56339,6 +56644,28 @@ "prettier": "^2.1.2", "resolve": "^1.8.1", "ts-essentials": "^1.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "ts-node": { diff --git a/package.json b/package.json index 1b8e4b1..e33e2d9 100644 --- a/package.json +++ b/package.json @@ -57,11 +57,12 @@ }, "dependencies": { "@openzeppelin/contracts-upgradeable": "^4.1.0", - "@superfluid-finance/sdk-core": "^0.3.0", + "@superfluid-finance/sdk-core": "^0.5.6", "@truffle/abi-utils": "^0.2.3", "@uniswap/v2-core": "^1.0.1", "@uniswap/v2-periphery": "^1.1.0-beta.0", "hardhat-contract-sizer": "^2.0.3", + "hardhat-tracer": "^1.1.0-rc.6", "ricochet-exchange-sfcontracts-used": "^1.0.2", "usingtellor": "^3.0.2" } diff --git a/scripts/deploy-rextwowayalluomarket.ts b/scripts/deploy-rextwowayalluomarket.ts new file mode 100644 index 0000000..87060c3 --- /dev/null +++ b/scripts/deploy-rextwowayalluomarket.ts @@ -0,0 +1,77 @@ +import { ethers } from "hardhat"; +import { Constants } from "../misc/Constants" + +async function main() { + + function sleep(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + const [deployer] = await ethers.getSigners(); + + console.log("Deploying contracts with the account:", deployer.address); + console.log("Account balance:", (await deployer.getBalance()).toString()); + + const REXTwoWayAlluoMarket = await ethers.getContractFactory("REXTwoWayAlluoMarket"); + // const rexTwoWayAlluoMarket = await REXTwoWayAlluoMarket.attach("0xA46B49168f77977b36813C863984BC4c38997324"); + + console.log("Deploying REXTwoWayAlluoMarket") + const REG_KEY = process.env.SF_REG_KEY !== undefined ? process.env.SF_REG_KEY : ""; + console.log("REG_KEY", REG_KEY); + const rexTwoWayAlluoMarket = await REXTwoWayAlluoMarket.deploy(deployer.address, + Constants.HOST_SUPERFLUID_ADDRESS, + Constants.CFA_SUPERFLUID_ADDRESS, + Constants.IDA_SUPERFLUID_ADDRESS, + REG_KEY, + Constants.REX_REFERRAL_ADDRESS + ); + + + await rexTwoWayAlluoMarket.deployed(); + console.log("Deployed REXTwoWayAlluoMarket at address:", rexTwoWayAlluoMarket.address); + + await rexTwoWayAlluoMarket.initializeTwoWayMarket( + Constants.IBALLUOUSD_ADDRESS, + Constants.TELLOR_USDC_REQUEST_ID, + 1e6, + // Constants.IBALLUOETH_ADDRESS, + // Constants.TELLOR_ETH_REQUEST_ID, + Constants.IBALLUOBTC_ADDRESS, + Constants.TELLOR_WBTC_REQUEST_ID, + 1e9, + 5000, + 20000, + { gasLimit: 2000000 } + ); + console.log("Initialized market.") + + await sleep(10000); + + // let ricAdress = + await rexTwoWayAlluoMarket.initializeSubsidies(0, Constants.RIC_TOKEN_ADDRESS, { gasLimit: 2000000 }); // 1e15/second + console.log("Initialized subsidies.") + + console.log("Registering with RexReferral system...") + const REXReferral = await ethers.getContractFactory("REXReferral"); + const referral = await REXReferral.attach(Constants.REX_REFERRAL_ADDRESS); + await referral.registerApp(rexTwoWayAlluoMarket.address); + console.log("Registered:", rexTwoWayAlluoMarket.address); + // + // // Affiliates will need to be setup manually + // // referral = await referral.connect(carl); + // // await referral.applyForAffiliate("carl", "carl"); + // // referral = await referral.connect(owner); + // // await referral.verifyAffiliate("carl"); + // + console.log("Transferring ownership to the DAO"); + await rexTwoWayAlluoMarket.transferOwnership("0x9C6B5FdC145912dfe6eE13A667aF3C5Eb07CbB89"); // 1e15/second + console.log("Ownership transferred."); + +} + +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deploy-rextwowayalluousdmarket.ts b/scripts/deploy-rextwowayalluousdmarket.ts new file mode 100644 index 0000000..18674e2 --- /dev/null +++ b/scripts/deploy-rextwowayalluousdmarket.ts @@ -0,0 +1,75 @@ +import { ethers } from "hardhat"; +import { Constants } from "../misc/Constants" + +async function main() { + + function sleep(ms: number) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + const [deployer] = await ethers.getSigners(); + + console.log("Deploying contracts with the account:", deployer.address); + console.log("Account balance:", (await deployer.getBalance()).toString()); + + const REXTwoWayAlluoUsdcxMarket = await ethers.getContractFactory("REXTwoWayAlluoUsdcxMarket"); + // const rexTwoWayAlluoMarket = await REXTwoWayAlluoUsdcxMarket.attach("0xA46B49168f77977b36813C863984BC4c38997324"); + + console.log("Deploying REXTwoWayAlluoUsdcxMarket") + const REG_KEY = process.env.SF_REG_KEY !== undefined ? process.env.SF_REG_KEY : ""; + console.log("REG_KEY", REG_KEY); + const rexTwoWayAlluoMarket = await REXTwoWayAlluoUsdcxMarket.deploy(deployer.address, + Constants.HOST_SUPERFLUID_ADDRESS, + Constants.CFA_SUPERFLUID_ADDRESS, + Constants.IDA_SUPERFLUID_ADDRESS, + REG_KEY, + Constants.REX_REFERRAL_ADDRESS + ); + + + await rexTwoWayAlluoMarket.deployed(); + console.log("Deployed REXTwoWayAlluoUsdcxMarket at address:", rexTwoWayAlluoMarket.address); + + await rexTwoWayAlluoMarket.initializeTwoWayMarket( + Constants.USDCX_ADDRESS, + Constants.TELLOR_USDC_REQUEST_ID, + 1, + Constants.IBALLUOUSD_ADDRESS, + Constants.TELLOR_USDC_REQUEST_ID, + 1, + 0, // no fee + 20000, + { gasLimit: 2000000 } + ); + console.log("Initialized market.") + + await sleep(10000); + + // let ricAdress = + await rexTwoWayAlluoMarket.initializeSubsidies(0, Constants.RIC_TOKEN_ADDRESS, { gasLimit: 2000000 }); // 1e15/second + console.log("Initialized subsidies.") + + console.log("Registering with RexReferral system...") + const REXReferral = await ethers.getContractFactory("REXReferral"); + const referral = await REXReferral.attach(Constants.REX_REFERRAL_ADDRESS); + await referral.registerApp(rexTwoWayAlluoMarket.address); + console.log("Registered:", rexTwoWayAlluoMarket.address); + // + // // Affiliates will need to be setup manually + // // referral = await referral.connect(carl); + // // await referral.applyForAffiliate("carl", "carl"); + // // referral = await referral.connect(owner); + // // await referral.verifyAffiliate("carl"); + // + console.log("Transferring ownership to the DAO"); + await rexTwoWayAlluoMarket.transferOwnership("0x9C6B5FdC145912dfe6eE13A667aF3C5Eb07CbB89"); // 1e15/second + console.log("Ownership transferred."); + +} + +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); diff --git a/test/REXTwoWayAlluoMarket.test.ts b/test/REXTwoWayAlluoMarket.test.ts new file mode 100644 index 0000000..32daa1c --- /dev/null +++ b/test/REXTwoWayAlluoMarket.test.ts @@ -0,0 +1,915 @@ +import { waffle, ethers } from "hardhat"; +import { setup, IUser, ISuperToken } from "../misc/setup"; +import { common } from "../misc/common"; +import { expect } from "chai"; +import { HttpService } from "./../misc/HttpService"; +import { Framework, SuperToken } from "@superfluid-finance/sdk-core"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { TellorPlayground, REXTwoWayAlluoMarket, REXReferral, ERC20, REXReferral__factory, IConstantFlowAgreementV1 } from "../typechain"; +import { increaseTime, impersonateAndSetBalance } from "./../misc/helpers"; +import { Constants } from "../misc/Constants"; +import { AbiCoder, parseUnits } from "ethers/lib/utils"; + +const { provider, loadFixture } = waffle; +const TEST_TRAVEL_TIME = 3600 * 2; // 2 hours +// Index 1 is for Ether and 0 for USDCx +const USDCX_SUBSCRIPTION_INDEX = 0; +const ETHX_SUBSCRIPTION_INDEX = 1; +const RIC_SUBSCRIPTION_INDEX = 2; +const ORACLE_PRECISION_DIGITS = 1000000; // A six-digit precision is required by the Tellor oracle + +export interface superTokenAndItsIDAIndex { + token: SuperToken; + IDAIndex: number; +} + +describe('REXTwoWayAlluoMarket', () => { + const errorHandler = (err: any) => { + if (err) throw err; + }; + + const overrides = { gasLimit: '6000000' }; // Using this to manually limit gas to avoid giga-errors. + const inflowRateUsdc = "1000000000000000"; + const inflowRateUsdcDeposit = "4000000000000000" + const inflowRateUsdc10x = "10000000000000000"; + const inflowRateEth = "1000000000000"; + const inflowRateEthHalf = "500000000000"; + const subsidyRate = "10000000000000"; + + let rexReferral: REXReferral__factory; + let REXMarketFactory: any; + let referral: any; + let snapshot: any; + + let adminSigner: SignerWithAddress; + let aliceSigner: SignerWithAddress; + let bobSigner: SignerWithAddress; + let carlSigner: SignerWithAddress; + let usdcxWhaleSigner: SignerWithAddress; + let ethxWhaleSigner: SignerWithAddress; + let maticxWhaleSigner: SignerWithAddress; + let stIbAlluoUSDWhaleSigner: SignerWithAddress; + let stIbAlluoETHWhaleSigner: SignerWithAddress; + let karenSigner: SignerWithAddress; + + let oraclePrice: number; + + let appBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [], maticx: [] }; + let ownerBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [], maticx: [] }; + let aliceBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [], maticx: [] }; + let bobBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [], maticx: [] }; + let carlBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [], maticx: [] }; + let karenBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [], maticx: [] }; + + let sf: Framework, + superT: ISuperToken, + u: { [key: string]: IUser }, + twoWayMarket: REXTwoWayAlluoMarket, + tokenss: { [key: string]: any }, + sfRegistrationKey: any, + accountss: SignerWithAddress[], + constant: { [key: string]: string }, + tp: TellorPlayground, + ERC20: any; + + // ************** All the supertokens used in Ricochet are declared ********************** + let stIbAlluoUSD: SuperToken; + let stIbAlluoETH: SuperToken; + let ricochetRIC: SuperToken; + let ricochetETHx: SuperToken; + let ricochetETH: SuperToken; + let ibAlluoUSD: any; + let ibAlluoETH: any; + let weth: any; + + let usdcxAndItsIDAIndex: superTokenAndItsIDAIndex; + let ethxAndItsIDAIndex: superTokenAndItsIDAIndex; + let ricAndItsIDAIndex: superTokenAndItsIDAIndex; + let ricAndItsOtherIDAIndex: superTokenAndItsIDAIndex; + + // *************************************************************************************** + + async function takeMeasurements(balances: SuperTokensBalances, signer: SignerWithAddress): Promise { + + appBalances.stIbAlluoUSD.push((await superT.stIbAlluoUSD.balanceOf({ account: twoWayMarket.address, providerOrSigner: provider })).toString()); + ownerBalances.stIbAlluoUSD.push((await superT.stIbAlluoUSD.balanceOf({ account: u.admin.address, providerOrSigner: provider })).toString()); + aliceBalances.stIbAlluoUSD.push((await superT.stIbAlluoUSD.balanceOf({ account: u.alice.address, providerOrSigner: provider })).toString()); + carlBalances.stIbAlluoUSD.push((await superT.stIbAlluoUSD.balanceOf({ account: u.carl.address, providerOrSigner: provider })).toString()); + karenBalances.stIbAlluoUSD.push((await superT.stIbAlluoUSD.balanceOf({account: u.karen.address, providerOrSigner: provider})).toString()); + bobBalances.stIbAlluoUSD.push((await superT.stIbAlluoUSD.balanceOf({ account: u.bob.address, providerOrSigner: provider })).toString()); + + appBalances.stIbAlluoETH.push((await superT.stIbAlluoETH.balanceOf({ account: twoWayMarket.address, providerOrSigner: provider })).toString()); + ownerBalances.stIbAlluoETH.push((await superT.stIbAlluoETH.balanceOf({ account: u.admin.address, providerOrSigner: provider })).toString()); + aliceBalances.stIbAlluoETH.push((await superT.stIbAlluoETH.balanceOf({ account: u.alice.address, providerOrSigner: provider })).toString()); + carlBalances.stIbAlluoETH.push((await superT.stIbAlluoETH.balanceOf({ account: u.carl.address, providerOrSigner: provider })).toString()); + karenBalances.stIbAlluoETH.push((await superT.stIbAlluoETH.balanceOf({account: u.karen.address, providerOrSigner: provider})).toString()); + bobBalances.stIbAlluoETH.push((await superT.stIbAlluoETH.balanceOf({ account: u.bob.address, providerOrSigner: provider })).toString()); + + appBalances.ric.push((await superT.ric.balanceOf({ account: twoWayMarket.address, providerOrSigner: provider })).toString()); + ownerBalances.ric.push((await superT.ric.balanceOf({ account: u.admin.address, providerOrSigner: provider })).toString()); + aliceBalances.ric.push((await superT.ric.balanceOf({ account: u.alice.address, providerOrSigner: provider })).toString()); + carlBalances.ric.push((await superT.ric.balanceOf({ account: u.carl.address, providerOrSigner: provider })).toString()); + karenBalances.ric.push((await superT.ric.balanceOf({account: u.karen.address, providerOrSigner: provider})).toString()); + bobBalances.ric.push((await superT.ric.balanceOf({ account: u.bob.address, providerOrSigner: provider })).toString()); + } + + async function resetMeasurements(): Promise { + appBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [] }; + ownerBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [] }; + aliceBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [] }; + bobBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [] }; + carlBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [] }; + karenBalances = { stIbAlluoUSD: [], stIbAlluoETH: [], ric: [] }; + } + + async function approveSubscriptions(tokensAndIDAIndexes: superTokenAndItsIDAIndex[], signers: SignerWithAddress[]) { + console.log(" ======== Inside approveSubscriptions ==========="); + let tokenIndex: number; + for (let i = 0; i < signers.length; i++) { + for (let j = 0; j < tokensAndIDAIndexes.length; j++) { + tokenIndex = tokensAndIDAIndexes[j].IDAIndex; + await sf.idaV1 + .approveSubscription({ + indexId: tokenIndex.toString(), + superToken: tokensAndIDAIndexes[j].token.address, + publisher: twoWayMarket.address, + userData: "0x", + }) + .exec(signers[i]); + console.log("====== ", i, " subscription to token ", j, " approved ======="); + } + } + } + + async function checkBalance(user: SignerWithAddress, name: string) { + console.log(" checkBalance START ======== Balance of ", name, " with address: ", user.address, " ============= "); + let balanceEthx = await stIbAlluoETH.balanceOf({ + account: user.address, providerOrSigner: provider + }); + let balanceUsdcx = await stIbAlluoUSD.balanceOf({ + account: user.address, providerOrSigner: provider + }); + let balanceRic = await ricochetRIC.balanceOf({ + account: user.address, providerOrSigner: provider + }); + + console.log("Balance in stIbAlluoETH: ", balanceEthx); + console.log("Balance in stIbAlluoUSD: ", balanceUsdcx); + console.log("Balance in RIC: ", balanceRic); + console.log(" checkBalance END ====================================================== "); + } + + async function delta(account: SignerWithAddress, balances: any) { + const len = balances.stIbAlluoETH.length; + return { + stIbAlluoETH: balances.stIbAlluoETH[len - 1] - balances.stIbAlluoETH[len - 2], + stIbAlluoUSD: balances.stIbAlluoUSD[len - 1] - balances.stIbAlluoUSD[len - 2], + ric: balances.ric[len - 1] - balances.ric[len - 2], + } + } + + before(async () => { + hre.tracer.enable = false; + const { + superfluid, + users, + accounts, + tokens, + superTokens, + contracts, + constants, + tellor, + } = await setup(); + console.log("============ Right after initSuperfluid() =================="); + + const { createSFRegistrationKey } = await common(); + + u = users; + sf = superfluid; + superT = superTokens; + tokenss = tokens; + accountss = accounts; + sfRegistrationKey = createSFRegistrationKey; + constant = constants; + tp = tellor; + + // This order is established in misc/setup.ts + adminSigner = accountss[0]; + aliceSigner = accountss[1]; + bobSigner = accountss[2]; + carlSigner = accountss[3]; + karenSigner = accountss[4]; + ethxWhaleSigner = accountss[6]; + stIbAlluoUSDWhaleSigner = accountss[8]; + stIbAlluoETHWhaleSigner = accountss[9]; + + ricochetRIC = superT.ric; + stIbAlluoUSD = superT.stIbAlluoUSD; + stIbAlluoETH = superT.stIbAlluoETH; + ricochetETHx = superT.ethx; + + weth = tokenss.weth; + ibAlluoUSD = tokenss.ibAlluoUSD; + ibAlluoETH = tokenss.ibAlluoETH; + + + usdcxAndItsIDAIndex = { + token: stIbAlluoUSD, + IDAIndex: USDCX_SUBSCRIPTION_INDEX, + } + ethxAndItsIDAIndex = { + token: stIbAlluoETH, + IDAIndex: ETHX_SUBSCRIPTION_INDEX, + } + ricAndItsIDAIndex = { + token: ricochetRIC, + IDAIndex: RIC_SUBSCRIPTION_INDEX, + } + ricAndItsOtherIDAIndex = { + token: ricochetRIC, + IDAIndex: 3, + } + + console.log("======******** List of addresses ======="); + for (let i = 0; i < accountss.length; i++) { + console.log("Address number ", i, ": ", accountss[i].address); + } + console.log("++++++++++++++ alice address number: ", aliceSigner.address); + console.log("++++++++++++++ bob address number: ", bobSigner.address); + console.log("++++++++++++++ carl address number: ", carlSigner.address); + + console.log("======******** List of TOKENS addresses ======="); + console.log("======** stIbAlluoUSD's address: ", stIbAlluoUSD.address); + console.log("======** stIbAlluoETH's address: ", stIbAlluoETH.address); + // ============================================================================== + + // Deploy REXReferral + rexReferral = await ethers.getContractFactory("REXReferral", { + signer: adminSigner, + }); + referral = await rexReferral.deploy(); + await referral.deployed(); + console.log("=========== Deployed REXReferral ============"); + + // ============================================================================== + const registrationKey = await sfRegistrationKey(sf, adminSigner.address); + console.log("============ Right after sfRegistrationKey() =================="); + + // ============== + // Deploy REX Market + console.log("Deploying REXTwoWayMarket..."); + REXMarketFactory = await ethers.getContractFactory( + "REXTwoWayAlluoMarket", + adminSigner + ); + console.log("admin signer address:", adminSigner.address); + twoWayMarket = await REXMarketFactory.deploy( + adminSigner.address, + sf.settings.config.hostAddress, + Constants.CFA_SUPERFLUID_ADDRESS, + Constants.IDA_SUPERFLUID_ADDRESS, + registrationKey, + referral.address + ); + console.log("=========== Deployed REXTwoWayAlluoMarket ============"); + + // Update the oracles + let httpService = new HttpService(); + // const url = "https://api.coingecko.com/api/v3/simple/price?ids=" + Constants.COINGECKO_KEY + "&vs_currencies=usd"; + // let response = await httpService.get(url); + // oraclePrice = parseInt(response.data[Constants.COINGECKO_KEY].usd) * ORACLE_PRECISION_DIGITS; + oraclePrice = 1950000000; // Should be the price of stIbAlluoUSD/stIbAlluoETH + console.log("oraclePrice: ", oraclePrice.toString()); + await tp.submitValue(Constants.TELLOR_ETH_REQUEST_ID, oraclePrice); + await tp.submitValue(Constants.TELLOR_USDC_REQUEST_ID, ORACLE_PRECISION_DIGITS); + console.log("=========== Updated the oracles ============"); + // IMPORTANT --> the oracles must be updated before calling initializeTwoWayMarket + console.log("initializeTwoWayMarket", stIbAlluoUSD.address, stIbAlluoETH.address); + await twoWayMarket.initializeTwoWayMarket( + stIbAlluoUSD.address, + Constants.TELLOR_USDC_REQUEST_ID, + 1e7, + stIbAlluoETH.address, + Constants.TELLOR_ETH_REQUEST_ID, + 1e9, + 5000, + 20000 + ); + console.log("=========== Initialized TwoWayMarket ============"); + + await twoWayMarket.initializeSubsidies(subsidyRate, ricochetRIC.address); + console.log("========== Initialized subsidies ==========="); + + await checkBalance(stIbAlluoUSDWhaleSigner, "the stIbAlluoUSD whale"); + await checkBalance(stIbAlluoETHWhaleSigner, "the stIbAlluoETH whale"); + // send the contract some RIC + try { + await ricochetRIC.transfer({ + receiver: twoWayMarket.address, + amount: "1000000000000000000" + }).exec(adminSigner); + } catch (err: any) { + console.log("Ricochet - ERROR transferring RICs to the contract: ", err); + } + console.log("============ RICs have been sent to the contract ============="); + await checkBalance(adminSigner, "the contract"); + + // Register the market with REXReferral + await referral.registerApp(twoWayMarket.address); + referral = await referral.connect(carlSigner); + await referral.applyForAffiliate("carl", "carl"); + referral = await referral.connect(adminSigner); + await referral.verifyAffiliate("carl"); + console.log(" ============ The affiliate has been veryfied ============="); + console.log("======================================================================="); + console.log("================ End of \"before\" block =============================="); + console.log("======================================================================="); + + + // Do all the approvals + // TODO: Redo how indexes are setup + await approveSubscriptions([usdcxAndItsIDAIndex, ethxAndItsIDAIndex, ricAndItsIDAIndex, ricAndItsOtherIDAIndex], + [adminSigner, aliceSigner, bobSigner, karenSigner, carlSigner]); + + // Give Alice, Bob, Karen some tokens + console.log(ethxWhaleSigner.address) + + let initialAmount = ethers.utils.parseUnits("1000", 18).toString(); + + await stIbAlluoUSD + .transfer({ + receiver: aliceSigner.address, + amount: initialAmount, + }).exec(stIbAlluoUSDWhaleSigner); + console.log("====== Transferred to alice ======="); + await stIbAlluoETH + .transfer({ + receiver: bobSigner.address, + amount: ethers.utils.parseUnits("0.018", 18).toString(), + }).exec(stIbAlluoETHWhaleSigner); + console.log("ETH") + await ricochetRIC + .transfer({ + receiver: bobSigner.address, + amount: '1000000000000000000000', + }).exec(adminSigner); + console.log("RIC") + + await stIbAlluoUSD + .transfer({ + receiver: karenSigner.address, + amount: initialAmount, + }).exec(stIbAlluoUSDWhaleSigner); + console.log("====== Transferred to karen ======="); + + // Take a snapshot to avoid redoing the setup + snapshot = await provider.send('evm_snapshot', []); + + }); + + context("#1 - new rexmarket with no streamers", async () => { + + beforeEach(async () => { + // Revert to the point REXMarket was just deployed + const success = await provider.send('evm_revert', [ + snapshot + ]); + // Take another snapshot to be able to revert again next time + snapshot = await provider.send('evm_snapshot', []); + expect(success).to.equal(true); + }); + + afterEach(async () => { + // Check the app isn't jailed + expect(await twoWayMarket.isAppJailed()).to.equal(false); + + // Check there's ibToken dust in the contract + console.log("leftover USD?"); + expect(await ibAlluoUSD.balanceOf(twoWayMarket.address)).to.equal(0); + console.log("leftover ETH?"); + expect(await ibAlluoETH.balanceOf(twoWayMarket.address)).to.equal(0); + + await resetMeasurements(); + }); + + it("#1.1 getters/setters", async () => { + + await twoWayMarket.setRateTolerance(1000); + expect(await twoWayMarket.getRateTolerance()).to.equal(1000); + await twoWayMarket.setFeeRate(0, 1000); + expect(await twoWayMarket.getFeeRate(0)).to.equal(1000); + await twoWayMarket.setEmissionRate(0, 1000); + expect(await twoWayMarket.getEmissionRate(0)).to.equal(1000); + expect((await twoWayMarket.getOutputPool(0)).toString()).to.equal(`${stIbAlluoUSD.address},1000,1000,${1e7}`); + expect((await twoWayMarket.getLastDistributionAt()).toNumber()).to.be.above(0) + + + }); + + it("#1.2 before/afterAgreementCreated callbacks", async () => { + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + console.log("Create flow alice"); + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, stIbAlluoUSD.address) + ).to.equal(inflowRateUsdc); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, aliceSigner.address)).toString() + ).to.equal(`true,true,995000,0`); + // Admin and Carl split 2% of the shares bc of the 50% referral fee + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, adminSigner.address)).toString() + ).to.equal(`true,true,2500,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, carlSigner.address)).toString() + ).to.equal(`true,true,2500,0`); + + // Bob opens a ETH stream to REXMarket + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoETH.address, + flowRate: inflowRateEth, + }).exec(bobSigner); + console.log("Create flow bob"); + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(bobSigner.address, stIbAlluoETH.address) + ).to.equal(inflowRateEth); + expect( + (await twoWayMarket.getIDAShares(USDCX_SUBSCRIPTION_INDEX, bobSigner.address)).toString() + ).to.equal(`true,true,99500,0`); + // Admin gets all of the 2% bc bob was an organic referral + expect( + (await twoWayMarket.getIDAShares(USDCX_SUBSCRIPTION_INDEX, adminSigner.address)).toString() + ).to.equal(`true,true,500,0`); + expect( + (await twoWayMarket.getIDAShares(USDCX_SUBSCRIPTION_INDEX, carlSigner.address)).toString() + ).to.equal(`true,true,0,0`); + + }); + + it("#1.3 before/afterAgreementTerminated callbacks", async () => { + + await takeMeasurements(); + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + + // Bob opens a ETH stream to REXMarket + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoETH.address, + flowRate: inflowRateEth, + }).exec(bobSigner); + + await increaseTime(3600) + + // Delete Alices stream before first distributions + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: aliceSigner.address, + superToken: stIbAlluoUSD.address + }).exec(aliceSigner); + + // Delete Alices stream before first distributions + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: bobSigner.address, + superToken: stIbAlluoETH.address + }).exec(bobSigner); + + await takeMeasurements(); + + // Check balance for alice again + let aliceDelta = await delta(aliceSigner, aliceBalances); + let bobDelta = await delta(bobSigner, bobBalances); + + console.log("babBalances", bobBalances) + console.log("aliceBalances", aliceBalances) + + // Expect alice didn't lose anything since she closed stream before distribute + expect(aliceDelta.stIbAlluoUSD).to.equal(0); + + // TODO: expect(bobDelta.stIbAlluoETH).to.equal(0); + + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, stIbAlluoUSD.address) + ).to.equal('0'); + expect( + await twoWayMarket.getStreamRate(bobSigner.address, stIbAlluoETH.address) + ).to.equal('0'); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, aliceSigner.address)).toString() + ).to.equal(`true,true,0,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, adminSigner.address)).toString() + ).to.equal(`true,true,0,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, carlSigner.address)).toString() + ).to.equal(`true,true,0,0`); + expect( + (await twoWayMarket.getIDAShares(USDCX_SUBSCRIPTION_INDEX, bobSigner.address)).toString() + ).to.equal(`true,true,0,0`); + expect( + (await twoWayMarket.getIDAShares(USDCX_SUBSCRIPTION_INDEX, adminSigner.address)).toString() + ).to.equal(`true,true,0,0`); + + }); + + it("#1.4 one-sided distribution", async () => { + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + + // Check balance + await takeMeasurements(); + + // Fast forward an hour and distribute + await increaseTime(3600); + await tp.submitValue(Constants.TELLOR_ETH_REQUEST_ID, oraclePrice); + await tp.submitValue(Constants.TELLOR_USDC_REQUEST_ID, ORACLE_PRECISION_DIGITS); + await tp.submitValue(Constants.TELLOR_RIC_REQUEST_ID, ORACLE_PRECISION_DIGITS); + await twoWayMarket.updateTokenPrices(); + await twoWayMarket.distribute("0x"); + + // Check balances again + await takeMeasurements(); + + // Compute the delta + let deltaAlice = await delta(aliceSigner, aliceBalances); + let deltaCarl = await delta(carlSigner, carlBalances); + let deltaOwner = await delta(adminSigner, ownerBalances); + + // Expect Alice and Bob got the right output less the 2% fee + 1% slippage + console.log("Alice got this much stIbAlluoETH", deltaAlice.stIbAlluoETH); + console.log("Alice paid this much stIbAlluoUSD", -1 * deltaAlice.stIbAlluoUSD); + console.log("stIbAlluoETH/USD rate", -1*deltaAlice.stIbAlluoUSD/deltaAlice.stIbAlluoETH); + expect(deltaAlice.stIbAlluoETH).to.be.above(deltaAlice.stIbAlluoUSD / oraclePrice * 1e6 * -1 * 0.97) + + // Expect Owner and Carl got their fee from Alice + expect(deltaCarl.stIbAlluoETH / (deltaAlice.stIbAlluoETH + deltaCarl.stIbAlluoETH + deltaOwner.stIbAlluoETH)).to.within(0.0025, 0.00251) + expect(deltaOwner.stIbAlluoETH / (deltaAlice.stIbAlluoETH + deltaCarl.stIbAlluoETH + deltaOwner.stIbAlluoETH)).to.within(0.0025, 0.00251) + }); + + }); + + context("#2 - existing market with streamers on both sides", async () => { + + before(async () => { + const success = await provider.send('evm_revert', [ + snapshot + ]); + + // Bob opens a ETH stream to REXMarket + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoETH.address, + flowRate: inflowRateEth, + overrides + }).exec(bobSigner); + + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + overrides + }).exec(aliceSigner); + + // Take a snapshot + snapshot = await provider.send('evm_snapshot', []); + + }); + + beforeEach(async () => { + // Revert to the point REXMarket was just deployed + const success = await provider.send('evm_revert', [ + snapshot + ]); + // Take another snapshot to be able to revert again next time + snapshot = await provider.send('evm_snapshot', []); + expect(success).to.equal(true); + }); + + afterEach(async () => { + // Check the app isn't jailed + expect(await twoWayMarket.isAppJailed()).to.equal(false); + + // Check there's ibToken dust in the contract + expect(await ibAlluoUSD.balanceOf(twoWayMarket.address)).to.equal(0); + expect(await ibAlluoETH.balanceOf(twoWayMarket.address)).to.equal(0); + + await resetMeasurements(); + }); + + after(async () => { + // Close the streams for and leave a clean snapshot for next context + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: aliceSigner.address, + superToken: stIbAlluoUSD.address, + overrides, + }).exec(aliceSigner); + + // Delete Bobs stream + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: bobSigner.address, + superToken: stIbAlluoETH.address, + overrides, + }).exec(bobSigner); + + snapshot = await provider.send('evm_snapshot', []); + + }); + + it("#2.1 before/afterAgreementCreated callbacks", async () => { + + // Karen opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: karenSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc + }).exec(karenSigner); + + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(karenSigner.address, stIbAlluoUSD.address) + ).to.equal(inflowRateUsdc); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, aliceSigner.address)).toString() + ).to.equal(`true,true,995000,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, karenSigner.address)).toString() + ).to.equal(`true,true,995000,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, adminSigner.address)).toString() + ).to.equal(`true,true,7500,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, carlSigner.address)).toString() + ).to.equal(`true,true,2500,0`); + + }); + + it("#2.2 before/afterAgreementUpdated callbacks", async () => { + + await sf.cfaV1.updateFlow({ + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc10x, + receiver: twoWayMarket.address, + overrides, + }).exec(aliceSigner); + + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, stIbAlluoUSD.address) + ).to.equal(inflowRateUsdc10x); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, aliceSigner.address)).toString() + ).to.equal(`true,true,9950000,0`); + // Admin and Carl split 2% of the shares bc of the 50% referral fee + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, adminSigner.address)).toString() + ).to.equal(`true,true,25000,0`); + expect( + (await twoWayMarket.getIDAShares(ETHX_SUBSCRIPTION_INDEX, carlSigner.address)).toString() + ).to.equal(`true,true,25000,0`); + + }); + + it("#2.3 two-sided distribution", async () => { + + // Check balance + await takeMeasurements(); + + // Fast forward an hour and distribute + await increaseTime(3600); + await tp.submitValue(Constants.TELLOR_ETH_REQUEST_ID, oraclePrice); + await tp.submitValue(Constants.TELLOR_USDC_REQUEST_ID, ORACLE_PRECISION_DIGITS); + await tp.submitValue(Constants.TELLOR_RIC_REQUEST_ID, ORACLE_PRECISION_DIGITS); + await twoWayMarket.updateTokenPrices(); + await twoWayMarket.distribute("0x"); + + // Check balances again + await takeMeasurements(); + + // Compute the delta + let deltaAlice = await delta(aliceSigner, aliceBalances); + let deltaBob = await delta(bobSigner, bobBalances); + let deltaCarl = await delta(carlSigner, carlBalances); + let deltaOwner = await delta(adminSigner, ownerBalances); + + + // Expect Alice and Bob got the right output less the 2% fee + 1% slippage + 2% from ibAlluoX to X conversion` + expect(deltaBob.stIbAlluoUSD).to.be.above(deltaBob.stIbAlluoETH * oraclePrice / 1e6 * -1 * 0.95) + expect(deltaAlice.stIbAlluoETH).to.be.above(deltaAlice.stIbAlluoUSD / oraclePrice * 1e6 * -1 * 0.95) + // Expect Owner and Carl got their fee from Alice + expect(deltaCarl.stIbAlluoETH / (deltaAlice.stIbAlluoETH + deltaCarl.stIbAlluoETH + deltaOwner.stIbAlluoETH)).to.within(0.0025, 0.00251) + expect(deltaOwner.stIbAlluoETH / (deltaAlice.stIbAlluoETH + deltaCarl.stIbAlluoETH + deltaOwner.stIbAlluoETH)).to.within(0.0025, 0.00251) + // Expect Owner got his fee from Bob + expect(deltaOwner.stIbAlluoUSD / (deltaBob.stIbAlluoUSD + deltaOwner.stIbAlluoUSD)).to.within(0.0049999, 0.0050001) + + }); + + }); + + xcontext("#3 - market is jailed", async () => { + + before(async () => { + const success = await provider.send('evm_revert', [ + snapshot + ]); + + await takeMeasurements(); + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + // Bob opens a ETH stream to REXMarket + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoETH.address, + flowRate: inflowRateEthHalf, + }).exec(bobSigner); + + await sf.cfaV1.createFlow({ + sender: karenSigner.address, + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(karenSigner); + + await increaseTime(3600); + + // NOTE: This method stopped working because of SF protocol changes + // // Jail the app + // await impersonateAndSetBalance(Constants.CFA_SUPERFLUID_ADDRESS); + // let cfaSigner = await ethers.getSigner(Constants.CFA_SUPERFLUID_ADDRESS) + // await sf.host.hostContract.connect(cfaSigner).jailApp('0x01', twoWayMarket.address, 0, {gasLimit: '3000000'}) + + // NOTE: So instead you will need to modify the + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: karenSigner.address, + superToken: stIbAlluoUSD.address, + overrides, + }).exec(karenSigner); + + // Take a snapshot + snapshot = await provider.send('evm_snapshot', []); + + }); + + beforeEach(async () => { + // Revert to the point REXMarket was just deployed + const success = await provider.send('evm_revert', [ + snapshot + ]); + // Take another snapshot to be able to revert again next time + snapshot = await provider.send('evm_snapshot', []); + expect(success).to.equal(true); + }); + + afterEach(async () => { + // Check the app isn't jailed + // await resetMeasurements(); + }); + + it("#3.1 emergencyCloseStream", async () => { + + await twoWayMarket.emergencyCloseStream(aliceSigner.address, stIbAlluoUSD.address); + await twoWayMarket.emergencyCloseStream(bobSigner.address, stIbAlluoETH.address); + + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, stIbAlluoUSD.address) + ).to.equal(0); + + expect( + await twoWayMarket.getStreamRate(bobSigner.address, stIbAlluoETH.address) + ).to.equal(0); + + }); + + it("#3.2 should correctly emergency drain", async () => { + // + // await expect( + // twoWayMarket.emergencyDrain(stIbAlluoETH.address), + // ).to.be.revertedWith('!zeroStreamers'); + // + // await expect( + // twoWayMarket.emergencyDrain(stIbAlluoUSD.address), + // ).to.be.revertedWith('!zeroStreamers'); + + // Close both flows + // Delete Alices stream + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: aliceSigner.address, + superToken: stIbAlluoUSD.address + }).exec(aliceSigner); + + // Delete Bobs stream + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: bobSigner.address, + superToken: stIbAlluoETH.address + }).exec(bobSigner); + + await twoWayMarket.emergencyDrain(stIbAlluoETH.address); + await twoWayMarket.emergencyDrain(stIbAlluoUSD.address); + await twoWayMarket.emergencyDrain(ricochetRIC.address); + + expect((await stIbAlluoUSD.balanceOf({ + account: twoWayMarket.address, providerOrSigner: provider + })).toString()).to.equal('0'); + + expect((await stIbAlluoETH.balanceOf({ + account: twoWayMarket.address, providerOrSigner: provider + })).toString()).to.equal('0'); + + expect((await ricochetRIC.balanceOf({ + account: twoWayMarket.address, providerOrSigner: provider + })).toString()).to.equal('0'); + + await takeMeasurements(); + + // Check the owner recovers the funds sent in afterwards + let appDelta = await delta(twoWayMarket, appBalances); + let ownerDelta = await delta(adminSigner, ownerBalances); + let aliceDelta = await delta(aliceSigner, aliceBalances); + let bobDelta = await delta(bobSigner, bobBalances); + + // Expect the owner can recover the locked funds + expect(ownerDelta.stIbAlluoETH).to.be.within(-1 * bobDelta.stIbAlluoETH * 0.99, -1 * bobDelta.stIbAlluoETH * 1.01); + expect(ownerDelta.stIbAlluoUSD).to.be.within(-1 * aliceDelta.stIbAlluoUSD * 0.99, -1 * aliceDelta.stIbAlluoUSD * 1.01); + // Recover the RIC subsidies + expect(ownerDelta.ric).to.be.within(-1 * appDelta.ric * 0.99999, -1 * appDelta.ric * 1.00001); + + + }); + + it("#3.3 closeStream", async () => { + + let aliceBalanceUsdcx = await stIbAlluoUSD.balanceOf({ + account: aliceSigner.address, providerOrSigner: provider + }); + aliceBalanceUsdcx = ethers.BigNumber.from(aliceBalanceUsdcx.toString()) + // When user create stream, SF locks 4 hour deposit called initial deposit + const initialDeposit = aliceBalanceUsdcx.div(ethers.BigNumber.from('13')).mul(ethers.BigNumber.from('4')); + const inflowRate = aliceBalanceUsdcx.sub(initialDeposit).div(ethers.BigNumber.from(9 * 3600)).toString(); + // Initialize a streamer with 9 hours of balance + await sf.cfaV1.updateFlow({ + receiver: twoWayMarket.address, + superToken: stIbAlluoUSD.address, + flowRate: inflowRate.toString(), + }).exec(aliceSigner); + // Verfiy closing attempts revert + await expect(twoWayMarket.closeStream(aliceSigner.address, stIbAlluoUSD.address)).to.revertedWith('!closable'); + // Advance time 2 hours + await increaseTime(2 * 3600); + // Verify closing the stream works + aliceBalanceUsdcx = await stIbAlluoUSD.balanceOf({ + account: aliceSigner.address, providerOrSigner: provider + }); + await twoWayMarket.closeStream(aliceSigner.address, stIbAlluoUSD.address); + expect(await twoWayMarket.getStreamRate(aliceSigner.address, stIbAlluoUSD.address)).to.equal('0'); + + }); + + }); + +}); diff --git a/test/REXTwoWayAlluoUsdcxMarket.test.ts b/test/REXTwoWayAlluoUsdcxMarket.test.ts new file mode 100644 index 0000000..35ec984 --- /dev/null +++ b/test/REXTwoWayAlluoUsdcxMarket.test.ts @@ -0,0 +1,728 @@ +import { waffle, ethers } from "hardhat"; +import { setup, IUser, ISuperToken } from "../misc/setup"; +import { common } from "../misc/common"; +import { expect } from "chai"; +import { HttpService } from "./../misc/HttpService"; +import { Framework, SuperToken } from "@superfluid-finance/sdk-core"; +import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; +import { TellorPlayground, REXTwoWayAlluoUsdcxMarket, REXReferral, ERC20, REXReferral__factory, IConstantFlowAgreementV1 } from "../typechain"; +import { increaseTime, impersonateAndSetBalance } from "./../misc/helpers"; +import { Constants } from "../misc/Constants"; +import { AbiCoder, parseUnits } from "ethers/lib/utils"; + +const { provider, loadFixture } = waffle; +const TEST_TRAVEL_TIME = 3600 * 2; // 2 hours +// Index 1 is for Ether and 0 for USDCx +const USDCX_SUBSCRIPTION_INDEX = 0; +const IBALLUOUSD_SUBSCRIPTION_INDEX = 1; +const RIC_SUBSCRIPTION_INDEX = 2; +const ORACLE_PRECISION_DIGITS = 1000000; // A six-digit precision is required by the Tellor oracle + +export interface superTokenAndItsIDAIndex { + token: SuperToken; + IDAIndex: number; +} + +describe('REXTwoWayAlluoUsdcxMarket', () => { + const errorHandler = (err: any) => { + if (err) throw err; + }; + + const overrides = { gasLimit: '6000000' }; // Using this to manually limit gas to avoid giga-errors. + const inflowRateUsdc = "1000000000000000"; + const inflowRateUsdcDeposit = "4000000000000000" + const inflowRateUsdc10x = "10000000000000000"; + const inflowRateEth = "1000000000000"; + const inflowRateEthHalf = "500000000000"; + const subsidyRate = "10000000000000"; + + let rexReferral: REXReferral__factory; + let REXMarketFactory: any; + let referral: any; + let snapshot: any; + + let adminSigner: SignerWithAddress; + let aliceSigner: SignerWithAddress; + let bobSigner: SignerWithAddress; + let carlSigner: SignerWithAddress; + let usdcxWhaleSigner: SignerWithAddress; + let ethxWhaleSigner: SignerWithAddress; + let maticxWhaleSigner: SignerWithAddress; + let ibAlluoUSDWhaleSigner: SignerWithAddress; + let ibAlluoETHWhaleSigner: SignerWithAddress; + let karenSigner: SignerWithAddress; + + let oraclePrice: number; + + let appBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [], maticx: [] }; + let ownerBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [], maticx: [] }; + let aliceBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [], maticx: [] }; + let bobBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [], maticx: [] }; + let carlBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [], maticx: [] }; + let karenBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [], maticx: [] }; + + let sf: Framework, + superT: ISuperToken, + u: { [key: string]: IUser }, + twoWayMarket: REXTwoWayAlluoUsdcxMarket, + tokenss: { [key: string]: any }, + sfRegistrationKey: any, + accountss: SignerWithAddress[], + constant: { [key: string]: string }, + tp: TellorPlayground, + ERC20: any; + + // ************** All the supertokens used in Ricochet are declared ********************** + let ibAlluoUSD: SuperToken; + let ibAlluoETH: SuperToken; + let ricochetRIC: SuperToken; + let ricochetUSDCx: SuperToken; + let ricochetUSDC: SuperToken; + let weth: any; + + let usdcxAndItsIDAIndex: superTokenAndItsIDAIndex; + let ibAlluoUSDAndItsIDAIndex: superTokenAndItsIDAIndex; + let ricAndItsIDAIndex: superTokenAndItsIDAIndex; + let ricAndItsOtherIDAIndex: superTokenAndItsIDAIndex; + + // *************************************************************************************** + async function takeMeasurements(balances: SuperTokensBalances, signer: SignerWithAddress): Promise { + + appBalances.ibAlluoUSD.push((await superT.ibAlluoUSD.balanceOf({ account: twoWayMarket.address, providerOrSigner: provider })).toString()); + ownerBalances.ibAlluoUSD.push((await superT.ibAlluoUSD.balanceOf({ account: u.admin.address, providerOrSigner: provider })).toString()); + aliceBalances.ibAlluoUSD.push((await superT.ibAlluoUSD.balanceOf({ account: u.alice.address, providerOrSigner: provider })).toString()); + carlBalances.ibAlluoUSD.push((await superT.ibAlluoUSD.balanceOf({ account: u.carl.address, providerOrSigner: provider })).toString()); + karenBalances.ibAlluoUSD.push((await superT.ibAlluoUSD.balanceOf({account: u.karen.address, providerOrSigner: provider})).toString()); + bobBalances.ibAlluoUSD.push((await superT.ibAlluoUSD.balanceOf({ account: u.bob.address, providerOrSigner: provider })).toString()); + + appBalances.ricochetUSDCx.push((await ricochetUSDCx.balanceOf({ account: twoWayMarket.address, providerOrSigner: provider })).toString()); + ownerBalances.ricochetUSDCx.push((await ricochetUSDCx.balanceOf({ account: u.admin.address, providerOrSigner: provider })).toString()); + aliceBalances.ricochetUSDCx.push((await ricochetUSDCx.balanceOf({ account: u.alice.address, providerOrSigner: provider })).toString()); + carlBalances.ricochetUSDCx.push((await ricochetUSDCx.balanceOf({ account: u.carl.address, providerOrSigner: provider })).toString()); + karenBalances.ricochetUSDCx.push((await ricochetUSDCx.balanceOf({account: u.karen.address, providerOrSigner: provider})).toString()); + bobBalances.ricochetUSDCx.push((await ricochetUSDCx.balanceOf({ account: u.bob.address, providerOrSigner: provider })).toString()); + + appBalances.ric.push((await superT.ric.balanceOf({ account: twoWayMarket.address, providerOrSigner: provider })).toString()); + ownerBalances.ric.push((await superT.ric.balanceOf({ account: u.admin.address, providerOrSigner: provider })).toString()); + aliceBalances.ric.push((await superT.ric.balanceOf({ account: u.alice.address, providerOrSigner: provider })).toString()); + carlBalances.ric.push((await superT.ric.balanceOf({ account: u.carl.address, providerOrSigner: provider })).toString()); + karenBalances.ric.push((await superT.ric.balanceOf({account: u.karen.address, providerOrSigner: provider})).toString()); + bobBalances.ric.push((await superT.ric.balanceOf({ account: u.bob.address, providerOrSigner: provider })).toString()); + } + + async function resetMeasurements(): Promise { + appBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [] }; + ownerBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [] }; + aliceBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [] }; + bobBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [] }; + carlBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [] }; + karenBalances = { ibAlluoUSD: [], ricochetUSDCx: [], ric: [] }; + } + + async function approveSubscriptions(tokensAndIDAIndexes: superTokenAndItsIDAIndex[], signers: SignerWithAddress[]) { + console.log(" ======== Inside approveSubscriptions ==========="); + let tokenIndex: number; + for (let i = 0; i < signers.length; i++) { + for (let j = 0; j < tokensAndIDAIndexes.length; j++) { + tokenIndex = tokensAndIDAIndexes[j].IDAIndex; + await sf.idaV1 + .approveSubscription({ + indexId: tokenIndex.toString(), + superToken: tokensAndIDAIndexes[j].token.address, + publisher: twoWayMarket.address, + userData: "0x", + }) + .exec(signers[i]); + console.log("====== ", i, " subscription to token ", j, " approved ======="); + } + } + } + + async function checkBalance(user: SignerWithAddress, name: string) { + console.log(" checkBalance START ======== Balance of ", name, " with address: ", user.address, " ============= "); + let balanceUsdcx = await ricochetUSDCx.balanceOf({ + account: user.address, providerOrSigner: provider + }); + let balanceIballuoUSD = await ibAlluoUSD.balanceOf({ + account: user.address, providerOrSigner: provider + }); + let balanceRic = await ricochetRIC.balanceOf({ + account: user.address, providerOrSigner: provider + }); + + console.log("Balance in USDCx: ", balanceUsdcx); + console.log("Balance in ibAlluoUSD: ", balanceIballuoUSD); + console.log("Balance in RIC: ", balanceRic); + console.log(" checkBalance END ====================================================== "); + } + + async function delta(account: SignerWithAddress, balances: any) { + const len = balances.ricochetUSDCx.length; + return { + ricochetUSDCx: balances.ricochetUSDCx[len - 1] - balances.ricochetUSDCx[len - 2], + ibAlluoUSD: balances.ibAlluoUSD[len - 1] - balances.ibAlluoUSD[len - 2], + ric: balances.ric[len - 1] - balances.ric[len - 2], + } + } + + before(async () => { + hre.tracer.enable = false; + const { + superfluid, + users, + accounts, + tokens, + superTokens, + contracts, + constants, + tellor, + } = await setup(); + console.log("============ Right after initSuperfluid() =================="); + + const { createSFRegistrationKey } = await common(); + + u = users; + sf = superfluid; + superT = superTokens; + tokenss = tokens; + accountss = accounts; + sfRegistrationKey = createSFRegistrationKey; + constant = constants; + tp = tellor; + + // This order is established in misc/setup.ts + adminSigner = accountss[0]; + aliceSigner = accountss[1]; + bobSigner = accountss[2]; + carlSigner = accountss[3]; + karenSigner = accountss[4]; + usdcxWhaleSigner = accountss[5]; + ibAlluoUSDWhaleSigner = accountss[8]; + + ricochetRIC = superT.ric; + ricochetUSDCx = superT.usdcx; + ibAlluoUSD = superT.ibAlluoUSD; + + weth = tokenss.weth + + // TODO: Please refactor this + ibAlluoUSDAndItsIDAIndex = { + token: ibAlluoUSD, + IDAIndex: 0, + } + ricAndItsIDAIndex = { + token: ricochetRIC, + IDAIndex: 1, + } + + + console.log("======******** List of addresses ======="); + for (let i = 0; i < accountss.length; i++) { + console.log("Address number ", i, ": ", accountss[i].address); + } + console.log("++++++++++++++ alice address number: ", aliceSigner.address); + console.log("++++++++++++++ bob address number: ", bobSigner.address); + console.log("++++++++++++++ carl address number: ", carlSigner.address); + + console.log("======******** List of TOKENS addresses ======="); + console.log("======** ibAlluoUSD's address: ", ibAlluoUSD.address); + console.log("======** USDCx's address: ", ricochetUSDCx.address); + // ============================================================================== + + // Deploy REXReferral + rexReferral = await ethers.getContractFactory("REXReferral", { + signer: adminSigner, + }); + referral = await rexReferral.deploy(); + await referral.deployed(); + console.log("=========== Deployed REXReferral ============"); + + // ============================================================================== + const registrationKey = await sfRegistrationKey(sf, adminSigner.address); + console.log("============ Right after sfRegistrationKey() =================="); + + // ============== + // Deploy REX Market + console.log("Deploying REXTwoWayAlluoUsdcxMarket..."); + REXMarketFactory = await ethers.getContractFactory( + "REXTwoWayAlluoUsdcxMarket", + adminSigner + ); + console.log("admin signer address:", adminSigner.address); + twoWayMarket = await REXMarketFactory.deploy( + adminSigner.address, + sf.settings.config.hostAddress, + Constants.CFA_SUPERFLUID_ADDRESS, + Constants.IDA_SUPERFLUID_ADDRESS, + registrationKey, + referral.address + ); + console.log("=========== Deployed REXTwoWayAlluoUsdcxMarket ============"); + + console.log("initializeTwoWayMarket", ibAlluoUSD.address, ricochetUSDCx.address); + await twoWayMarket.initializeTwoWayMarket( + ricochetUSDCx.address, + Constants.TELLOR_USDC_REQUEST_ID, + 1, + ibAlluoUSD.address, + Constants.TELLOR_USDC_REQUEST_ID, + 1, + 0, + 20000 + ); + console.log("=========== Initialized TwoWayMarket ============"); + + await twoWayMarket.initializeSubsidies(subsidyRate, ricochetRIC.address); + console.log("========== Initialized subsidies ==========="); + + await checkBalance(ibAlluoUSDWhaleSigner, "the ibAlluoUSD whale"); + await checkBalance(usdcxWhaleSigner, "the USDCx whale"); + // send the contract some RIC + try { + await ricochetRIC.transfer({ + receiver: twoWayMarket.address, + amount: "1000000000000000000" + }).exec(adminSigner); + } catch (err: any) { + console.log("Ricochet - ERROR transferring RICs to the contract: ", err); + } + console.log("============ RICs have been sent to the contract ============="); + await checkBalance(adminSigner, "the contract"); + + // Register the market with REXReferral + await referral.registerApp(twoWayMarket.address); + referral = await referral.connect(carlSigner); + await referral.applyForAffiliate("carl", "carl"); + referral = await referral.connect(adminSigner); + await referral.verifyAffiliate("carl"); + console.log(" ============ The affiliate has been veryfied ============="); + console.log("======================================================================="); + console.log("================ End of \"before\" block =============================="); + console.log("======================================================================="); + + + // Do all the approvals + // TODO: Redo how indexes are setup + await approveSubscriptions([ibAlluoUSDAndItsIDAIndex, ricAndItsIDAIndex], + [adminSigner, aliceSigner, bobSigner, karenSigner, carlSigner]); + + // Give Alice, Bob, Karen some tokens + let initialAmount = ethers.utils.parseUnits("1000", 18).toString(); + await ricochetUSDCx + .transfer({ + receiver: aliceSigner.address, + amount: initialAmount, + }).exec(usdcxWhaleSigner); + console.log("====== Transferred USDCx to alice ======="); + await ricochetUSDCx + .transfer({ + receiver: bobSigner.address, + amount: initialAmount, + }).exec(usdcxWhaleSigner); + console.log("====== Transferred USDCx to bob ======="); + + await ibAlluoUSD + .transfer({ + receiver: bobSigner.address, + amount: initialAmount, + }).exec(ibAlluoUSDWhaleSigner); + console.log("====== Transferred USDCx to bob ======="); + + await ricochetUSDCx + .transfer({ + receiver: karenSigner.address, + amount: initialAmount, + }).exec(usdcxWhaleSigner); + console.log("====== Transferred USDCx to karen ======="); + await ricochetRIC + .transfer({ + receiver: bobSigner.address, + amount: '1000000000000000000000', + }).exec(adminSigner); + console.log("RIC") + + // Take a snapshot to avoid redoing the setup + snapshot = await provider.send('evm_snapshot', []); + + }); + + context.only("#1 - new rexmarket with no streamers", async () => { + + beforeEach(async () => { + // Revert to the point REXMarket was just deployed + const success = await provider.send('evm_revert', [ + snapshot + ]); + // Take another snapshot to be able to revert again next time + snapshot = await provider.send('evm_snapshot', []); + expect(success).to.equal(true); + }); + + afterEach(async () => { + // Check the app isn't jailed + expect(await twoWayMarket.isAppJailed()).to.equal(false); + await resetMeasurements(); + }); + + it("#1.1 getters/setters", async () => { + + await twoWayMarket.setRateTolerance(1000); + expect(await twoWayMarket.getRateTolerance()).to.equal(1000); + await twoWayMarket.setFeeRate(0, 1000); + expect(await twoWayMarket.getFeeRate(0)).to.equal(1000); + await twoWayMarket.setEmissionRate(0, 1000); + expect(await twoWayMarket.getEmissionRate(0)).to.equal(1000); + expect((await twoWayMarket.getOutputPool(0)).toString()).to.equal(`${ibAlluoUSD.address},1000,1000,1`); + expect((await twoWayMarket.getLastDistributionAt()).toNumber()).to.be.above(0) + + + }); + + it("#1.2 before/afterAgreementCreated callbacks", async () => { + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + console.log("Create flow alice"); + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, ricochetUSDCx.address) + ).to.equal(inflowRateUsdc); + expect( + (await twoWayMarket.getIDAShares(IBALLUOUSD_SUBSCRIPTION_INDEX, aliceSigner.address)).toString() + ).to.equal(`true,true,1000000000000000,0`); + // No fees + + // Bob opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc, + }).exec(bobSigner); + console.log("Create flow bob"); + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(bobSigner.address, ricochetUSDCx.address) + ).to.equal(inflowRateUsdc); + expect( + (await twoWayMarket.getIDAShares(IBALLUOUSD_SUBSCRIPTION_INDEX, bobSigner.address)).toString() + ).to.equal(`true,true,1000000000000000,0`); + + }); + + // TODO: before/afterAgreementUpdated + + it("#1.3 before/afterAgreementTerminated callbacks", async () => { + + await takeMeasurements(); + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + + // Bob opens a ETH stream to REXMarket + // await sf.cfaV1.createFlow({ + // sender: bobSigner.address, + // receiver: twoWayMarket.address, + // superToken: ricochetUSDCx.address, + // flowRate: inflowRateUsdc10x, + // }).exec(bobSigner); + + await increaseTime(3600) + + // Delete Alices stream before first distributions + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: aliceSigner.address, + superToken: ricochetUSDCx.address + }).exec(aliceSigner); + + // Delete Alices stream before first distributions + // await sf.cfaV1.deleteFlow({ + // receiver: twoWayMarket.address, + // sender: bobSigner.address, + // superToken: ricochetUSDCx.address + // }).exec(bobSigner); + + await takeMeasurements(); + + // Check balance for alice again + let aliceDelta = await delta(aliceSigner, aliceBalances); + let bobDelta = await delta(bobSigner, bobBalances); + + console.log("babBalances", bobBalances) + console.log("aliceBalances", aliceBalances) + + // Expect alice didn't lose anything since she closed stream before distribute + expect(aliceDelta.ricochetUSDCx).to.equal(0); + expect(aliceDelta.ricochetUSDCx).to.equal(0); + + // TODO: expect(bobDelta.ibAlluoETH).to.equal(0); + + // Expect share allocations were done correctly + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, ricochetUSDCx.address) + ).to.equal('0'); + expect( + await twoWayMarket.getStreamRate(bobSigner.address, ricochetUSDCx.address) + ).to.equal('0'); + expect( + (await twoWayMarket.getIDAShares(IBALLUOUSD_SUBSCRIPTION_INDEX, aliceSigner.address)).toString() + ).to.equal(`true,true,0,0`); + expect( + (await twoWayMarket.getIDAShares(IBALLUOUSD_SUBSCRIPTION_INDEX, bobSigner.address)).toString() + ).to.equal(`true,true,0,0`); + + + }); + + it("#1.4 one-sided distribution USDCx > ibAlluoUSD", async () => { + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc10x, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc, + }).exec(bobSigner); + + // Check balance + await takeMeasurements(); + + // Fast forward an hour and distribute + await increaseTime(3600); + await twoWayMarket.distribute("0x"); + + // Check balances again + await takeMeasurements(); + + // Compute the delta + let deltaAlice = await delta(aliceSigner, aliceBalances); + let deltaBob = await delta(bobSigner, bobBalances); + + // NOTE: Pulled manually from the forked block number + let realGrowingRatio = 1.031139986258114078; + + // Expect Alice and Bob got the right output + console.log("Alice got this much ibAlluoUSD", deltaAlice.ibAlluoUSD); + console.log("Alice paid this much USDCx", -1 * deltaAlice.ricochetUSDCx); + console.log("ibAlluoETH/USD rate", -1*deltaAlice.ricochetUSDCx/deltaAlice.ibAlluoUSD); + console.log("actual growing ratio", realGrowingRatio); + console.log("loss", (-1*deltaAlice.ricochetUSDCx/deltaAlice.ibAlluoUSD - realGrowingRatio) / realGrowingRatio); + + // Expect Alice and Bob got the right output less the 2% fee + 1% slippage + console.log("Bob got this much ibAlluoUSD", deltaBob.ibAlluoUSD); + console.log("Bob paid this much USDCx", -1 * deltaBob.ricochetUSDCx); + console.log("ibAlluoETH/USD rate", -1*deltaBob.ricochetUSDCx/deltaBob.ibAlluoUSD); + console.log("actual growing ratio", realGrowingRatio); + console.log("loss", (-1*deltaBob.ricochetUSDCx/deltaBob.ibAlluoUSD - realGrowingRatio) / realGrowingRatio); + + + // console.log("Bob got this much USDCx", deltaBob.ricochetUSDCx); + // console.log("Bob paid this much ibAlluoUSD", -1 * deltaBob.ibAlluoUSD); + // console.log("ibAlluoETH/USD rate", -1*deltaBob.ibAlluoUSD/deltaAlice.ricochetUSDCx); + // console.log("actual growing ratio", realGrowingRatio); + // console.log("loss", (-1*deltaBob.ibAlluoUSD/deltaAlice.ricochetUSDCx - realGrowingRatio) / realGrowingRatio); + + + // Expect the growing ratio + // NOTE: There's a bit of loss in the rate due to a remainder from division in the IDA distribution + // Check here that that loss is less than 0.03% + expect((-1*deltaAlice.ricochetUSDCx/deltaAlice.ibAlluoUSD - realGrowingRatio) / realGrowingRatio).to.be.below(0.0003); + expect((-1*deltaBob.ricochetUSDCx/deltaBob.ibAlluoUSD - realGrowingRatio) / realGrowingRatio).to.be.below(0.0003); + + }); + + }); + + xcontext("#3 - market is jailed", async () => { + + before(async () => { + const success = await provider.send('evm_revert', [ + snapshot + ]); + + await takeMeasurements(); + + // Alice opens a USDC stream to REXMarket + await sf.cfaV1.createFlow({ + sender: aliceSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(aliceSigner); + // Bob opens a ETH stream to REXMarket + await sf.cfaV1.createFlow({ + sender: bobSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateEthHalf, + }).exec(bobSigner); + + await sf.cfaV1.createFlow({ + sender: karenSigner.address, + receiver: twoWayMarket.address, + superToken: ricochetUSDCx.address, + flowRate: inflowRateUsdc, + userData: ethers.utils.defaultAbiCoder.encode(["string"], ["carl"]), + }).exec(karenSigner); + + await increaseTime(3600); + + // NOTE: This method stopped working because of SF protocol changes + // // Jail the app + // await impersonateAndSetBalance(Constants.CFA_SUPERFLUID_ADDRESS); + // let cfaSigner = await ethers.getSigner(Constants.CFA_SUPERFLUID_ADDRESS) + // await sf.host.hostContract.connect(cfaSigner).jailApp('0x01', twoWayMarket.address, 0, {gasLimit: '3000000'}) + + // NOTE: So instead you will need to modify the + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: karenSigner.address, + superToken: ibAlluoUSD.address, + overrides, + }).exec(karenSigner); + + // Take a snapshot + snapshot = await provider.send('evm_snapshot', []); + + }); + + beforeEach(async () => { + // Revert to the point REXMarket was just deployed + const success = await provider.send('evm_revert', [ + snapshot + ]); + // Take another snapshot to be able to revert again next time + snapshot = await provider.send('evm_snapshot', []); + expect(success).to.equal(true); + }); + + afterEach(async () => { + // Check the app isn't jailed + // await resetMeasurements(); + }); + + it("#3.1 emergencyCloseStream", async () => { + + await twoWayMarket.emergencyCloseStream(aliceSigner.address, ibAlluoUSD.address); + await twoWayMarket.emergencyCloseStream(bobSigner.address, ibAlluoETH.address); + + expect( + await twoWayMarket.getStreamRate(aliceSigner.address, ibAlluoUSD.address) + ).to.equal(0); + + expect( + await twoWayMarket.getStreamRate(bobSigner.address, ibAlluoETH.address) + ).to.equal(0); + + }); + + it("#3.2 should correctly emergency drain", async () => { + // + // await expect( + // twoWayMarket.emergencyDrain(ibAlluoETH.address), + // ).to.be.revertedWith('!zeroStreamers'); + // + // await expect( + // twoWayMarket.emergencyDrain(ibAlluoUSD.address), + // ).to.be.revertedWith('!zeroStreamers'); + + // Close both flows + // Delete Alices stream + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: aliceSigner.address, + superToken: ibAlluoUSD.address + }).exec(aliceSigner); + + // Delete Bobs stream + await sf.cfaV1.deleteFlow({ + receiver: twoWayMarket.address, + sender: bobSigner.address, + superToken: ibAlluoETH.address + }).exec(bobSigner); + + await twoWayMarket.emergencyDrain(ibAlluoETH.address); + await twoWayMarket.emergencyDrain(ibAlluoUSD.address); + await twoWayMarket.emergencyDrain(ricochetRIC.address); + + expect((await ibAlluoUSD.balanceOf({ + account: twoWayMarket.address, providerOrSigner: provider + })).toString()).to.equal('0'); + + expect((await ibAlluoETH.balanceOf({ + account: twoWayMarket.address, providerOrSigner: provider + })).toString()).to.equal('0'); + + expect((await ricochetRIC.balanceOf({ + account: twoWayMarket.address, providerOrSigner: provider + })).toString()).to.equal('0'); + + await takeMeasurements(); + + // Check the owner recovers the funds sent in afterwards + let appDelta = await delta(twoWayMarket, appBalances); + let ownerDelta = await delta(adminSigner, ownerBalances); + let aliceDelta = await delta(aliceSigner, aliceBalances); + let bobDelta = await delta(bobSigner, bobBalances); + + // Expect the owner can recover the locked funds + expect(ownerDelta.ibAlluoETH).to.be.within(-1 * bobDelta.ibAlluoETH * 0.99, -1 * bobDelta.ibAlluoETH * 1.01); + expect(ownerDelta.ibAlluoUSD).to.be.within(-1 * aliceDelta.ibAlluoUSD * 0.99, -1 * aliceDelta.ibAlluoUSD * 1.01); + // Recover the RIC subsidies + expect(ownerDelta.ric).to.be.within(-1 * appDelta.ric * 0.99999, -1 * appDelta.ric * 1.00001); + + + }); + + it("#3.3 closeStream", async () => { + + let aliceBalanceUsdcx = await ibAlluoUSD.balanceOf({ + account: aliceSigner.address, providerOrSigner: provider + }); + aliceBalanceUsdcx = ethers.BigNumber.from(aliceBalanceUsdcx.toString()) + // When user create stream, SF locks 4 hour deposit called initial deposit + const initialDeposit = aliceBalanceUsdcx.div(ethers.BigNumber.from('13')).mul(ethers.BigNumber.from('4')); + const inflowRate = aliceBalanceUsdcx.sub(initialDeposit).div(ethers.BigNumber.from(9 * 3600)).toString(); + // Initialize a streamer with 9 hours of balance + await sf.cfaV1.updateFlow({ + receiver: twoWayMarket.address, + superToken: ibAlluoUSD.address, + flowRate: inflowRate.toString(), + }).exec(aliceSigner); + // Verfiy closing attempts revert + await expect(twoWayMarket.closeStream(aliceSigner.address, ibAlluoUSD.address)).to.revertedWith('!closable'); + // Advance time 2 hours + await increaseTime(2 * 3600); + // Verify closing the stream works + aliceBalanceUsdcx = await ibAlluoUSD.balanceOf({ + account: aliceSigner.address, providerOrSigner: provider + }); + await twoWayMarket.closeStream(aliceSigner.address, ibAlluoUSD.address); + expect(await twoWayMarket.getStreamRate(aliceSigner.address, ibAlluoUSD.address)).to.equal('0'); + + }); + + }); + +}); diff --git a/test/REXTwoWayMarket.test.ts b/test/REXTwoWayMarket.test.ts index cdcf2e6..eb05b27 100644 --- a/test/REXTwoWayMarket.test.ts +++ b/test/REXTwoWayMarket.test.ts @@ -275,7 +275,7 @@ describe('REXTwoWayMarket', () => { ); twoWayMarket = await REXMarketFactory.deploy( adminSigner.address, - sf.host.hostContract.address, + sf.settings.config.hostAddress, Constants.CFA_SUPERFLUID_ADDRESS, Constants.IDA_SUPERFLUID_ADDRESS, registrationKey, @@ -341,12 +341,6 @@ describe('REXTwoWayMarket', () => { console.log("================ End of \"before\" block =============================="); console.log("======================================================================="); - - // Do all the approvals - // TODO: Redo how indexes are setup - await approveSubscriptions([usdcxAndItsIDAIndex, ethxAndItsIDAIndex, ricAndItsIDAIndex], - [adminSigner, aliceSigner, bobSigner, karenSigner, carlSigner]); - // Give Alice, Bob, Karen some tokens const initialAmount = ethers.utils.parseUnits("1000", 18).toString(); await ricochetUSDCx @@ -381,6 +375,12 @@ describe('REXTwoWayMarket', () => { }).exec(usdcxWhaleSigner); console.log("====== Transferred to karen ======="); + // Do all the approvals + // TODO: Redo how indexes are setup + await approveSubscriptions([usdcxAndItsIDAIndex, ethxAndItsIDAIndex, ricAndItsIDAIndex], + [adminSigner, aliceSigner, bobSigner, karenSigner, carlSigner]); + + // Take a snapshot to avoid redoing the setup snapshot = await provider.send('evm_snapshot', []); @@ -418,7 +418,7 @@ describe('REXTwoWayMarket', () => { }); - it("#1.2 before/afterAgreementCreated callbacks", async () => { + it.only("#1.2 before/afterAgreementCreated callbacks", async () => { // Alice opens a USDC stream to REXMarket await sf.cfaV1.createFlow({ @@ -901,7 +901,7 @@ describe('REXTwoWayMarket', () => { twoWayMarket = await REXMarketFactory.deploy( adminSigner.address, - sf.host.hostContract.address, + sf.settings.config.hostAddress, Constants.CFA_SUPERFLUID_ADDRESS, Constants.IDA_SUPERFLUID_ADDRESS, registrationKey, @@ -1069,7 +1069,7 @@ describe('REXTwoWayMarket', () => { twoWayMarket = await REXMarketFactory.deploy( adminSigner.address, - sf.host.hostContract.address, + sf.settings.config.hostAddress, Constants.CFA_SUPERFLUID_ADDRESS, Constants.IDA_SUPERFLUID_ADDRESS, registrationKey, diff --git a/test/artifacts/superfluid/SuperfluidGovernanceII.json b/test/artifacts/superfluid/SuperfluidGovernanceII.json index 42baeac..fc63af4 100644 --- a/test/artifacts/superfluid/SuperfluidGovernanceII.json +++ b/test/artifacts/superfluid/SuperfluidGovernanceII.json @@ -211,6 +211,35 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "contract ISuperfluid", + "name": "host", + "type": "address" + }, + { + "internalType": "contract ISuperfluidToken", + "name": "superToken", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -2662,4 +2691,4 @@ "methods": {}, "version": 1 } -} \ No newline at end of file +}