diff --git a/contracts/BaseSynthetix.sol b/contracts/BaseSynthetix.sol index c55203dd16..c5af3d05c6 100644 --- a/contracts/BaseSynthetix.sol +++ b/contracts/BaseSynthetix.sol @@ -9,7 +9,6 @@ import "./interfaces/ISynthetix.sol"; // Internal references import "./interfaces/ISynth.sol"; import "./TokenState.sol"; -import "./interfaces/ISynthetixState.sol"; import "./interfaces/ISystemStatus.sol"; import "./interfaces/IExchanger.sol"; import "./interfaces/IIssuer.sol"; @@ -26,7 +25,6 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix { bytes32 public constant sUSD = "sUSD"; // ========== ADDRESS RESOLVER CONFIGURATION ========== - bytes32 private constant CONTRACT_SYNTHETIXSTATE = "SynthetixState"; bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus"; bytes32 private constant CONTRACT_EXCHANGER = "Exchanger"; bytes32 private constant CONTRACT_ISSUER = "Issuer"; @@ -50,16 +48,11 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix { // Note: use public visibility so that it can be invoked in a subclass function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { - addresses = new bytes32[](5); - addresses[0] = CONTRACT_SYNTHETIXSTATE; - addresses[1] = CONTRACT_SYSTEMSTATUS; - addresses[2] = CONTRACT_EXCHANGER; - addresses[3] = CONTRACT_ISSUER; - addresses[4] = CONTRACT_REWARDSDISTRIBUTION; - } - - function synthetixState() internal view returns (ISynthetixState) { - return ISynthetixState(requireAndGetAddress(CONTRACT_SYNTHETIXSTATE)); + addresses = new bytes32[](4); + addresses[0] = CONTRACT_SYSTEMSTATUS; + addresses[1] = CONTRACT_EXCHANGER; + addresses[2] = CONTRACT_ISSUER; + addresses[3] = CONTRACT_REWARDSDISTRIBUTION; } function systemStatus() internal view returns (ISystemStatus) { @@ -147,14 +140,13 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix { } function _canTransfer(address account, uint value) internal view returns (bool) { - (uint initialDebtOwnership, ) = synthetixState().issuanceData(account); - - if (initialDebtOwnership > 0) { + if (issuer().debtBalanceOf(account, sUSD) > 0) { (uint transferable, bool anyRateIsInvalid) = issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account)); require(value <= transferable, "Cannot transfer staked or escrowed SNX"); require(!anyRateIsInvalid, "A synth or SNX rate is invalid"); } + return true; } diff --git a/contracts/FeePool.sol b/contracts/FeePool.sol index 0b0098e812..92ebd9bf0b 100644 --- a/contracts/FeePool.sol +++ b/contracts/FeePool.sol @@ -16,11 +16,10 @@ import "./interfaces/IERC20.sol"; import "./interfaces/ISynth.sol"; import "./interfaces/ISystemStatus.sol"; import "./interfaces/ISynthetix.sol"; -import "./FeePoolState.sol"; +import "./interfaces/ISynthetixDebtShare.sol"; import "./FeePoolEternalStorage.sol"; import "./interfaces/IExchanger.sol"; import "./interfaces/IIssuer.sol"; -import "./interfaces/ISynthetixState.sol"; import "./interfaces/IRewardEscrowV2.sol"; import "./interfaces/IDelegateApprovals.sol"; import "./interfaces/IRewardsDistribution.sol"; @@ -44,7 +43,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo // This struct represents the issuance activity that's happened in a fee period. struct FeePeriod { uint64 feePeriodId; - uint64 startingDebtIndex; uint64 startTime; uint feesToDistribute; uint feesClaimed; @@ -65,12 +63,10 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo /* ========== ADDRESS RESOLVER CONFIGURATION ========== */ bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus"; - bytes32 private constant CONTRACT_SYNTHETIX = "Synthetix"; - bytes32 private constant CONTRACT_FEEPOOLSTATE = "FeePoolState"; + bytes32 private constant CONTRACT_SYNTHETIXDEBTSHARE = "SynthetixDebtShare"; bytes32 private constant CONTRACT_FEEPOOLETERNALSTORAGE = "FeePoolEternalStorage"; bytes32 private constant CONTRACT_EXCHANGER = "Exchanger"; bytes32 private constant CONTRACT_ISSUER = "Issuer"; - bytes32 private constant CONTRACT_SYNTHETIXSTATE = "SynthetixState"; bytes32 private constant CONTRACT_REWARDESCROW_V2 = "RewardEscrowV2"; bytes32 private constant CONTRACT_DELEGATEAPPROVALS = "DelegateApprovals"; bytes32 private constant CONTRACT_COLLATERALMANAGER = "CollateralManager"; @@ -89,26 +85,24 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo ) public Owned(_owner) Proxyable(_proxy) LimitedSetup(3 weeks) MixinSystemSettings(_resolver) { // Set our initial fee period _recentFeePeriodsStorage(0).feePeriodId = 1; - _recentFeePeriodsStorage(0).startTime = uint64(now); + _recentFeePeriodsStorage(0).startTime = uint64(block.timestamp); } /* ========== VIEWS ========== */ function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired(); - bytes32[] memory newAddresses = new bytes32[](13); + bytes32[] memory newAddresses = new bytes32[](11); newAddresses[0] = CONTRACT_SYSTEMSTATUS; - newAddresses[1] = CONTRACT_SYNTHETIX; - newAddresses[2] = CONTRACT_FEEPOOLSTATE; - newAddresses[3] = CONTRACT_FEEPOOLETERNALSTORAGE; - newAddresses[4] = CONTRACT_EXCHANGER; - newAddresses[5] = CONTRACT_ISSUER; - newAddresses[6] = CONTRACT_SYNTHETIXSTATE; - newAddresses[7] = CONTRACT_REWARDESCROW_V2; - newAddresses[8] = CONTRACT_DELEGATEAPPROVALS; - newAddresses[9] = CONTRACT_REWARDSDISTRIBUTION; - newAddresses[10] = CONTRACT_COLLATERALMANAGER; - newAddresses[11] = CONTRACT_WRAPPER_FACTORY; - newAddresses[12] = CONTRACT_ETHER_WRAPPER; + newAddresses[1] = CONTRACT_SYNTHETIXDEBTSHARE; + newAddresses[2] = CONTRACT_FEEPOOLETERNALSTORAGE; + newAddresses[3] = CONTRACT_EXCHANGER; + newAddresses[4] = CONTRACT_ISSUER; + newAddresses[5] = CONTRACT_REWARDESCROW_V2; + newAddresses[6] = CONTRACT_DELEGATEAPPROVALS; + newAddresses[7] = CONTRACT_REWARDSDISTRIBUTION; + newAddresses[8] = CONTRACT_COLLATERALMANAGER; + newAddresses[9] = CONTRACT_WRAPPER_FACTORY; + newAddresses[10] = CONTRACT_ETHER_WRAPPER; addresses = combineArrays(existingAddresses, newAddresses); } @@ -116,12 +110,8 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo return ISystemStatus(requireAndGetAddress(CONTRACT_SYSTEMSTATUS)); } - function synthetix() internal view returns (ISynthetix) { - return ISynthetix(requireAndGetAddress(CONTRACT_SYNTHETIX)); - } - - function feePoolState() internal view returns (FeePoolState) { - return FeePoolState(requireAndGetAddress(CONTRACT_FEEPOOLSTATE)); + function synthetixDebtShare() internal view returns (ISynthetixDebtShare) { + return ISynthetixDebtShare(requireAndGetAddress(CONTRACT_SYNTHETIXDEBTSHARE)); } function feePoolEternalStorage() internal view returns (FeePoolEternalStorage) { @@ -140,10 +130,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo return IIssuer(requireAndGetAddress(CONTRACT_ISSUER)); } - function synthetixState() internal view returns (ISynthetixState) { - return ISynthetixState(requireAndGetAddress(CONTRACT_SYNTHETIXSTATE)); - } - function rewardEscrowV2() internal view returns (IRewardEscrowV2) { return IRewardEscrowV2(requireAndGetAddress(CONTRACT_REWARDESCROW_V2)); } @@ -181,7 +167,7 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo view returns ( uint64 feePeriodId, - uint64 startingDebtIndex, + uint64 unused, // required post 185 for api compatibility uint64 startTime, uint feesToDistribute, uint feesClaimed, @@ -192,7 +178,7 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo FeePeriod memory feePeriod = _recentFeePeriodsStorage(index); return ( feePeriod.feePeriodId, - feePeriod.startingDebtIndex, + 0, feePeriod.startTime, feePeriod.feesToDistribute, feePeriod.feesClaimed, @@ -205,31 +191,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo return _recentFeePeriods[(_currentFeePeriod + index) % FEE_PERIOD_LENGTH]; } - /* ========== MUTATIVE FUNCTIONS ========== */ - - /** - * @notice Logs an accounts issuance data per fee period - * @param account Message.Senders account address - * @param debtRatio Debt percentage this account has locked after minting or burning their synth - * @param debtEntryIndex The index in the global debt ledger. synthetixState.issuanceData(account) - * @dev onlyIssuer to call me on synthetix.issue() & synthetix.burn() calls to store the locked SNX - * per fee period so we know to allocate the correct proportions of fees and rewards per period - */ - function appendAccountIssuanceRecord( - address account, - uint debtRatio, - uint debtEntryIndex - ) external onlyIssuerAndSynthetixState { - feePoolState().appendAccountIssuanceRecord( - account, - debtRatio, - debtEntryIndex, - _recentFeePeriodsStorage(0).startingDebtIndex - ); - - emitIssuanceDebtRatioEntry(account, debtRatio, debtEntryIndex, _recentFeePeriodsStorage(0).startingDebtIndex); - } - /** * @notice The Exchanger contract informs us when fees are paid. * @param amount susd amount in fees being paid. @@ -283,10 +244,13 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo delete _recentFeePeriods[_currentFeePeriod]; // Open up the new fee period. - // Increment periodId from the recent closed period feePeriodId - _recentFeePeriodsStorage(0).feePeriodId = uint64(uint256(_recentFeePeriodsStorage(1).feePeriodId).add(1)); - _recentFeePeriodsStorage(0).startingDebtIndex = uint64(synthetixState().debtLedgerLength()); - _recentFeePeriodsStorage(0).startTime = uint64(now); + // periodID is set to the current timestamp for compatibility with other systems taking snapshots on the debt shares + uint newFeePeriodId = block.timestamp; + _recentFeePeriodsStorage(0).feePeriodId = uint64(newFeePeriodId); + _recentFeePeriodsStorage(0).startTime = uint64(block.timestamp); + + // Inform Issuer to start recording for the new fee period + issuer().setCurrentPeriodId(uint128(newFeePeriodId)); emitFeePeriodClosed(_recentFeePeriodsStorage(1).feePeriodId); } @@ -362,24 +326,27 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo function importFeePeriod( uint feePeriodIndex, uint feePeriodId, - uint startingDebtIndex, uint startTime, uint feesToDistribute, uint feesClaimed, uint rewardsToDistribute, uint rewardsClaimed - ) public optionalProxy_onlyOwner onlyDuringSetup { - require(startingDebtIndex <= synthetixState().debtLedgerLength(), "Cannot import bad data"); + ) external optionalProxy_onlyOwner onlyDuringSetup { + require(feePeriodIndex < FEE_PERIOD_LENGTH, "invalid fee period index"); - _recentFeePeriods[_currentFeePeriod.add(feePeriodIndex).mod(FEE_PERIOD_LENGTH)] = FeePeriod({ + _recentFeePeriods[feePeriodIndex] = FeePeriod({ feePeriodId: uint64(feePeriodId), - startingDebtIndex: uint64(startingDebtIndex), startTime: uint64(startTime), feesToDistribute: feesToDistribute, feesClaimed: feesClaimed, rewardsToDistribute: rewardsToDistribute, rewardsClaimed: rewardsClaimed }); + + // make sure recording is aware of the actual period id + if (feePeriodIndex == 0) { + issuer().setCurrentPeriodId(uint128(feePeriodId)); + } } /** @@ -408,12 +375,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo // No need to continue iterating if we've recorded the whole amount; if (remainingToAllocate == 0) return feesPaid; - - // We've exhausted feePeriods to distribute and no fees remain in last period - // User last to claim would in this scenario have their remainder slashed - if (i == 0 && remainingToAllocate > 0) { - remainingToAllocate = 0; - } } } @@ -447,13 +408,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo // No need to continue iterating if we've recorded the whole amount; if (remainingToAllocate == 0) return rewardPaid; - - // We've exhausted feePeriods to distribute and no rewards remain in last period - // User last to claim would in this scenario have their remainder slashed - // due to rounding up of PreciseDecimal - if (i == 0 && remainingToAllocate > 0) { - remainingToAllocate = 0; - } } } return rewardPaid; @@ -579,24 +533,15 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo function feesByPeriod(address account) public view returns (uint[2][FEE_PERIOD_LENGTH] memory results) { // What's the user's debt entry index and the debt they owe to the system at current feePeriod uint userOwnershipPercentage; - uint debtEntryIndex; - FeePoolState _feePoolState = feePoolState(); + ISynthetixDebtShare sds = synthetixDebtShare(); - (userOwnershipPercentage, debtEntryIndex) = _feePoolState.getAccountsDebtEntry(account, 0); - - // If they don't have any debt ownership and they never minted, they don't have any fees. - // User ownership can reduce to 0 if user burns all synths, - // however they could have fees applicable for periods they had minted in before so we check debtEntryIndex. - if (debtEntryIndex == 0 && userOwnershipPercentage == 0) { - uint[2][FEE_PERIOD_LENGTH] memory nullResults; - return nullResults; - } + userOwnershipPercentage = sds.sharePercent(account); // The [0] fee period is not yet ready to claim, but it is a fee period that they can have // fees owing for, so we need to report on it anyway. uint feesFromPeriod; uint rewardsFromPeriod; - (feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(0, userOwnershipPercentage, debtEntryIndex); + (feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(0, userOwnershipPercentage); results[0][0] = feesFromPeriod; results[0][1] = rewardsFromPeriod; @@ -607,22 +552,13 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo // Go through our fee periods from the oldest feePeriod[FEE_PERIOD_LENGTH - 1] and figure out what we owe them. // Condition checks for periods > 0 for (uint i = FEE_PERIOD_LENGTH - 1; i > 0; i--) { - uint next = i - 1; - uint nextPeriodStartingDebtIndex = _recentFeePeriodsStorage(next).startingDebtIndex; - // We can skip the period, as no debt minted during period (next period's startingDebtIndex is still 0) - if (nextPeriodStartingDebtIndex > 0 && lastFeeWithdrawal < _recentFeePeriodsStorage(i).feePeriodId) { - // We calculate a feePeriod's closingDebtIndex by looking at the next feePeriod's startingDebtIndex - // we can use the most recent issuanceData[0] for the current feePeriod - // else find the applicableIssuanceData for the feePeriod based on the StartingDebtIndex of the period - uint closingDebtIndex = uint256(nextPeriodStartingDebtIndex).sub(1); + uint64 periodId = _recentFeePeriodsStorage(i).feePeriodId; + if (lastFeeWithdrawal < periodId) { - // Gas optimisation - to reuse debtEntryIndex if found new applicable one - // if applicable is 0,0 (none found) we keep most recent one from issuanceData[0] - // return if userOwnershipPercentage = 0) - (userOwnershipPercentage, debtEntryIndex) = _feePoolState.applicableIssuanceData(account, closingDebtIndex); + userOwnershipPercentage = sds.sharePercentOnPeriod(account, uint(periodId)); - (feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(i, userOwnershipPercentage, debtEntryIndex); + (feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(i, userOwnershipPercentage); results[i][0] = feesFromPeriod; results[i][1] = rewardsFromPeriod; @@ -640,62 +576,33 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo */ function _feesAndRewardsFromPeriod( uint period, - uint ownershipPercentage, - uint debtEntryIndex + uint ownershipPercentage ) internal view returns (uint, uint) { // If it's zero, they haven't issued, and they have no fees OR rewards. if (ownershipPercentage == 0) return (0, 0); - uint debtOwnershipForPeriod = ownershipPercentage; - - // If period has closed we want to calculate debtPercentage for the period - if (period > 0) { - uint closingDebtIndex = uint256(_recentFeePeriodsStorage(period - 1).startingDebtIndex).sub(1); - debtOwnershipForPeriod = _effectiveDebtRatioForPeriod(closingDebtIndex, ownershipPercentage, debtEntryIndex); - } + FeePeriod storage fp = _recentFeePeriodsStorage(period); // Calculate their percentage of the fees / rewards in this period // This is a high precision integer. - uint feesFromPeriod = _recentFeePeriodsStorage(period).feesToDistribute.multiplyDecimal(debtOwnershipForPeriod); + uint feesFromPeriod = fp.feesToDistribute.multiplyDecimal(ownershipPercentage); uint rewardsFromPeriod = - _recentFeePeriodsStorage(period).rewardsToDistribute.multiplyDecimal(debtOwnershipForPeriod); - - return (feesFromPeriod.preciseDecimalToDecimal(), rewardsFromPeriod.preciseDecimalToDecimal()); - } - - function _effectiveDebtRatioForPeriod( - uint closingDebtIndex, - uint ownershipPercentage, - uint debtEntryIndex - ) internal view returns (uint) { - // Figure out their global debt percentage delta at end of fee Period. - // This is a high precision integer. - ISynthetixState _synthetixState = synthetixState(); - uint feePeriodDebtOwnership = - _synthetixState - .debtLedger(closingDebtIndex) - .divideDecimalRoundPrecise(_synthetixState.debtLedger(debtEntryIndex)) - .multiplyDecimalRoundPrecise(ownershipPercentage); + fp.rewardsToDistribute.multiplyDecimal(ownershipPercentage); - return feePeriodDebtOwnership; + return (feesFromPeriod, rewardsFromPeriod); } function effectiveDebtRatioForPeriod(address account, uint period) external view returns (uint) { - require(period != 0, "Current period is not closed yet"); - require(period < FEE_PERIOD_LENGTH, "Exceeds the FEE_PERIOD_LENGTH"); + // if period is not closed yet, or outside of the fee period range, return 0 instead of reverting + if (period == 0 || period >= FEE_PERIOD_LENGTH) { + return 0; + } // If the period being checked is uninitialised then return 0. This is only at the start of the system. - if (_recentFeePeriodsStorage(period - 1).startingDebtIndex == 0) return 0; - - uint closingDebtIndex = uint256(_recentFeePeriodsStorage(period - 1).startingDebtIndex).sub(1); + if (_recentFeePeriodsStorage(period - 1).startTime == 0) return 0; - uint ownershipPercentage; - uint debtEntryIndex; - (ownershipPercentage, debtEntryIndex) = feePoolState().applicableIssuanceData(account, closingDebtIndex); - - // internal function will check closingDebtIndex has corresponding debtLedger entry - return _effectiveDebtRatioForPeriod(closingDebtIndex, ownershipPercentage, debtEntryIndex); + return synthetixDebtShare().sharePercentOnPeriod(account, uint(_recentFeePeriods[period].feePeriodId)); } /** @@ -738,13 +645,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo _; } - modifier onlyIssuerAndSynthetixState { - bool isIssuer = msg.sender == address(issuer()); - bool isSynthetixState = msg.sender == address(synthetixState()); - require(isIssuer || isSynthetixState, "Issuer and SynthetixState only"); - _; - } - modifier notFeeAddress(address account) { require(account != FEE_ADDRESS, "Fee address not allowed"); _; @@ -757,31 +657,6 @@ contract FeePool is Owned, Proxyable, LimitedSetup, MixinSystemSettings, IFeePoo /* ========== Proxy Events ========== */ - event IssuanceDebtRatioEntry( - address indexed account, - uint debtRatio, - uint debtEntryIndex, - uint feePeriodStartingDebtIndex - ); - bytes32 private constant ISSUANCEDEBTRATIOENTRY_SIG = - keccak256("IssuanceDebtRatioEntry(address,uint256,uint256,uint256)"); - - function emitIssuanceDebtRatioEntry( - address account, - uint debtRatio, - uint debtEntryIndex, - uint feePeriodStartingDebtIndex - ) internal { - proxy._emit( - abi.encode(debtRatio, debtEntryIndex, feePeriodStartingDebtIndex), - 2, - ISSUANCEDEBTRATIOENTRY_SIG, - bytes32(uint256(uint160(account))), - 0, - 0 - ); - } - event FeePeriodClosed(uint feePeriodId); bytes32 private constant FEEPERIODCLOSED_SIG = keccak256("FeePeriodClosed(uint256)"); diff --git a/contracts/Issuer.sol b/contracts/Issuer.sol index 03b253e65c..db316227b9 100644 --- a/contracts/Issuer.sol +++ b/contracts/Issuer.sol @@ -14,7 +14,7 @@ import "./SafeDecimalMath.sol"; import "./interfaces/ISynth.sol"; import "./interfaces/ISynthetix.sol"; import "./interfaces/IFeePool.sol"; -import "./interfaces/ISynthetixState.sol"; +import "./interfaces/ISynthetixDebtShare.sol"; import "./interfaces/IExchanger.sol"; import "./interfaces/IDelegateApprovals.sol"; import "./interfaces/IExchangeRates.sol"; @@ -79,10 +79,9 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { bytes32 private constant CONTRACT_SYNTHETIX = "Synthetix"; bytes32 private constant CONTRACT_EXCHANGER = "Exchanger"; bytes32 private constant CONTRACT_EXRATES = "ExchangeRates"; - bytes32 private constant CONTRACT_SYNTHETIXSTATE = "SynthetixState"; + bytes32 private constant CONTRACT_SYNTHETIXDEBTSHARE = "SynthetixDebtShare"; bytes32 private constant CONTRACT_FEEPOOL = "FeePool"; bytes32 private constant CONTRACT_DELEGATEAPPROVALS = "DelegateApprovals"; - bytes32 private constant CONTRACT_COLLATERALMANAGER = "CollateralManager"; bytes32 private constant CONTRACT_REWARDESCROW_V2 = "RewardEscrowV2"; bytes32 private constant CONTRACT_SYNTHETIXESCROW = "SynthetixEscrow"; bytes32 private constant CONTRACT_LIQUIDATIONS = "Liquidations"; @@ -94,19 +93,18 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { /* ========== VIEWS ========== */ function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired(); - bytes32[] memory newAddresses = new bytes32[](12); + bytes32[] memory newAddresses = new bytes32[](11); newAddresses[0] = CONTRACT_SYNTHETIX; newAddresses[1] = CONTRACT_EXCHANGER; newAddresses[2] = CONTRACT_EXRATES; - newAddresses[3] = CONTRACT_SYNTHETIXSTATE; + newAddresses[3] = CONTRACT_SYNTHETIXDEBTSHARE; newAddresses[4] = CONTRACT_FEEPOOL; newAddresses[5] = CONTRACT_DELEGATEAPPROVALS; newAddresses[6] = CONTRACT_REWARDESCROW_V2; newAddresses[7] = CONTRACT_SYNTHETIXESCROW; newAddresses[8] = CONTRACT_LIQUIDATIONS; newAddresses[9] = CONTRACT_DEBTCACHE; - newAddresses[10] = CONTRACT_COLLATERALMANAGER; - newAddresses[11] = CONTRACT_SYNTHREDEEMER; + newAddresses[10] = CONTRACT_SYNTHREDEEMER; return combineArrays(existingAddresses, newAddresses); } @@ -122,8 +120,8 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { return IExchangeRates(requireAndGetAddress(CONTRACT_EXRATES)); } - function synthetixState() internal view returns (ISynthetixState) { - return ISynthetixState(requireAndGetAddress(CONTRACT_SYNTHETIXSTATE)); + function synthetixDebtShare() internal view returns (ISynthetixDebtShare) { + return ISynthetixDebtShare(requireAndGetAddress(CONTRACT_SYNTHETIXDEBTSHARE)); } function feePool() internal view returns (IFeePool) { @@ -138,10 +136,6 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { return IDelegateApprovals(requireAndGetAddress(CONTRACT_DELEGATEAPPROVALS)); } - function collateralManager() internal view returns (ICollateralManager) { - return ICollateralManager(requireAndGetAddress(CONTRACT_COLLATERALMANAGER)); - } - function rewardEscrowV2() internal view returns (IRewardEscrowV2) { return IRewardEscrowV2(requireAndGetAddress(CONTRACT_REWARDESCROW_V2)); } @@ -162,6 +156,14 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { return getIssuanceRatio(); } + function _debtSharesToIssuedSynth(uint debtAmount, uint totalSystemValue, uint totalDebtShares) internal pure returns (uint) { + return debtAmount.multiplyDecimalRound(totalSystemValue).divideDecimalRound(totalDebtShares); + } + + function _issuedSynthToDebtShares(uint sharesAmount, uint totalSystemValue, uint totalDebtShares) internal pure returns (uint) { + return sharesAmount.multiplyDecimalRound(totalDebtShares).divideDecimalRound(totalSystemValue); + } + function _availableCurrencyKeysWithOptionalSNX(bool withSNX) internal view returns (bytes32[] memory) { bytes32[] memory currencyKeys = new bytes32[](availableSynths.length + (withSNX ? 1 : 0)); @@ -203,7 +205,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { return (debt.divideDecimalRound(currencyRate), anyRateIsInvalid || currencyRateInvalid); } - function _debtBalanceOfAndTotalDebt(address _issuer, bytes32 currencyKey) + function _debtBalanceOfAndTotalDebt(uint debtShareBalance, bytes32 currencyKey) internal view returns ( @@ -212,10 +214,6 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { bool anyRateIsInvalid ) { - ISynthetixState state = synthetixState(); - - // What was their initial debt ownership? - (uint initialDebtOwnership, uint debtEntryIndex) = state.issuanceData(_issuer); // What's the total value of the system excluding ETH backed synths in their requested currency? (totalSystemValue, anyRateIsInvalid) = _totalIssuedSynths(currencyKey, true); @@ -223,22 +221,9 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { // If it's zero, they haven't issued, and they have no debt. // Note: it's more gas intensive to put this check here rather than before _totalIssuedSynths // if they have 0 SNX, but it's a necessary trade-off - if (initialDebtOwnership == 0) return (0, totalSystemValue, anyRateIsInvalid); - - // Figure out the global debt percentage delta from when they entered the system. - // This is a high precision integer of 27 (1e27) decimals. - uint currentDebtOwnership = - state - .lastDebtLedgerEntry() - .divideDecimalRoundPrecise(state.debtLedger(debtEntryIndex)) - .multiplyDecimalRoundPrecise(initialDebtOwnership); + if (debtShareBalance == 0) return (0, totalSystemValue, anyRateIsInvalid); - // Their debt balance is their portion of the total system value. - uint highPrecisionBalance = - totalSystemValue.decimalToPreciseDecimal().multiplyDecimalRoundPrecise(currentDebtOwnership); - - // Convert back into 18 decimals (1e18) - debtBalance = highPrecisionBalance.preciseDecimalToDecimal(); + debtBalance = _debtSharesToIssuedSynth(debtShareBalance, totalSystemValue, synthetixDebtShare().totalSupply()); } function _canBurnSynths(address account) internal view returns (bool) { @@ -260,7 +245,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { bool anyRateIsInvalid ) { - (alreadyIssued, totalSystemDebt, anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_issuer, sUSD); + (alreadyIssued, totalSystemDebt, anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(_issuer), sUSD); (uint issuable, bool isInvalid) = _maxIssuableSynths(_issuer); maxIssuable = issuable; anyRateIsInvalid = anyRateIsInvalid || isInvalid; @@ -292,7 +277,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { function _collateralisationRatio(address _issuer) internal view returns (uint, bool) { uint totalOwnedSynthetix = _collateral(_issuer); - (uint debtBalance, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_issuer, SNX); + (uint debtBalance, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(_issuer), SNX); // it's more gas intensive to put this check here if they have 0 SNX, but it complies with the interface if (totalOwnedSynthetix == 0) return (0, anyRateIsInvalid); @@ -359,15 +344,15 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { } function debtBalanceOf(address _issuer, bytes32 currencyKey) external view returns (uint debtBalance) { - ISynthetixState state = synthetixState(); + ISynthetixDebtShare sds = synthetixDebtShare(); // What was their initial debt ownership? - (uint initialDebtOwnership, ) = state.issuanceData(_issuer); + uint debtShareBalance = sds.balanceOf(_issuer); // If it's zero, they haven't issued, and they have no debt. - if (initialDebtOwnership == 0) return 0; + if (debtShareBalance == 0) return 0; - (debtBalance, , ) = _debtBalanceOfAndTotalDebt(_issuer, currencyKey); + (debtBalance, , ) = _debtBalanceOfAndTotalDebt(debtShareBalance, currencyKey); } function remainingIssuableSynths(address _issuer) @@ -401,7 +386,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { // 100 SNX to be locked in their wallet to maintain their collateralisation ratio // The locked synthetix value can exceed their balance. uint debtBalance; - (debtBalance, , anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(account, SNX); + (debtBalance, , anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(account), SNX); uint lockedSynthetixValue = debtBalance.divideDecimalRound(getIssuanceRatio()); // If we exceed the balance, no SNX are transferable, otherwise the difference is. @@ -523,6 +508,8 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { } function issueSynths(address from, uint amount) external onlySynthetix { + require(amount > 0, "Issuer: cannot issue 0 synths"); + _issueSynths(from, amount, false); } @@ -591,7 +578,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { uint liquidationPenalty = liquidations().liquidationPenalty(); // What is their debt in sUSD? - (uint debtBalance, uint totalDebtIssued, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(account, sUSD); + (uint debtBalance, uint totalDebtIssued, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(account), sUSD); (uint snxRate, bool snxRateInvalid) = exchangeRates().rateAndInvalid(SNX); _requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid); @@ -631,6 +618,16 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { } } + function setCurrentPeriodId(uint128 periodId) external { + require(msg.sender == address(feePool()), "Must be fee pool"); + + ISynthetixDebtShare sds = synthetixDebtShare(); + + if (sds.currentPeriodId() < periodId) { + sds.takeSnapshot(periodId); + } + } + /* ========== INTERNAL FUNCTIONS ========== */ function _requireRatesNotInvalid(bool anyRateIsInvalid) internal pure { @@ -660,7 +657,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { } // Keep track of the debt they're about to create - _addToDebtRegister(from, amount, existingDebt, totalSystemDebt); + _addToDebtRegister(from, amount, totalSystemDebt); // record issue timestamp _setLastIssueEvent(from); @@ -670,9 +667,6 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { // Account for the issued debt in the cache debtCache().updateCachedsUSDDebt(SafeCast.toInt256(amount)); - - // Store their locked SNX amount to determine their fee % for the period - _appendAccountIssuanceRecord(from); } function _burnSynths( @@ -696,9 +690,6 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { // Account for the burnt debt in the cache. debtCache().updateCachedsUSDDebt(-SafeCast.toInt256(amountBurnt)); - - // Store their debtRatio against a fee period to determine their fee/rewards % for the period - _appendAccountIssuanceRecord(debtAccount); } // If burning to target, `amount` is ignored, and the correct quantity of sUSD is burnt to reach the target @@ -719,7 +710,7 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { } } - (uint existingDebt, uint totalSystemValue, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(from, sUSD); + (uint existingDebt, uint totalSystemValue, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(synthetixDebtShare().balanceOf(from), sUSD); (uint maxIssuableSynthsForAccount, bool snxRateInvalid) = _maxIssuableSynths(from); _requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid); require(existingDebt > 0, "No debt to forgive"); @@ -746,50 +737,20 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { ); } - function _appendAccountIssuanceRecord(address from) internal { - uint initialDebtOwnership; - uint debtEntryIndex; - (initialDebtOwnership, debtEntryIndex) = synthetixState().issuanceData(from); - feePool().appendAccountIssuanceRecord(from, initialDebtOwnership, debtEntryIndex); - } - function _addToDebtRegister( address from, uint amount, - uint existingDebt, uint totalDebtIssued ) internal { - ISynthetixState state = synthetixState(); - - // What will the new total be including the new value? - uint newTotalDebtIssued = amount.add(totalDebtIssued); - - // What is their percentage (as a high precision int) of the total debt? - uint debtPercentage = amount.divideDecimalRoundPrecise(newTotalDebtIssued); + ISynthetixDebtShare sds = synthetixDebtShare(); - // And what effect does this percentage change have on the global debt holding of other issuers? - // The delta specifically needs to not take into account any existing debt as it's already - // accounted for in the delta from when they issued previously. - // The delta is a high precision integer. - uint delta = SafeDecimalMath.preciseUnit().sub(debtPercentage); - - // And what does their debt ownership look like including this previous stake? - if (existingDebt > 0) { - debtPercentage = amount.add(existingDebt).divideDecimalRoundPrecise(newTotalDebtIssued); - } else { - // If they have no debt, they're a new issuer; record this. - state.incrementTotalIssuerCount(); + // it is possible (eg in tests, system initialized with extra debt) to have issued debt without any shares issued + // in which case, the first account to mint gets the debt. yw. + if (sds.totalSupply() == 0) { + sds.mintShare(from, amount); } - - // Save the debt entry parameters - state.setCurrentIssuanceData(from, debtPercentage); - - // And if we're the first, push 1 as there was no effect to any other holders, otherwise push - // the change for the rest of the debt holders. The debt ledger holds high precision integers. - if (state.debtLedgerLength() > 0) { - state.appendDebtLedgerValue(state.lastDebtLedgerEntry().multiplyDecimalRoundPrecise(delta)); - } else { - state.appendDebtLedgerValue(SafeDecimalMath.preciseUnit()); + else { + sds.mintShare(from, _issuedSynthToDebtShares(amount, totalDebtIssued, sds.totalSupply())); } } @@ -799,40 +760,17 @@ contract Issuer is Owned, MixinSystemSettings, IIssuer { uint existingDebt, uint totalDebtIssued ) internal { - ISynthetixState state = synthetixState(); - - // What will the new total after taking out the withdrawn amount - uint newTotalDebtIssued = totalDebtIssued.sub(debtToRemove); - - uint delta = 0; + ISynthetixDebtShare sds = synthetixDebtShare(); - // What will the debt delta be if there is any debt left? - // Set delta to 0 if no more debt left in system after user - if (newTotalDebtIssued > 0) { - // What is the percentage of the withdrawn debt (as a high precision int) of the total debt after? - uint debtPercentage = debtToRemove.divideDecimalRoundPrecise(newTotalDebtIssued); - - // And what effect does this percentage change have on the global debt holding of other issuers? - // The delta specifically needs to not take into account any existing debt as it's already - // accounted for in the delta from when they issued previously. - delta = SafeDecimalMath.preciseUnit().add(debtPercentage); - } + uint currentDebtShare = sds.balanceOf(from); - // Are they exiting the system, or are they just decreasing their debt position? if (debtToRemove == existingDebt) { - state.setCurrentIssuanceData(from, 0); - state.decrementTotalIssuerCount(); - } else { - // What percentage of the debt will they be left with? - uint newDebt = existingDebt.sub(debtToRemove); - uint newDebtPercentage = newDebt.divideDecimalRoundPrecise(newTotalDebtIssued); - - // Store the debt percentage and debt ledger as high precision integers - state.setCurrentIssuanceData(from, newDebtPercentage); + sds.burnShare(from, currentDebtShare); + } + else { + uint balanceToRemove = _issuedSynthToDebtShares(debtToRemove, totalDebtIssued, sds.totalSupply()); + sds.burnShare(from, balanceToRemove < currentDebtShare ? balanceToRemove : currentDebtShare); } - - // Update our cumulative ledger. This is also a high precision integer. - state.appendDebtLedgerValue(state.lastDebtLedgerEntry().multiplyDecimalRoundPrecise(delta)); } /* ========== MODIFIERS ========== */ diff --git a/contracts/SynthetixDebtShare.sol b/contracts/SynthetixDebtShare.sol new file mode 100644 index 0000000000..6db032b860 --- /dev/null +++ b/contracts/SynthetixDebtShare.sol @@ -0,0 +1,302 @@ +pragma solidity ^0.5.16; + +// Inheritance +import "./Owned.sol"; +import "./interfaces/ISynthetixDebtShare.sol"; +import "./MixinResolver.sol"; + +// Libraries +import "./SafeDecimalMath.sol"; + +// https://docs.synthetix.io/contracts/source/contracts/synthetixdebtshare +contract SynthetixDebtShare is Owned, MixinResolver, ISynthetixDebtShare { + using SafeMath for uint; + using SafeDecimalMath for uint; + + struct PeriodBalance { + uint128 amount; + uint128 periodId; + } + + bytes32 public constant CONTRACT_NAME = "SynthetixDebtShare"; + + bytes32 private constant CONTRACT_ISSUER = "Issuer"; + + uint internal constant MAX_PERIOD_ITERATE = 30; + + /* ========== STATE VARIABLES ========== */ + + /** + * Addresses selected by owner which are allowed to call `transferFrom` to manage debt shares + */ + mapping(address => bool) public authorizedBrokers; + + /** + * Addresses selected by owner which are allowed to call `takeSnapshot` + * `takeSnapshot` is not public because only a small number of snapshots can be retained for a period of time, and so they + * must be controlled to prevent censorship + */ + mapping(address => bool) public authorizedToSnapshot; + + /** + * Records a user's balance as it changes from period to period. + * The last item in the array always represents the user's most recent balance + * The intermediate balance is only recorded if + * `currentPeriodId` differs (which would happen upon a call to `setCurrentPeriodId`) + */ + mapping(address => PeriodBalance[]) public balances; + + /** + * Records totalSupply as it changes from period to period + * Similar to `balances`, the `totalSupplyOnPeriod` at index `currentPeriodId` matches the current total supply + * Any other period ID would represent its most recent totalSupply before the period ID changed. + */ + mapping(uint => uint) public totalSupplyOnPeriod; + + + /* ERC20 fields. */ + string public name; + string public symbol; + uint8 public decimals; + + /** + * Period ID used for recording accounting changes + * Can only increment + */ + uint128 public currentPeriodId; + + /** + * Prevents the owner from making further changes to debt shares after initial import + */ + bool public isInitialized = false; + + constructor(address _owner, address _resolver) public Owned(_owner) MixinResolver(_resolver) { + name = "Synthetix Debt Shares"; + symbol = "SDS"; + decimals = 18; + + // NOTE: must match initial fee period ID on `FeePool` constructor if issuer wont report + currentPeriodId = 1; + } + function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { + addresses = new bytes32[](1); + addresses[0] = CONTRACT_ISSUER; + } + + /* ========== VIEWS ========== */ + + function balanceOf(address account) public view returns (uint) { + uint accountPeriodHistoryCount = balances[account].length; + + if (accountPeriodHistoryCount == 0) { + return 0; + } + + return uint(balances[account][accountPeriodHistoryCount - 1].amount); + } + + function balanceOfOnPeriod(address account, uint periodId) public view returns (uint) { + uint accountPeriodHistoryCount = balances[account].length; + + int oldestHistoryIterate = int(MAX_PERIOD_ITERATE < accountPeriodHistoryCount ? accountPeriodHistoryCount - MAX_PERIOD_ITERATE : 0); + int i; + for (i = int(accountPeriodHistoryCount) - 1;i >= oldestHistoryIterate;i--) { + if (balances[account][uint(i)].periodId <= periodId) { + return uint(balances[account][uint(i)].amount); + } + } + + require(i < 0, "SynthetixDebtShare: not found in recent history"); + return 0; + } + + function totalSupply() public view returns (uint) { + return totalSupplyOnPeriod[currentPeriodId]; + } + + function sharePercent(address account) external view returns (uint) { + return sharePercentOnPeriod(account, currentPeriodId); + } + + function sharePercentOnPeriod(address account, uint periodId) public view returns (uint) { + uint balance = balanceOfOnPeriod(account, periodId); + + if (balance == 0) { + return 0; + } + + return balance.divideDecimal(totalSupplyOnPeriod[periodId]); + } + + function allowance(address, address spender) public view returns (uint) { + if (authorizedBrokers[spender]) { + return uint(-1); + } + else { + return 0; + } + } + + /* ========== MUTATIVE FUNCTIONS ========== */ + + function addAuthorizedBroker(address target) external onlyOwner { + authorizedBrokers[target] = true; + emit ChangeAuthorizedBroker(target, true); + } + + function removeAuthorizedBroker(address target) external onlyOwner { + authorizedBrokers[target] = false; + emit ChangeAuthorizedBroker(target, false); + } + + function addAuthorizedToSnapshot(address target) external onlyOwner { + authorizedToSnapshot[target] = true; + emit ChangeAuthorizedToSnapshot(target, true); + } + + function removeAuthorizedToSnapshot(address target) external onlyOwner { + authorizedToSnapshot[target] = false; + emit ChangeAuthorizedToSnapshot(target, false); + } + + function takeSnapshot(uint128 id) external onlyAuthorizedToSnapshot { + require(id > currentPeriodId, "period id must always increase"); + totalSupplyOnPeriod[id] = totalSupplyOnPeriod[currentPeriodId]; + currentPeriodId = id; + } + + function mintShare(address account, uint256 amount) external onlyIssuer { + require(account != address(0), "ERC20: mint to the zero address"); + + _increaseBalance(account, amount); + + totalSupplyOnPeriod[currentPeriodId] = totalSupplyOnPeriod[currentPeriodId].add(amount); + + emit Transfer(address(0), account, amount); + emit Mint(account, amount); + } + + function burnShare(address account, uint256 amount) external onlyIssuer { + require(account != address(0), "ERC20: burn from zero address"); + + _deductBalance(account, amount); + + totalSupplyOnPeriod[currentPeriodId] = totalSupplyOnPeriod[currentPeriodId].sub(amount); + emit Transfer(account, address(0), amount); + emit Burn(account, amount); + } + + function approve(address, uint256) external pure returns(bool) { + revert("debt shares are not transferrable"); + } + + function transfer(address, uint256) external pure returns(bool) { + revert("debt shares are not transferrable"); + } + + function transferFrom(address from, address to, uint256 amount) external onlyAuthorizedBrokers returns(bool) { + require(to != address(0), "ERC20: send to the zero address"); + + _deductBalance(from, amount); + _increaseBalance(to, amount); + + emit Transfer(address(from), address(to), amount); + + return true; + } + + function importAddresses(address[] calldata accounts, uint256[] calldata amounts) external onlyOwner onlySetup { + uint supply = totalSupplyOnPeriod[currentPeriodId]; + + for (uint i = 0; i < accounts.length; i++) { + uint curBalance = balanceOf(accounts[i]); + if (curBalance < amounts[i]) { + uint amount = amounts[i] - curBalance; + _increaseBalance(accounts[i], amount); + supply = supply.add(amount); + emit Mint(accounts[i], amount); + emit Transfer(address(0), accounts[i], amount); + } + else if (curBalance > amounts[i]) { + uint amount = curBalance - amounts[i]; + _deductBalance(accounts[i], amount); + supply = supply.sub(amount); + emit Burn(accounts[i], amount); + emit Transfer(accounts[i], address(0), amount); + } + } + + totalSupplyOnPeriod[currentPeriodId] = supply; + } + + function finishSetup() external onlyOwner { + isInitialized = true; + } + + /* ========== INTERNAL FUNCTIONS ======== */ + function _increaseBalance(address account, uint amount) internal { + uint accountBalanceCount = balances[account].length; + + if (accountBalanceCount == 0) { + balances[account].push(PeriodBalance(uint128(amount), uint128(currentPeriodId))); + } + else { + uint128 newAmount = uint128(uint(balances[account][accountBalanceCount - 1].amount).add(amount)); + + if (balances[account][accountBalanceCount - 1].periodId != currentPeriodId) { + balances[account].push(PeriodBalance(newAmount, currentPeriodId)); + } + else { + balances[account][accountBalanceCount - 1].amount = newAmount; + } + } + } + + function _deductBalance(address account, uint amount) internal { + uint accountBalanceCount = balances[account].length; + + require(accountBalanceCount != 0, "SynthetixDebtShare: account has no share to deduct"); + + uint128 newAmount = uint128(uint(balances[account][accountBalanceCount - 1].amount).sub(amount)); + + if (balances[account][accountBalanceCount - 1].periodId != currentPeriodId) { + balances[account].push(PeriodBalance( + newAmount, + currentPeriodId + )); + } + else { + balances[account][accountBalanceCount - 1].amount = newAmount; + } + } + + /* ========== MODIFIERS ========== */ + + modifier onlyIssuer() { + require(msg.sender == requireAndGetAddress(CONTRACT_ISSUER), "SynthetixDebtShare: only issuer can mint/burn"); + _; + } + + modifier onlyAuthorizedToSnapshot() { + require(authorizedToSnapshot[msg.sender] || msg.sender == requireAndGetAddress(CONTRACT_ISSUER), "SynthetixDebtShare: not authorized to snapshot"); + _; + } + + modifier onlyAuthorizedBrokers() { + require(authorizedBrokers[msg.sender], "SynthetixDebtShare: only brokers can transferFrom"); + _; + } + + modifier onlySetup() { + require(!isInitialized, "SynthetixDebt: only callable while still initializing"); + _; + } + + /* ========== EVENTS ========== */ + event Mint(address indexed account, uint amount); + event Burn(address indexed account, uint amount); + event Transfer(address indexed from, address indexed to, uint value); + + event ChangeAuthorizedBroker(address indexed authorizedBroker, bool authorized); + event ChangeAuthorizedToSnapshot(address indexed authorizedToSnapshot, bool authorized); +} diff --git a/contracts/SynthetixStateWithLimitedSetup.sol b/contracts/SynthetixStateWithLimitedSetup.sol deleted file mode 100644 index e49ceda55d..0000000000 --- a/contracts/SynthetixStateWithLimitedSetup.sol +++ /dev/null @@ -1,99 +0,0 @@ -pragma solidity ^0.5.16; - -// Inheritance -import "./LimitedSetup.sol"; -import "./SynthetixState.sol"; - -// Internal References -import "./interfaces/IFeePool.sol"; - -// https://docs.synthetix.io/contracts/source/contracts/synthetixstate -contract SynthetixStateWithLimitedSetup is SynthetixState, LimitedSetup { - IFeePool public feePool; - - // Import state - uint public importedDebtAmount; - - constructor(address _owner, address _associatedContract) - public - SynthetixState(_owner, _associatedContract) - LimitedSetup(1 weeks) - {} - - /* ========== SETTERS ========== */ - - /** - * @notice set the FeePool contract as it is the only authority to be able to call - * appendVestingEntry with the onlyFeePool modifer - */ - function setFeePool(IFeePool _feePool) external onlyOwner { - feePool = _feePool; - emit FeePoolUpdated(address(_feePool)); - } - - // /** - // * @notice Import issuer data - // * @dev Only callable by the contract owner, and only for 1 week after deployment. - // */ - function importIssuerData(address[] calldata accounts, uint[] calldata sUSDAmounts) external onlyOwner onlyDuringSetup { - require(accounts.length == sUSDAmounts.length, "Length mismatch"); - - for (uint8 i = 0; i < accounts.length; i++) { - _addToDebtRegister(accounts[i], sUSDAmounts[i]); - } - } - - // /** - // * @notice Import issuer debt data - // * @dev Only used from importIssuerData above, meant to be disposable - // */ - function _addToDebtRegister(address account, uint amount) internal { - // What is the value that we've previously imported? - uint totalDebtIssued = importedDebtAmount; - - // What will the new total be including the new value? - uint newTotalDebtIssued = amount.add(totalDebtIssued); - - // Save that for the next import. - importedDebtAmount = newTotalDebtIssued; - - // What is their percentage (as a high precision int) of the total debt? - uint debtPercentage = amount.divideDecimalRoundPrecise(newTotalDebtIssued); - - // And what effect does this percentage change have on the global debt holding of other issuers? - // The delta specifically needs to not take into account any existing debt as it's already - // accounted for in the delta from when they issued previously. - // The delta is a high precision integer. - uint delta = SafeDecimalMath.preciseUnit().sub(debtPercentage); - - // We ignore any existingDebt as this is being imported in as amount - - // Are they a new issuer? If so, record them. (same as incrementTotalIssuerCount) - if (issuanceData[account].initialDebtOwnership == 0) { - totalIssuerCount = totalIssuerCount.add(1); - } - - // Save the debt entry parameters (same as setCurrentIssuanceData) - issuanceData[account].initialDebtOwnership = debtPercentage; - issuanceData[account].debtEntryIndex = debtLedger.length; - - // And if we're the first, push 1 as there was no effect to any other holders, otherwise push - // the change for the rest of the debt holders. The debt ledger holds high precision integers. - if (debtLedger.length > 0) { - debtLedger.push(debtLedger[debtLedger.length - 1].multiplyDecimalRoundPrecise(delta)); - } else { - debtLedger.push(SafeDecimalMath.preciseUnit()); - } - - // append issuanceData to FeePoolState - feePool.appendAccountIssuanceRecord( - account, - issuanceData[account].initialDebtOwnership, - issuanceData[account].debtEntryIndex - ); - } - - /* ========== EVENTS ========== */ - - event FeePoolUpdated(address newFeePool); -} diff --git a/contracts/interfaces/IFeePool.sol b/contracts/interfaces/IFeePool.sol index 809126e606..fc7299b411 100644 --- a/contracts/interfaces/IFeePool.sol +++ b/contracts/interfaces/IFeePool.sol @@ -26,13 +26,6 @@ interface IFeePool { function closeCurrentFeePeriod() external; - // Restricted: used internally to Synthetix - function appendAccountIssuanceRecord( - address account, - uint lockedAmount, - uint debtEntryIndex - ) external; - function recordFeePaid(uint sUSDAmount) external; function setRewardsToDistribute(uint amount) external; diff --git a/contracts/interfaces/IIssuer.sol b/contracts/interfaces/IIssuer.sol index 854c8bc976..1ffa87a64e 100644 --- a/contracts/interfaces/IIssuer.sol +++ b/contracts/interfaces/IIssuer.sol @@ -92,4 +92,6 @@ interface IIssuer { uint susdAmount, address liquidator ) external returns (uint totalRedeemed, uint amountToLiquidate); + + function setCurrentPeriodId(uint128 periodId) external; } diff --git a/contracts/interfaces/ISynthetixDebtShare.sol b/contracts/interfaces/ISynthetixDebtShare.sol new file mode 100644 index 0000000000..96f6e3fa0f --- /dev/null +++ b/contracts/interfaces/ISynthetixDebtShare.sol @@ -0,0 +1,42 @@ +pragma solidity >=0.4.24; + +// https://docs.synthetix.io/contracts/source/interfaces/isynthetixdebtshare +interface ISynthetixDebtShare { + // Views + + function currentPeriodId() external view returns (uint128); + + function allowance(address account, address spender) external view returns (uint); + + function balanceOf(address account) external view returns (uint); + + function balanceOfOnPeriod(address account, uint periodId) external view returns (uint); + + function totalSupply() external view returns (uint); + + function sharePercent(address account) external view returns (uint); + + function sharePercentOnPeriod(address account, uint periodId) external view returns (uint); + + // Mutative functions + + function takeSnapshot(uint128 id) external; + + function mintShare(address account, uint256 amount) external; + + function burnShare(address account, uint256 amount) external; + + function approve(address, uint256) external pure returns (bool); + + function transfer(address to, uint256 amount) external pure returns(bool); + + function transferFrom(address from, address to, uint256 amount) external returns(bool); + + function addAuthorizedBroker(address target) external; + + function removeAuthorizedBroker(address target) external; + + function addAuthorizedToSnapshot(address target) external; + + function removeAuthorizedToSnapshot(address target) external; +} diff --git a/contracts/migrations/Migration_Alkaid.sol b/contracts/migrations/Migration_Alkaid.sol deleted file mode 100644 index b36b437f76..0000000000 --- a/contracts/migrations/Migration_Alkaid.sol +++ /dev/null @@ -1,1038 +0,0 @@ -pragma solidity ^0.5.16; - -import "../AddressResolver.sol"; -import "../BaseMigration.sol"; -import "../ExchangeRatesWithDexPricing.sol"; -import "../ExchangeState.sol"; -import "../FeePool.sol"; -import "../FeePoolEternalStorage.sol"; -import "../FeePoolState.sol"; -import "../Issuer.sol"; -import "../legacy/LegacyTokenState.sol"; -import "../MultiCollateralSynth.sol"; -import "../Proxy.sol"; -import "../ProxyERC20.sol"; -import "../RewardEscrow.sol"; -import "../RewardsDistribution.sol"; -import "../SynthetixState.sol"; -import "../SystemSettings.sol"; -import "../SystemStatus.sol"; -import "../TokenState.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -library Migration_Alkaid_Supplemental { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0xb440DD674e1243644791a4AdfE3A2AbB0A92d309 - Proxy public constant proxyfeepool_i = Proxy(0xb440DD674e1243644791a4AdfE3A2AbB0A92d309); - // https://etherscan.io/address/0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB - FeePoolEternalStorage public constant feepooleternalstorage_i = - FeePoolEternalStorage(0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB); - // https://etherscan.io/address/0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02 - FeePoolState public constant feepoolstate_i = FeePoolState(0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02); - // https://etherscan.io/address/0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F - Proxy public constant proxysynthetix_i = Proxy(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F); - // https://etherscan.io/address/0x545973f28950f50fc6c7F52AAb4Ad214A27C0564 - ExchangeState public constant exchangestate_i = ExchangeState(0x545973f28950f50fc6c7F52AAb4Ad214A27C0564); - // https://etherscan.io/address/0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E - SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E); - // https://etherscan.io/address/0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD - LegacyTokenState public constant tokenstatesynthetix_i = LegacyTokenState(0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD); - // https://etherscan.io/address/0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82 - SynthetixState public constant synthetixstate_i = SynthetixState(0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82); - // https://etherscan.io/address/0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F - RewardEscrow public constant rewardescrow_i = RewardEscrow(0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F); - // https://etherscan.io/address/0x29C295B046a73Cde593f21f63091B072d407e3F2 - RewardsDistribution public constant rewardsdistribution_i = - RewardsDistribution(0x29C295B046a73Cde593f21f63091B072d407e3F2); - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579 - FeePool public constant feepool_i = FeePool(0xc398406FFfBEd5B0680e706634490062CB1DB579); - // https://etherscan.io/address/0x6d9296Df2ad52F174bF671f555d78628bEBa7752 - ExchangeRatesWithDexPricing public constant exchangerates_i = - ExchangeRatesWithDexPricing(0x6d9296Df2ad52F174bF671f555d78628bEBa7752); - // https://etherscan.io/address/0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA - MultiCollateralSynth public constant synthsusd_i = MultiCollateralSynth(0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA); - // https://etherscan.io/address/0x05a9CBe762B36632b3594DA4F082340E0e5343e8 - TokenState public constant tokenstatesusd_i = TokenState(0x05a9CBe762B36632b3594DA4F082340E0e5343e8); - // https://etherscan.io/address/0x57Ab1ec28D129707052df4dF418D58a2D46d5f51 - Proxy public constant proxysusd_i = Proxy(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51); - // https://etherscan.io/address/0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0 - MultiCollateralSynth public constant synthseur_i = MultiCollateralSynth(0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0); - // https://etherscan.io/address/0x6568D9e750fC44AF00f857885Dfb8281c00529c4 - TokenState public constant tokenstateseur_i = TokenState(0x6568D9e750fC44AF00f857885Dfb8281c00529c4); - // https://etherscan.io/address/0xD71eCFF9342A5Ced620049e616c5035F1dB98620 - ProxyERC20 public constant proxyseur_i = ProxyERC20(0xD71eCFF9342A5Ced620049e616c5035F1dB98620); - // https://etherscan.io/address/0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A - MultiCollateralSynth public constant synthsjpy_i = MultiCollateralSynth(0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A); - // https://etherscan.io/address/0x4dFACfB15514C21c991ff75Bc7Bf6Fb1F98361ed - TokenState public constant tokenstatesjpy_i = TokenState(0x4dFACfB15514C21c991ff75Bc7Bf6Fb1F98361ed); - // https://etherscan.io/address/0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d - ProxyERC20 public constant proxysjpy_i = ProxyERC20(0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d); - // https://etherscan.io/address/0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827 - MultiCollateralSynth public constant synthsaud_i = MultiCollateralSynth(0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827); - // https://etherscan.io/address/0xCb29D2cf2C65d3Be1d00F07f3441390432D55203 - TokenState public constant tokenstatesaud_i = TokenState(0xCb29D2cf2C65d3Be1d00F07f3441390432D55203); - // https://etherscan.io/address/0xF48e200EAF9906362BB1442fca31e0835773b8B4 - ProxyERC20 public constant proxysaud_i = ProxyERC20(0xF48e200EAF9906362BB1442fca31e0835773b8B4); - // https://etherscan.io/address/0xde3892383965FBa6eC434bE6350F85f140098708 - MultiCollateralSynth public constant synthsgbp_i = MultiCollateralSynth(0xde3892383965FBa6eC434bE6350F85f140098708); - // https://etherscan.io/address/0x7e88D19A79b291cfE5696d496055f7e57F537A75 - TokenState public constant tokenstatesgbp_i = TokenState(0x7e88D19A79b291cfE5696d496055f7e57F537A75); - // https://etherscan.io/address/0x97fe22E7341a0Cd8Db6F6C021A24Dc8f4DAD855F - ProxyERC20 public constant proxysgbp_i = ProxyERC20(0x97fe22E7341a0Cd8Db6F6C021A24Dc8f4DAD855F); - // https://etherscan.io/address/0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D - MultiCollateralSynth public constant synthschf_i = MultiCollateralSynth(0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D); - // https://etherscan.io/address/0x52496fE8a4feaEFe14d9433E00D48E6929c13deC - TokenState public constant tokenstateschf_i = TokenState(0x52496fE8a4feaEFe14d9433E00D48E6929c13deC); - // https://etherscan.io/address/0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d - ProxyERC20 public constant proxyschf_i = ProxyERC20(0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d); - // https://etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455 - MultiCollateralSynth public constant synthskrw_i = MultiCollateralSynth(0xe2f532c389deb5E42DCe53e78A9762949A885455); - // https://etherscan.io/address/0x93B6e9FbBd2c32a0DC3C2B943B7C3CBC2fE23730 - TokenState public constant tokenstateskrw_i = TokenState(0x93B6e9FbBd2c32a0DC3C2B943B7C3CBC2fE23730); - // https://etherscan.io/address/0x269895a3dF4D73b077Fc823dD6dA1B95f72Aaf9B - ProxyERC20 public constant proxyskrw_i = ProxyERC20(0x269895a3dF4D73b077Fc823dD6dA1B95f72Aaf9B); - // https://etherscan.io/address/0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353 - MultiCollateralSynth public constant synthsbtc_i = MultiCollateralSynth(0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353); - // https://etherscan.io/address/0x4F6296455F8d754c19821cF1EC8FeBF2cD456E67 - TokenState public constant tokenstatesbtc_i = TokenState(0x4F6296455F8d754c19821cF1EC8FeBF2cD456E67); - // https://etherscan.io/address/0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6 - ProxyERC20 public constant proxysbtc_i = ProxyERC20(0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6); - // https://etherscan.io/address/0xc70B42930BD8D30A79B55415deC3be60827559f7 - MultiCollateralSynth public constant synthseth_i = MultiCollateralSynth(0xc70B42930BD8D30A79B55415deC3be60827559f7); - // https://etherscan.io/address/0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c - TokenState public constant tokenstateseth_i = TokenState(0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c); - // https://etherscan.io/address/0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb - ProxyERC20 public constant proxyseth_i = ProxyERC20(0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb); - // https://etherscan.io/address/0x3FFE35c3d412150C3B91d3E22eBA60E16030C608 - MultiCollateralSynth public constant synthslink_i = MultiCollateralSynth(0x3FFE35c3d412150C3B91d3E22eBA60E16030C608); - // https://etherscan.io/address/0x577D4a7395c6A5f46d9981a5F83fa7294926aBB0 - TokenState public constant tokenstateslink_i = TokenState(0x577D4a7395c6A5f46d9981a5F83fa7294926aBB0); - // https://etherscan.io/address/0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6 - ProxyERC20 public constant proxyslink_i = ProxyERC20(0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6); - // https://etherscan.io/address/0x8f9fa817200F5B95f9572c8Acf2b31410C00335a - MultiCollateralSynth public constant synthsada_i = MultiCollateralSynth(0x8f9fa817200F5B95f9572c8Acf2b31410C00335a); - // https://etherscan.io/address/0x9956c5019a24fbd5B506AD070b771577bAc5c343 - TokenState public constant tokenstatesada_i = TokenState(0x9956c5019a24fbd5B506AD070b771577bAc5c343); - // https://etherscan.io/address/0xe36E2D3c7c34281FA3bC737950a68571736880A1 - ProxyERC20 public constant proxysada_i = ProxyERC20(0xe36E2D3c7c34281FA3bC737950a68571736880A1); - // https://etherscan.io/address/0x0705F0716b12a703d4F8832Ec7b97C61771f0361 - MultiCollateralSynth public constant synthsaave_i = MultiCollateralSynth(0x0705F0716b12a703d4F8832Ec7b97C61771f0361); - // https://etherscan.io/address/0x9BcED8A8E3Ad81c9b146FFC880358f734A06f7c0 - TokenState public constant tokenstatesaave_i = TokenState(0x9BcED8A8E3Ad81c9b146FFC880358f734A06f7c0); - // https://etherscan.io/address/0xd2dF355C19471c8bd7D8A3aa27Ff4e26A21b4076 - ProxyERC20 public constant proxysaave_i = ProxyERC20(0xd2dF355C19471c8bd7D8A3aa27Ff4e26A21b4076); - // https://etherscan.io/address/0xfA60918C4417b64E722ca15d79C751c1f24Ab995 - MultiCollateralSynth public constant synthsdot_i = MultiCollateralSynth(0xfA60918C4417b64E722ca15d79C751c1f24Ab995); - // https://etherscan.io/address/0x73B1a2643507Cd30F11Dfcf2D974f4373E5BC077 - TokenState public constant tokenstatesdot_i = TokenState(0x73B1a2643507Cd30F11Dfcf2D974f4373E5BC077); - // https://etherscan.io/address/0x1715AC0743102BF5Cd58EfBB6Cf2dC2685d967b6 - ProxyERC20 public constant proxysdot_i = ProxyERC20(0x1715AC0743102BF5Cd58EfBB6Cf2dC2685d967b6); - // https://etherscan.io/address/0xe59dFC746D566EB40F92ed0B162004e24E3AC932 - MultiCollateralSynth public constant synthsdefi_i = MultiCollateralSynth(0xe59dFC746D566EB40F92ed0B162004e24E3AC932); - // https://etherscan.io/address/0x7Ac2D37098a65B0f711CFfA3be635F1E6aCacFaB - TokenState public constant tokenstatesdefi_i = TokenState(0x7Ac2D37098a65B0f711CFfA3be635F1E6aCacFaB); - // https://etherscan.io/address/0xe1aFe1Fd76Fd88f78cBf599ea1846231B8bA3B6B - ProxyERC20 public constant proxysdefi_i = ProxyERC20(0xe1aFe1Fd76Fd88f78cBf599ea1846231B8bA3B6B); - // https://etherscan.io/address/0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915 - Issuer public constant issuer_i = Issuer(0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915); - // https://etherscan.io/address/0xb6B476C41Ea01930e6abE1f44b96800de0404c98 - SystemSettings public constant systemsettings_i = SystemSettings(0xb6B476C41Ea01930e6abE1f44b96800de0404c98); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://etherscan.io/address/0xb6B476C41Ea01930e6abE1f44b96800de0404c98 - address public constant new_SystemSettings_contract = 0xb6B476C41Ea01930e6abE1f44b96800de0404c98; - // https://etherscan.io/address/0x6d9296Df2ad52F174bF671f555d78628bEBa7752 - address public constant new_ExchangeRates_contract = 0x6d9296Df2ad52F174bF671f555d78628bEBa7752; - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579 - address public constant new_FeePool_contract = 0xc398406FFfBEd5B0680e706634490062CB1DB579; - // https://etherscan.io/address/0xDC01020857afbaE65224CfCeDb265d1216064c59 - address public constant new_Synthetix_contract = 0xDC01020857afbaE65224CfCeDb265d1216064c59; - // https://etherscan.io/address/0x9D5551Cd3425Dd4585c3E7Eb7E4B98902222521E - address public constant new_DebtCache_contract = 0x9D5551Cd3425Dd4585c3E7Eb7E4B98902222521E; - // https://etherscan.io/address/0x2A417C61B8062363e4ff50900779463b45d235f6 - address public constant new_Exchanger_contract = 0x2A417C61B8062363e4ff50900779463b45d235f6; - // https://etherscan.io/address/0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915 - address public constant new_Issuer_contract = 0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915; - // https://etherscan.io/address/0x0a6956d554485a43494D69Eca78C5103511a8fEb - address public constant new_WrapperFactory_contract = 0x0a6956d554485a43494D69Eca78C5103511a8fEb; - // https://etherscan.io/address/0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA - address public constant new_SynthsUSD_contract = 0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA; - // https://etherscan.io/address/0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0 - address public constant new_SynthsEUR_contract = 0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0; - // https://etherscan.io/address/0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A - address public constant new_SynthsJPY_contract = 0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A; - // https://etherscan.io/address/0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827 - address public constant new_SynthsAUD_contract = 0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827; - // https://etherscan.io/address/0xde3892383965FBa6eC434bE6350F85f140098708 - address public constant new_SynthsGBP_contract = 0xde3892383965FBa6eC434bE6350F85f140098708; - // https://etherscan.io/address/0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D - address public constant new_SynthsCHF_contract = 0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D; - // https://etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455 - address public constant new_SynthsKRW_contract = 0xe2f532c389deb5E42DCe53e78A9762949A885455; - // https://etherscan.io/address/0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353 - address public constant new_SynthsBTC_contract = 0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353; - // https://etherscan.io/address/0xc70B42930BD8D30A79B55415deC3be60827559f7 - address public constant new_SynthsETH_contract = 0xc70B42930BD8D30A79B55415deC3be60827559f7; - // https://etherscan.io/address/0x3FFE35c3d412150C3B91d3E22eBA60E16030C608 - address public constant new_SynthsLINK_contract = 0x3FFE35c3d412150C3B91d3E22eBA60E16030C608; - // https://etherscan.io/address/0x8f9fa817200F5B95f9572c8Acf2b31410C00335a - address public constant new_SynthsADA_contract = 0x8f9fa817200F5B95f9572c8Acf2b31410C00335a; - // https://etherscan.io/address/0x0705F0716b12a703d4F8832Ec7b97C61771f0361 - address public constant new_SynthsAAVE_contract = 0x0705F0716b12a703d4F8832Ec7b97C61771f0361; - // https://etherscan.io/address/0xfA60918C4417b64E722ca15d79C751c1f24Ab995 - address public constant new_SynthsDOT_contract = 0xfA60918C4417b64E722ca15d79C751c1f24Ab995; - // https://etherscan.io/address/0xe59dFC746D566EB40F92ed0B162004e24E3AC932 - address public constant new_SynthsDEFI_contract = 0xe59dFC746D566EB40F92ed0B162004e24E3AC932; - - function require_check() external { - require( - ISynthetixNamedContract(new_SystemSettings_contract).CONTRACT_NAME() == "SystemSettings", - "Invalid contract supplied for SystemSettings" - ); - require( - ISynthetixNamedContract(new_ExchangeRates_contract).CONTRACT_NAME() == "ExchangeRatesWithDexPricing", - "Invalid contract supplied for ExchangeRates" - ); - require( - ISynthetixNamedContract(new_FeePool_contract).CONTRACT_NAME() == "FeePool", - "Invalid contract supplied for FeePool" - ); - require( - ISynthetixNamedContract(new_Synthetix_contract).CONTRACT_NAME() == "Synthetix", - "Invalid contract supplied for Synthetix" - ); - require( - ISynthetixNamedContract(new_DebtCache_contract).CONTRACT_NAME() == "DebtCache", - "Invalid contract supplied for DebtCache" - ); - require( - ISynthetixNamedContract(new_Exchanger_contract).CONTRACT_NAME() == "ExchangerWithFeeRecAlternatives", - "Invalid contract supplied for Exchanger" - ); - require( - ISynthetixNamedContract(new_Issuer_contract).CONTRACT_NAME() == "Issuer", - "Invalid contract supplied for Issuer" - ); - require( - ISynthetixNamedContract(new_WrapperFactory_contract).CONTRACT_NAME() == "WrapperFactory", - "Invalid contract supplied for WrapperFactory" - ); - require( - ISynthetixNamedContract(new_SynthsUSD_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsUSD" - ); - require( - ISynthetixNamedContract(new_SynthsEUR_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsEUR" - ); - require( - ISynthetixNamedContract(new_SynthsJPY_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsJPY" - ); - require( - ISynthetixNamedContract(new_SynthsAUD_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsAUD" - ); - require( - ISynthetixNamedContract(new_SynthsGBP_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsGBP" - ); - require( - ISynthetixNamedContract(new_SynthsCHF_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsCHF" - ); - require( - ISynthetixNamedContract(new_SynthsKRW_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsKRW" - ); - require( - ISynthetixNamedContract(new_SynthsBTC_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsBTC" - ); - require( - ISynthetixNamedContract(new_SynthsETH_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsETH" - ); - require( - ISynthetixNamedContract(new_SynthsLINK_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsLINK" - ); - require( - ISynthetixNamedContract(new_SynthsADA_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsADA" - ); - require( - ISynthetixNamedContract(new_SynthsAAVE_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsAAVE" - ); - require( - ISynthetixNamedContract(new_SynthsDOT_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsDOT" - ); - require( - ISynthetixNamedContract(new_SynthsDEFI_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsDEFI" - ); - } - - function addressresolver_importAddresses_0() external { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](22); - addressresolver_importAddresses_names_0_0[0] = bytes32("SystemSettings"); - addressresolver_importAddresses_names_0_0[1] = bytes32("ExchangeRates"); - addressresolver_importAddresses_names_0_0[2] = bytes32("FeePool"); - addressresolver_importAddresses_names_0_0[3] = bytes32("Synthetix"); - addressresolver_importAddresses_names_0_0[4] = bytes32("DebtCache"); - addressresolver_importAddresses_names_0_0[5] = bytes32("Exchanger"); - addressresolver_importAddresses_names_0_0[6] = bytes32("Issuer"); - addressresolver_importAddresses_names_0_0[7] = bytes32("WrapperFactory"); - addressresolver_importAddresses_names_0_0[8] = bytes32("SynthsUSD"); - addressresolver_importAddresses_names_0_0[9] = bytes32("SynthsEUR"); - addressresolver_importAddresses_names_0_0[10] = bytes32("SynthsJPY"); - addressresolver_importAddresses_names_0_0[11] = bytes32("SynthsAUD"); - addressresolver_importAddresses_names_0_0[12] = bytes32("SynthsGBP"); - addressresolver_importAddresses_names_0_0[13] = bytes32("SynthsCHF"); - addressresolver_importAddresses_names_0_0[14] = bytes32("SynthsKRW"); - addressresolver_importAddresses_names_0_0[15] = bytes32("SynthsBTC"); - addressresolver_importAddresses_names_0_0[16] = bytes32("SynthsETH"); - addressresolver_importAddresses_names_0_0[17] = bytes32("SynthsLINK"); - addressresolver_importAddresses_names_0_0[18] = bytes32("SynthsADA"); - addressresolver_importAddresses_names_0_0[19] = bytes32("SynthsAAVE"); - addressresolver_importAddresses_names_0_0[20] = bytes32("SynthsDOT"); - addressresolver_importAddresses_names_0_0[21] = bytes32("SynthsDEFI"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](22); - addressresolver_importAddresses_destinations_0_1[0] = address(new_SystemSettings_contract); - addressresolver_importAddresses_destinations_0_1[1] = address(new_ExchangeRates_contract); - addressresolver_importAddresses_destinations_0_1[2] = address(new_FeePool_contract); - addressresolver_importAddresses_destinations_0_1[3] = address(new_Synthetix_contract); - addressresolver_importAddresses_destinations_0_1[4] = address(new_DebtCache_contract); - addressresolver_importAddresses_destinations_0_1[5] = address(new_Exchanger_contract); - addressresolver_importAddresses_destinations_0_1[6] = address(new_Issuer_contract); - addressresolver_importAddresses_destinations_0_1[7] = address(new_WrapperFactory_contract); - addressresolver_importAddresses_destinations_0_1[8] = address(new_SynthsUSD_contract); - addressresolver_importAddresses_destinations_0_1[9] = address(new_SynthsEUR_contract); - addressresolver_importAddresses_destinations_0_1[10] = address(new_SynthsJPY_contract); - addressresolver_importAddresses_destinations_0_1[11] = address(new_SynthsAUD_contract); - addressresolver_importAddresses_destinations_0_1[12] = address(new_SynthsGBP_contract); - addressresolver_importAddresses_destinations_0_1[13] = address(new_SynthsCHF_contract); - addressresolver_importAddresses_destinations_0_1[14] = address(new_SynthsKRW_contract); - addressresolver_importAddresses_destinations_0_1[15] = address(new_SynthsBTC_contract); - addressresolver_importAddresses_destinations_0_1[16] = address(new_SynthsETH_contract); - addressresolver_importAddresses_destinations_0_1[17] = address(new_SynthsLINK_contract); - addressresolver_importAddresses_destinations_0_1[18] = address(new_SynthsADA_contract); - addressresolver_importAddresses_destinations_0_1[19] = address(new_SynthsAAVE_contract); - addressresolver_importAddresses_destinations_0_1[20] = address(new_SynthsDOT_contract); - addressresolver_importAddresses_destinations_0_1[21] = address(new_SynthsDEFI_contract); - addressresolver_i.importAddresses( - addressresolver_importAddresses_names_0_0, - addressresolver_importAddresses_destinations_0_1 - ); - } - - function addressresolver_rebuildCaches_1() external { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(new_SystemSettings_contract); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0xAD95C918af576c82Df740878C3E983CBD175daB6); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(new_DebtCache_contract); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(new_Exchanger_contract); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(new_Issuer_contract); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0xC1AAE9d18bBe386B102435a8632C8063d31e747C); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0x067e398605E84F2D0aEEC1806e62768C5110DCc6); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0x5c8344bcdC38F1aB5EB5C1d4a35DdEeA522B5DfA); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0xaa03aB31b55DceEeF845C8d17890CC61cD98eD04); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0x1F2c3a1046c32729862fcB038369696e3273a516); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(new_ExchangeRates_contract); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(new_WrapperFactory_contract); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(new_SynthsUSD_contract); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(new_SynthsEUR_contract); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(new_SynthsJPY_contract); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(new_SynthsAUD_contract); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(new_SynthsGBP_contract); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(new_SynthsCHF_contract); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(new_SynthsKRW_contract); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } - - function addressresolver_rebuildCaches_2() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_2_0 = new MixinResolver[](13); - addressresolver_rebuildCaches_destinations_2_0[0] = MixinResolver(new_SynthsBTC_contract); - addressresolver_rebuildCaches_destinations_2_0[1] = MixinResolver(new_SynthsETH_contract); - addressresolver_rebuildCaches_destinations_2_0[2] = MixinResolver(new_SynthsLINK_contract); - addressresolver_rebuildCaches_destinations_2_0[3] = MixinResolver(new_SynthsADA_contract); - addressresolver_rebuildCaches_destinations_2_0[4] = MixinResolver(new_SynthsAAVE_contract); - addressresolver_rebuildCaches_destinations_2_0[5] = MixinResolver(new_SynthsDOT_contract); - addressresolver_rebuildCaches_destinations_2_0[6] = MixinResolver(new_SynthsDEFI_contract); - addressresolver_rebuildCaches_destinations_2_0[7] = MixinResolver(new_FeePool_contract); - addressresolver_rebuildCaches_destinations_2_0[8] = MixinResolver(0x62922670313bf6b41C580143d1f6C173C5C20019); - addressresolver_rebuildCaches_destinations_2_0[9] = MixinResolver(0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068); - addressresolver_rebuildCaches_destinations_2_0[10] = MixinResolver(new_Synthetix_contract); - addressresolver_rebuildCaches_destinations_2_0[11] = MixinResolver(0xe533139Af961c9747356D947838c98451015e234); - addressresolver_rebuildCaches_destinations_2_0[12] = MixinResolver(0x7A3d898b717e50a96fd8b232E9d15F0A547A7eeb); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_2_0); - } - - function importFeePeriod_0() external { - // https://etherscan.io/address/0x510adfDF6E7554C571b7Cd9305Ce91473610015e; - FeePool existingFeePool = FeePool(0x510adfDF6E7554C571b7Cd9305Ce91473610015e); - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579; - FeePool newFeePool = FeePool(0xc398406FFfBEd5B0680e706634490062CB1DB579); - ( - uint64 feePeriodId_0, - uint64 startingDebtIndex_0, - uint64 startTime_0, - uint feesToDistribute_0, - uint feesClaimed_0, - uint rewardsToDistribute_0, - uint rewardsClaimed_0 - ) = existingFeePool.recentFeePeriods(0); - newFeePool.importFeePeriod( - 0, - feePeriodId_0, - startingDebtIndex_0, - startTime_0, - feesToDistribute_0, - feesClaimed_0, - rewardsToDistribute_0, - rewardsClaimed_0 - ); - } - - function importFeePeriod_1() external { - // https://etherscan.io/address/0x510adfDF6E7554C571b7Cd9305Ce91473610015e; - FeePool existingFeePool = FeePool(0x510adfDF6E7554C571b7Cd9305Ce91473610015e); - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579; - FeePool newFeePool = FeePool(0xc398406FFfBEd5B0680e706634490062CB1DB579); - ( - uint64 feePeriodId_1, - uint64 startingDebtIndex_1, - uint64 startTime_1, - uint feesToDistribute_1, - uint feesClaimed_1, - uint rewardsToDistribute_1, - uint rewardsClaimed_1 - ) = existingFeePool.recentFeePeriods(1); - newFeePool.importFeePeriod( - 1, - feePeriodId_1, - startingDebtIndex_1, - startTime_1, - feesToDistribute_1, - feesClaimed_1, - rewardsToDistribute_1, - rewardsClaimed_1 - ); - } - - function copyTotalSupplyFrom_sUSD() external { - // https://etherscan.io/address/0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b; - Synth existingSynth = Synth(0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b); - // https://etherscan.io/address/0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA; - Synth newSynth = Synth(0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sEUR() external { - // https://etherscan.io/address/0xC61b352fCc311Ae6B0301459A970150005e74b3E; - Synth existingSynth = Synth(0xC61b352fCc311Ae6B0301459A970150005e74b3E); - // https://etherscan.io/address/0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0; - Synth newSynth = Synth(0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sJPY() external { - // https://etherscan.io/address/0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427; - Synth existingSynth = Synth(0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427); - // https://etherscan.io/address/0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A; - Synth newSynth = Synth(0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sAUD() external { - // https://etherscan.io/address/0x37B648a07476F4941D3D647f81118AFd55fa8a04; - Synth existingSynth = Synth(0x37B648a07476F4941D3D647f81118AFd55fa8a04); - // https://etherscan.io/address/0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827; - Synth newSynth = Synth(0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sGBP() external { - // https://etherscan.io/address/0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258; - Synth existingSynth = Synth(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258); - // https://etherscan.io/address/0xde3892383965FBa6eC434bE6350F85f140098708; - Synth newSynth = Synth(0xde3892383965FBa6eC434bE6350F85f140098708); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sCHF() external { - // https://etherscan.io/address/0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01; - Synth existingSynth = Synth(0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01); - // https://etherscan.io/address/0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D; - Synth newSynth = Synth(0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sKRW() external { - // https://etherscan.io/address/0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8; - Synth existingSynth = Synth(0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8); - // https://etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455; - Synth newSynth = Synth(0xe2f532c389deb5E42DCe53e78A9762949A885455); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sBTC() external { - // https://etherscan.io/address/0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9; - Synth existingSynth = Synth(0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9); - // https://etherscan.io/address/0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353; - Synth newSynth = Synth(0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sETH() external { - // https://etherscan.io/address/0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6; - Synth existingSynth = Synth(0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6); - // https://etherscan.io/address/0xc70B42930BD8D30A79B55415deC3be60827559f7; - Synth newSynth = Synth(0xc70B42930BD8D30A79B55415deC3be60827559f7); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sLINK() external { - // https://etherscan.io/address/0xcd980Fc5CcdAe62B18A52b83eC64200121A929db; - Synth existingSynth = Synth(0xcd980Fc5CcdAe62B18A52b83eC64200121A929db); - // https://etherscan.io/address/0x3FFE35c3d412150C3B91d3E22eBA60E16030C608; - Synth newSynth = Synth(0x3FFE35c3d412150C3B91d3E22eBA60E16030C608); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sADA() external { - // https://etherscan.io/address/0xC22e51FA362654ea453B4018B616ef6f6ab3b779; - Synth existingSynth = Synth(0xC22e51FA362654ea453B4018B616ef6f6ab3b779); - // https://etherscan.io/address/0x8f9fa817200F5B95f9572c8Acf2b31410C00335a; - Synth newSynth = Synth(0x8f9fa817200F5B95f9572c8Acf2b31410C00335a); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sAAVE() external { - // https://etherscan.io/address/0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270; - Synth existingSynth = Synth(0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270); - // https://etherscan.io/address/0x0705F0716b12a703d4F8832Ec7b97C61771f0361; - Synth newSynth = Synth(0x0705F0716b12a703d4F8832Ec7b97C61771f0361); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sDOT() external { - // https://etherscan.io/address/0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb; - Synth existingSynth = Synth(0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb); - // https://etherscan.io/address/0xfA60918C4417b64E722ca15d79C751c1f24Ab995; - Synth newSynth = Synth(0xfA60918C4417b64E722ca15d79C751c1f24Ab995); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sDEFI() external { - // https://etherscan.io/address/0x46A7Af405093B27DA6DeF193C508Bd9240A255FA; - Synth existingSynth = Synth(0x46A7Af405093B27DA6DeF193C508Bd9240A255FA); - // https://etherscan.io/address/0xe59dFC746D566EB40F92ed0B162004e24E3AC932; - Synth newSynth = Synth(0xe59dFC746D566EB40F92ed0B162004e24E3AC932); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function issuer_addSynths_105() external { - ISynth[] memory issuer_addSynths_synthsToAdd_105_0 = new ISynth[](14); - issuer_addSynths_synthsToAdd_105_0[0] = ISynth(new_SynthsUSD_contract); - issuer_addSynths_synthsToAdd_105_0[1] = ISynth(new_SynthsEUR_contract); - issuer_addSynths_synthsToAdd_105_0[2] = ISynth(new_SynthsJPY_contract); - issuer_addSynths_synthsToAdd_105_0[3] = ISynth(new_SynthsAUD_contract); - issuer_addSynths_synthsToAdd_105_0[4] = ISynth(new_SynthsGBP_contract); - issuer_addSynths_synthsToAdd_105_0[5] = ISynth(new_SynthsCHF_contract); - issuer_addSynths_synthsToAdd_105_0[6] = ISynth(new_SynthsKRW_contract); - issuer_addSynths_synthsToAdd_105_0[7] = ISynth(new_SynthsBTC_contract); - issuer_addSynths_synthsToAdd_105_0[8] = ISynth(new_SynthsETH_contract); - issuer_addSynths_synthsToAdd_105_0[9] = ISynth(new_SynthsLINK_contract); - issuer_addSynths_synthsToAdd_105_0[10] = ISynth(new_SynthsADA_contract); - issuer_addSynths_synthsToAdd_105_0[11] = ISynth(new_SynthsAAVE_contract); - issuer_addSynths_synthsToAdd_105_0[12] = ISynth(new_SynthsDOT_contract); - issuer_addSynths_synthsToAdd_105_0[13] = ISynth(new_SynthsDEFI_contract); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_105_0); - } -} - -// solhint-disable contract-name-camelcase -contract Migration_Alkaid is BaseMigration { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0xb440DD674e1243644791a4AdfE3A2AbB0A92d309 - Proxy public constant proxyfeepool_i = Proxy(0xb440DD674e1243644791a4AdfE3A2AbB0A92d309); - // https://etherscan.io/address/0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB - FeePoolEternalStorage public constant feepooleternalstorage_i = - FeePoolEternalStorage(0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB); - // https://etherscan.io/address/0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02 - FeePoolState public constant feepoolstate_i = FeePoolState(0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02); - // https://etherscan.io/address/0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F - Proxy public constant proxysynthetix_i = Proxy(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F); - // https://etherscan.io/address/0x545973f28950f50fc6c7F52AAb4Ad214A27C0564 - ExchangeState public constant exchangestate_i = ExchangeState(0x545973f28950f50fc6c7F52AAb4Ad214A27C0564); - // https://etherscan.io/address/0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E - SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E); - // https://etherscan.io/address/0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD - LegacyTokenState public constant tokenstatesynthetix_i = LegacyTokenState(0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD); - // https://etherscan.io/address/0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82 - SynthetixState public constant synthetixstate_i = SynthetixState(0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82); - // https://etherscan.io/address/0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F - RewardEscrow public constant rewardescrow_i = RewardEscrow(0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F); - // https://etherscan.io/address/0x29C295B046a73Cde593f21f63091B072d407e3F2 - RewardsDistribution public constant rewardsdistribution_i = - RewardsDistribution(0x29C295B046a73Cde593f21f63091B072d407e3F2); - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579 - FeePool public constant feepool_i = FeePool(0xc398406FFfBEd5B0680e706634490062CB1DB579); - // https://etherscan.io/address/0x6d9296Df2ad52F174bF671f555d78628bEBa7752 - ExchangeRatesWithDexPricing public constant exchangerates_i = - ExchangeRatesWithDexPricing(0x6d9296Df2ad52F174bF671f555d78628bEBa7752); - // https://etherscan.io/address/0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA - MultiCollateralSynth public constant synthsusd_i = MultiCollateralSynth(0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA); - // https://etherscan.io/address/0x05a9CBe762B36632b3594DA4F082340E0e5343e8 - TokenState public constant tokenstatesusd_i = TokenState(0x05a9CBe762B36632b3594DA4F082340E0e5343e8); - // https://etherscan.io/address/0x57Ab1ec28D129707052df4dF418D58a2D46d5f51 - Proxy public constant proxysusd_i = Proxy(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51); - // https://etherscan.io/address/0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0 - MultiCollateralSynth public constant synthseur_i = MultiCollateralSynth(0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0); - // https://etherscan.io/address/0x6568D9e750fC44AF00f857885Dfb8281c00529c4 - TokenState public constant tokenstateseur_i = TokenState(0x6568D9e750fC44AF00f857885Dfb8281c00529c4); - // https://etherscan.io/address/0xD71eCFF9342A5Ced620049e616c5035F1dB98620 - ProxyERC20 public constant proxyseur_i = ProxyERC20(0xD71eCFF9342A5Ced620049e616c5035F1dB98620); - // https://etherscan.io/address/0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A - MultiCollateralSynth public constant synthsjpy_i = MultiCollateralSynth(0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A); - // https://etherscan.io/address/0x4dFACfB15514C21c991ff75Bc7Bf6Fb1F98361ed - TokenState public constant tokenstatesjpy_i = TokenState(0x4dFACfB15514C21c991ff75Bc7Bf6Fb1F98361ed); - // https://etherscan.io/address/0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d - ProxyERC20 public constant proxysjpy_i = ProxyERC20(0xF6b1C627e95BFc3c1b4c9B825a032Ff0fBf3e07d); - // https://etherscan.io/address/0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827 - MultiCollateralSynth public constant synthsaud_i = MultiCollateralSynth(0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827); - // https://etherscan.io/address/0xCb29D2cf2C65d3Be1d00F07f3441390432D55203 - TokenState public constant tokenstatesaud_i = TokenState(0xCb29D2cf2C65d3Be1d00F07f3441390432D55203); - // https://etherscan.io/address/0xF48e200EAF9906362BB1442fca31e0835773b8B4 - ProxyERC20 public constant proxysaud_i = ProxyERC20(0xF48e200EAF9906362BB1442fca31e0835773b8B4); - // https://etherscan.io/address/0xde3892383965FBa6eC434bE6350F85f140098708 - MultiCollateralSynth public constant synthsgbp_i = MultiCollateralSynth(0xde3892383965FBa6eC434bE6350F85f140098708); - // https://etherscan.io/address/0x7e88D19A79b291cfE5696d496055f7e57F537A75 - TokenState public constant tokenstatesgbp_i = TokenState(0x7e88D19A79b291cfE5696d496055f7e57F537A75); - // https://etherscan.io/address/0x97fe22E7341a0Cd8Db6F6C021A24Dc8f4DAD855F - ProxyERC20 public constant proxysgbp_i = ProxyERC20(0x97fe22E7341a0Cd8Db6F6C021A24Dc8f4DAD855F); - // https://etherscan.io/address/0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D - MultiCollateralSynth public constant synthschf_i = MultiCollateralSynth(0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D); - // https://etherscan.io/address/0x52496fE8a4feaEFe14d9433E00D48E6929c13deC - TokenState public constant tokenstateschf_i = TokenState(0x52496fE8a4feaEFe14d9433E00D48E6929c13deC); - // https://etherscan.io/address/0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d - ProxyERC20 public constant proxyschf_i = ProxyERC20(0x0F83287FF768D1c1e17a42F44d644D7F22e8ee1d); - // https://etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455 - MultiCollateralSynth public constant synthskrw_i = MultiCollateralSynth(0xe2f532c389deb5E42DCe53e78A9762949A885455); - // https://etherscan.io/address/0x93B6e9FbBd2c32a0DC3C2B943B7C3CBC2fE23730 - TokenState public constant tokenstateskrw_i = TokenState(0x93B6e9FbBd2c32a0DC3C2B943B7C3CBC2fE23730); - // https://etherscan.io/address/0x269895a3dF4D73b077Fc823dD6dA1B95f72Aaf9B - ProxyERC20 public constant proxyskrw_i = ProxyERC20(0x269895a3dF4D73b077Fc823dD6dA1B95f72Aaf9B); - // https://etherscan.io/address/0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353 - MultiCollateralSynth public constant synthsbtc_i = MultiCollateralSynth(0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353); - // https://etherscan.io/address/0x4F6296455F8d754c19821cF1EC8FeBF2cD456E67 - TokenState public constant tokenstatesbtc_i = TokenState(0x4F6296455F8d754c19821cF1EC8FeBF2cD456E67); - // https://etherscan.io/address/0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6 - ProxyERC20 public constant proxysbtc_i = ProxyERC20(0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6); - // https://etherscan.io/address/0xc70B42930BD8D30A79B55415deC3be60827559f7 - MultiCollateralSynth public constant synthseth_i = MultiCollateralSynth(0xc70B42930BD8D30A79B55415deC3be60827559f7); - // https://etherscan.io/address/0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c - TokenState public constant tokenstateseth_i = TokenState(0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c); - // https://etherscan.io/address/0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb - ProxyERC20 public constant proxyseth_i = ProxyERC20(0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb); - // https://etherscan.io/address/0x3FFE35c3d412150C3B91d3E22eBA60E16030C608 - MultiCollateralSynth public constant synthslink_i = MultiCollateralSynth(0x3FFE35c3d412150C3B91d3E22eBA60E16030C608); - // https://etherscan.io/address/0x577D4a7395c6A5f46d9981a5F83fa7294926aBB0 - TokenState public constant tokenstateslink_i = TokenState(0x577D4a7395c6A5f46d9981a5F83fa7294926aBB0); - // https://etherscan.io/address/0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6 - ProxyERC20 public constant proxyslink_i = ProxyERC20(0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6); - // https://etherscan.io/address/0x8f9fa817200F5B95f9572c8Acf2b31410C00335a - MultiCollateralSynth public constant synthsada_i = MultiCollateralSynth(0x8f9fa817200F5B95f9572c8Acf2b31410C00335a); - // https://etherscan.io/address/0x9956c5019a24fbd5B506AD070b771577bAc5c343 - TokenState public constant tokenstatesada_i = TokenState(0x9956c5019a24fbd5B506AD070b771577bAc5c343); - // https://etherscan.io/address/0xe36E2D3c7c34281FA3bC737950a68571736880A1 - ProxyERC20 public constant proxysada_i = ProxyERC20(0xe36E2D3c7c34281FA3bC737950a68571736880A1); - // https://etherscan.io/address/0x0705F0716b12a703d4F8832Ec7b97C61771f0361 - MultiCollateralSynth public constant synthsaave_i = MultiCollateralSynth(0x0705F0716b12a703d4F8832Ec7b97C61771f0361); - // https://etherscan.io/address/0x9BcED8A8E3Ad81c9b146FFC880358f734A06f7c0 - TokenState public constant tokenstatesaave_i = TokenState(0x9BcED8A8E3Ad81c9b146FFC880358f734A06f7c0); - // https://etherscan.io/address/0xd2dF355C19471c8bd7D8A3aa27Ff4e26A21b4076 - ProxyERC20 public constant proxysaave_i = ProxyERC20(0xd2dF355C19471c8bd7D8A3aa27Ff4e26A21b4076); - // https://etherscan.io/address/0xfA60918C4417b64E722ca15d79C751c1f24Ab995 - MultiCollateralSynth public constant synthsdot_i = MultiCollateralSynth(0xfA60918C4417b64E722ca15d79C751c1f24Ab995); - // https://etherscan.io/address/0x73B1a2643507Cd30F11Dfcf2D974f4373E5BC077 - TokenState public constant tokenstatesdot_i = TokenState(0x73B1a2643507Cd30F11Dfcf2D974f4373E5BC077); - // https://etherscan.io/address/0x1715AC0743102BF5Cd58EfBB6Cf2dC2685d967b6 - ProxyERC20 public constant proxysdot_i = ProxyERC20(0x1715AC0743102BF5Cd58EfBB6Cf2dC2685d967b6); - // https://etherscan.io/address/0xe59dFC746D566EB40F92ed0B162004e24E3AC932 - MultiCollateralSynth public constant synthsdefi_i = MultiCollateralSynth(0xe59dFC746D566EB40F92ed0B162004e24E3AC932); - // https://etherscan.io/address/0x7Ac2D37098a65B0f711CFfA3be635F1E6aCacFaB - TokenState public constant tokenstatesdefi_i = TokenState(0x7Ac2D37098a65B0f711CFfA3be635F1E6aCacFaB); - // https://etherscan.io/address/0xe1aFe1Fd76Fd88f78cBf599ea1846231B8bA3B6B - ProxyERC20 public constant proxysdefi_i = ProxyERC20(0xe1aFe1Fd76Fd88f78cBf599ea1846231B8bA3B6B); - // https://etherscan.io/address/0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915 - Issuer public constant issuer_i = Issuer(0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915); - // https://etherscan.io/address/0xb6B476C41Ea01930e6abE1f44b96800de0404c98 - SystemSettings public constant systemsettings_i = SystemSettings(0xb6B476C41Ea01930e6abE1f44b96800de0404c98); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://etherscan.io/address/0xb6B476C41Ea01930e6abE1f44b96800de0404c98 - address public constant new_SystemSettings_contract = 0xb6B476C41Ea01930e6abE1f44b96800de0404c98; - // https://etherscan.io/address/0x6d9296Df2ad52F174bF671f555d78628bEBa7752 - address public constant new_ExchangeRates_contract = 0x6d9296Df2ad52F174bF671f555d78628bEBa7752; - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579 - address public constant new_FeePool_contract = 0xc398406FFfBEd5B0680e706634490062CB1DB579; - // https://etherscan.io/address/0xDC01020857afbaE65224CfCeDb265d1216064c59 - address public constant new_Synthetix_contract = 0xDC01020857afbaE65224CfCeDb265d1216064c59; - // https://etherscan.io/address/0x9D5551Cd3425Dd4585c3E7Eb7E4B98902222521E - address public constant new_DebtCache_contract = 0x9D5551Cd3425Dd4585c3E7Eb7E4B98902222521E; - // https://etherscan.io/address/0x2A417C61B8062363e4ff50900779463b45d235f6 - address public constant new_Exchanger_contract = 0x2A417C61B8062363e4ff50900779463b45d235f6; - // https://etherscan.io/address/0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915 - address public constant new_Issuer_contract = 0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915; - // https://etherscan.io/address/0x0a6956d554485a43494D69Eca78C5103511a8fEb - address public constant new_WrapperFactory_contract = 0x0a6956d554485a43494D69Eca78C5103511a8fEb; - // https://etherscan.io/address/0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA - address public constant new_SynthsUSD_contract = 0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA; - // https://etherscan.io/address/0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0 - address public constant new_SynthsEUR_contract = 0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0; - // https://etherscan.io/address/0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A - address public constant new_SynthsJPY_contract = 0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A; - // https://etherscan.io/address/0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827 - address public constant new_SynthsAUD_contract = 0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827; - // https://etherscan.io/address/0xde3892383965FBa6eC434bE6350F85f140098708 - address public constant new_SynthsGBP_contract = 0xde3892383965FBa6eC434bE6350F85f140098708; - // https://etherscan.io/address/0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D - address public constant new_SynthsCHF_contract = 0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D; - // https://etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455 - address public constant new_SynthsKRW_contract = 0xe2f532c389deb5E42DCe53e78A9762949A885455; - // https://etherscan.io/address/0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353 - address public constant new_SynthsBTC_contract = 0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353; - // https://etherscan.io/address/0xc70B42930BD8D30A79B55415deC3be60827559f7 - address public constant new_SynthsETH_contract = 0xc70B42930BD8D30A79B55415deC3be60827559f7; - // https://etherscan.io/address/0x3FFE35c3d412150C3B91d3E22eBA60E16030C608 - address public constant new_SynthsLINK_contract = 0x3FFE35c3d412150C3B91d3E22eBA60E16030C608; - // https://etherscan.io/address/0x8f9fa817200F5B95f9572c8Acf2b31410C00335a - address public constant new_SynthsADA_contract = 0x8f9fa817200F5B95f9572c8Acf2b31410C00335a; - // https://etherscan.io/address/0x0705F0716b12a703d4F8832Ec7b97C61771f0361 - address public constant new_SynthsAAVE_contract = 0x0705F0716b12a703d4F8832Ec7b97C61771f0361; - // https://etherscan.io/address/0xfA60918C4417b64E722ca15d79C751c1f24Ab995 - address public constant new_SynthsDOT_contract = 0xfA60918C4417b64E722ca15d79C751c1f24Ab995; - // https://etherscan.io/address/0xe59dFC746D566EB40F92ed0B162004e24E3AC932 - address public constant new_SynthsDEFI_contract = 0xe59dFC746D566EB40F92ed0B162004e24E3AC932; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](57); - contracts[0] = address(addressresolver_i); - contracts[1] = address(proxyfeepool_i); - contracts[2] = address(feepooleternalstorage_i); - contracts[3] = address(feepoolstate_i); - contracts[4] = address(proxysynthetix_i); - contracts[5] = address(exchangestate_i); - contracts[6] = address(systemstatus_i); - contracts[7] = address(tokenstatesynthetix_i); - contracts[8] = address(synthetixstate_i); - contracts[9] = address(rewardescrow_i); - contracts[10] = address(rewardsdistribution_i); - contracts[11] = address(feepool_i); - contracts[12] = address(exchangerates_i); - contracts[13] = address(synthsusd_i); - contracts[14] = address(tokenstatesusd_i); - contracts[15] = address(proxysusd_i); - contracts[16] = address(synthseur_i); - contracts[17] = address(tokenstateseur_i); - contracts[18] = address(proxyseur_i); - contracts[19] = address(synthsjpy_i); - contracts[20] = address(tokenstatesjpy_i); - contracts[21] = address(proxysjpy_i); - contracts[22] = address(synthsaud_i); - contracts[23] = address(tokenstatesaud_i); - contracts[24] = address(proxysaud_i); - contracts[25] = address(synthsgbp_i); - contracts[26] = address(tokenstatesgbp_i); - contracts[27] = address(proxysgbp_i); - contracts[28] = address(synthschf_i); - contracts[29] = address(tokenstateschf_i); - contracts[30] = address(proxyschf_i); - contracts[31] = address(synthskrw_i); - contracts[32] = address(tokenstateskrw_i); - contracts[33] = address(proxyskrw_i); - contracts[34] = address(synthsbtc_i); - contracts[35] = address(tokenstatesbtc_i); - contracts[36] = address(proxysbtc_i); - contracts[37] = address(synthseth_i); - contracts[38] = address(tokenstateseth_i); - contracts[39] = address(proxyseth_i); - contracts[40] = address(synthslink_i); - contracts[41] = address(tokenstateslink_i); - contracts[42] = address(proxyslink_i); - contracts[43] = address(synthsada_i); - contracts[44] = address(tokenstatesada_i); - contracts[45] = address(proxysada_i); - contracts[46] = address(synthsaave_i); - contracts[47] = address(tokenstatesaave_i); - contracts[48] = address(proxysaave_i); - contracts[49] = address(synthsdot_i); - contracts[50] = address(tokenstatesdot_i); - contracts[51] = address(proxysdot_i); - contracts[52] = address(synthsdefi_i); - contracts[53] = address(tokenstatesdefi_i); - contracts[54] = address(proxysdefi_i); - contracts[55] = address(issuer_i); - contracts[56] = address(systemsettings_i); - } - - function migrate(address currentOwner) external onlyDeployer { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - Migration_Alkaid_Supplemental.require_check(); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - Migration_Alkaid_Supplemental.addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - Migration_Alkaid_Supplemental.addressresolver_rebuildCaches_1(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 2; - Migration_Alkaid_Supplemental.addressresolver_rebuildCaches_2(); - // Ensure the ProxyFeePool contract has the correct FeePool target set; - proxyfeepool_i.setTarget(Proxyable(new_FeePool_contract)); - // Ensure the FeePool contract can write to its EternalStorage; - feepooleternalstorage_i.setAssociatedContract(new_FeePool_contract); - // Ensure the FeePool contract can write to its State; - feepoolstate_i.setFeePool(IFeePool(new_FeePool_contract)); - // Ensure the SNX proxy has the correct Synthetix target set; - proxysynthetix_i.setTarget(Proxyable(new_Synthetix_contract)); - // Ensure the Exchanger contract can write to its State; - exchangestate_i.setAssociatedContract(new_Exchanger_contract); - // Ensure the Exchanger contract can suspend synths - see SIP-65; - systemstatus_i.updateAccessControl("Synth", new_Exchanger_contract, true, false); - // Ensure the Synthetix contract can write to its TokenState contract; - tokenstatesynthetix_i.setAssociatedContract(new_Synthetix_contract); - // Ensure that Synthetix can write to its State contract; - synthetixstate_i.setAssociatedContract(new_Issuer_contract); - // Ensure the legacy RewardEscrow contract is connected to the Synthetix contract; - rewardescrow_i.setSynthetix(ISynthetix(new_Synthetix_contract)); - // Ensure the legacy RewardEscrow contract is connected to the FeePool contract; - rewardescrow_i.setFeePool(IFeePool(new_FeePool_contract)); - // Ensure the RewardsDistribution has Synthetix set as its authority for distribution; - rewardsdistribution_i.setAuthority(new_Synthetix_contract); - // Import fee period from existing fee pool at index 0; - Migration_Alkaid_Supplemental.importFeePeriod_0(); - // Import fee period from existing fee pool at index 1; - Migration_Alkaid_Supplemental.importFeePeriod_1(); - // Ensure the ExchangeRates contract has the standalone feed for SNX; - exchangerates_i.addAggregator("SNX", 0xDC3EA94CD0AC27d9A86C180091e7f78C683d3699); - // Ensure the ExchangeRates contract has the standalone feed for ETH; - exchangerates_i.addAggregator("ETH", 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); - // Ensure the ExchangeRates contract has the standalone feed for sXTZ (see SCCP-139); - exchangerates_i.addAggregator("sXTZ", 0x5239a625dEb44bF3EeAc2CD5366ba24b8e9DB63F); - // Ensure the ExchangeRates contract has the standalone feed for sRUNE (see SCCP-139); - exchangerates_i.addAggregator("sRUNE", 0x48731cF7e84dc94C5f84577882c14Be11a5B7456); - // Ensure the ExchangeRates contract has the standalone feed for sYFI (see SCCP-139); - exchangerates_i.addAggregator("sYFI", 0xA027702dbb89fbd58938e4324ac03B58d812b0E1); - // Ensure the ExchangeRates contract has the standalone feed for sCRV (see SCCP-139); - exchangerates_i.addAggregator("sCRV", 0xCd627aA160A6fA45Eb793D19Ef54f5062F20f33f); - // Ensure the ExchangeRates contract has the standalone feed for sUNI (see SCCP-139); - exchangerates_i.addAggregator("sUNI", 0x553303d460EE0afB37EdFf9bE42922D8FF63220e); - // Ensure the ExchangeRates contract has the standalone feed for sXRP (see SCCP-139); - exchangerates_i.addAggregator("sXRP", 0xCed2660c6Dd1Ffd856A5A82C67f3482d88C50b12); - // Ensure the ExchangeRates contract has the standalone feed for sBNB (see SCCP-139); - exchangerates_i.addAggregator("sBNB", 0x14e613AC84a31f709eadbdF89C6CC390fDc9540A); - // Ensure the ExchangeRates contract has the standalone feed for sXAU (see SCCP-139); - exchangerates_i.addAggregator("sXAU", 0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sUSD(); - // Ensure the sUSD synth can write to its TokenState; - tokenstatesusd_i.setAssociatedContract(new_SynthsUSD_contract); - // Ensure the sUSD synth Proxy is correctly connected to the Synth; - proxysusd_i.setTarget(Proxyable(new_SynthsUSD_contract)); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sEUR(); - // Ensure the sEUR synth can write to its TokenState; - tokenstateseur_i.setAssociatedContract(new_SynthsEUR_contract); - // Ensure the sEUR synth Proxy is correctly connected to the Synth; - proxyseur_i.setTarget(Proxyable(new_SynthsEUR_contract)); - // Ensure the ExchangeRates contract has the feed for sEUR; - exchangerates_i.addAggregator("sEUR", 0xb49f677943BC038e9857d61E7d053CaA2C1734C1); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sJPY(); - // Ensure the sJPY synth can write to its TokenState; - tokenstatesjpy_i.setAssociatedContract(new_SynthsJPY_contract); - // Ensure the sJPY synth Proxy is correctly connected to the Synth; - proxysjpy_i.setTarget(Proxyable(new_SynthsJPY_contract)); - // Ensure the ExchangeRates contract has the feed for sJPY; - exchangerates_i.addAggregator("sJPY", 0xBcE206caE7f0ec07b545EddE332A47C2F75bbeb3); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sAUD(); - // Ensure the sAUD synth can write to its TokenState; - tokenstatesaud_i.setAssociatedContract(new_SynthsAUD_contract); - // Ensure the sAUD synth Proxy is correctly connected to the Synth; - proxysaud_i.setTarget(Proxyable(new_SynthsAUD_contract)); - // Ensure the ExchangeRates contract has the feed for sAUD; - exchangerates_i.addAggregator("sAUD", 0x77F9710E7d0A19669A13c055F62cd80d313dF022); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sGBP(); - // Ensure the sGBP synth can write to its TokenState; - tokenstatesgbp_i.setAssociatedContract(new_SynthsGBP_contract); - // Ensure the sGBP synth Proxy is correctly connected to the Synth; - proxysgbp_i.setTarget(Proxyable(new_SynthsGBP_contract)); - // Ensure the ExchangeRates contract has the feed for sGBP; - exchangerates_i.addAggregator("sGBP", 0x5c0Ab2d9b5a7ed9f470386e82BB36A3613cDd4b5); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sCHF(); - // Ensure the sCHF synth can write to its TokenState; - tokenstateschf_i.setAssociatedContract(new_SynthsCHF_contract); - // Ensure the sCHF synth Proxy is correctly connected to the Synth; - proxyschf_i.setTarget(Proxyable(new_SynthsCHF_contract)); - // Ensure the ExchangeRates contract has the feed for sCHF; - exchangerates_i.addAggregator("sCHF", 0x449d117117838fFA61263B61dA6301AA2a88B13A); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sKRW(); - // Ensure the sKRW synth can write to its TokenState; - tokenstateskrw_i.setAssociatedContract(new_SynthsKRW_contract); - // Ensure the sKRW synth Proxy is correctly connected to the Synth; - proxyskrw_i.setTarget(Proxyable(new_SynthsKRW_contract)); - // Ensure the ExchangeRates contract has the feed for sKRW; - exchangerates_i.addAggregator("sKRW", 0x01435677FB11763550905594A16B645847C1d0F3); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sBTC(); - // Ensure the sBTC synth can write to its TokenState; - tokenstatesbtc_i.setAssociatedContract(new_SynthsBTC_contract); - // Ensure the sBTC synth Proxy is correctly connected to the Synth; - proxysbtc_i.setTarget(Proxyable(new_SynthsBTC_contract)); - // Ensure the ExchangeRates contract has the feed for sBTC; - exchangerates_i.addAggregator("sBTC", 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sETH(); - // Ensure the sETH synth can write to its TokenState; - tokenstateseth_i.setAssociatedContract(new_SynthsETH_contract); - // Ensure the sETH synth Proxy is correctly connected to the Synth; - proxyseth_i.setTarget(Proxyable(new_SynthsETH_contract)); - // Ensure the ExchangeRates contract has the feed for sETH; - exchangerates_i.addAggregator("sETH", 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sLINK(); - // Ensure the sLINK synth can write to its TokenState; - tokenstateslink_i.setAssociatedContract(new_SynthsLINK_contract); - // Ensure the sLINK synth Proxy is correctly connected to the Synth; - proxyslink_i.setTarget(Proxyable(new_SynthsLINK_contract)); - // Ensure the ExchangeRates contract has the feed for sLINK; - exchangerates_i.addAggregator("sLINK", 0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sADA(); - // Ensure the sADA synth can write to its TokenState; - tokenstatesada_i.setAssociatedContract(new_SynthsADA_contract); - // Ensure the sADA synth Proxy is correctly connected to the Synth; - proxysada_i.setTarget(Proxyable(new_SynthsADA_contract)); - // Ensure the ExchangeRates contract has the feed for sADA; - exchangerates_i.addAggregator("sADA", 0xAE48c91dF1fE419994FFDa27da09D5aC69c30f55); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sAAVE(); - // Ensure the sAAVE synth can write to its TokenState; - tokenstatesaave_i.setAssociatedContract(new_SynthsAAVE_contract); - // Ensure the sAAVE synth Proxy is correctly connected to the Synth; - proxysaave_i.setTarget(Proxyable(new_SynthsAAVE_contract)); - // Ensure the ExchangeRates contract has the feed for sAAVE; - exchangerates_i.addAggregator("sAAVE", 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sDOT(); - // Ensure the sDOT synth can write to its TokenState; - tokenstatesdot_i.setAssociatedContract(new_SynthsDOT_contract); - // Ensure the sDOT synth Proxy is correctly connected to the Synth; - proxysdot_i.setTarget(Proxyable(new_SynthsDOT_contract)); - // Ensure the ExchangeRates contract has the feed for sDOT; - exchangerates_i.addAggregator("sDOT", 0x1C07AFb8E2B827c5A4739C6d59Ae3A5035f28734); - // Ensure the new synth has the totalSupply from the previous one; - Migration_Alkaid_Supplemental.copyTotalSupplyFrom_sDEFI(); - // Ensure the sDEFI synth can write to its TokenState; - tokenstatesdefi_i.setAssociatedContract(new_SynthsDEFI_contract); - // Ensure the sDEFI synth Proxy is correctly connected to the Synth; - proxysdefi_i.setTarget(Proxyable(new_SynthsDEFI_contract)); - // Ensure the ExchangeRates contract has the feed for sDEFI; - exchangerates_i.addAggregator("sDEFI", 0xa8E875F94138B0C5b51d1e1d5dE35bbDdd28EA87); - // Add synths to the Issuer contract - batch 1; - Migration_Alkaid_Supplemental.issuer_addSynths_105(); - // SIP-120 Set max atomic volume per block (in USD amounts); - systemsettings_i.setAtomicMaxVolumePerBlock(200000000000000000000000); - // SIP-120 Set the TWAP window for atomic swaps; - systemsettings_i.setAtomicTwapWindow(1800); - // SIP-120 Set the equivalent token - used in uniswap pools - corresponding to this synth; - systemsettings_i.setAtomicEquivalentForDexPricing("sUSD", 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); - // SIP-120 Set the equivalent token - used in uniswap pools - corresponding to this synth; - systemsettings_i.setAtomicEquivalentForDexPricing("sETH", 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); - // SIP-120 Set the equivalent token - used in uniswap pools - corresponding to this synth; - systemsettings_i.setAtomicEquivalentForDexPricing("sBTC", 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); - // SIP-120 Set the exchange fee rate for swapping atomically into this synth; - systemsettings_i.setAtomicExchangeFeeRate("sETH", 3000000000000000); - // SIP-120 Set the exchange fee rate for swapping atomically into this synth; - systemsettings_i.setAtomicExchangeFeeRate("sBTC", 3000000000000000); - // SIP-120 Set the exchange fee rate for swapping atomically into this synth; - systemsettings_i.setAtomicExchangeFeeRate("sUSD", 3000000000000000); - // SIP-120 Set the price buffer applied to the base chainlink rate when comparing atomically; - systemsettings_i.setAtomicPriceBuffer("sETH", 1500000000000000); - // SIP-120 Set the price buffer applied to the base chainlink rate when comparing atomically; - systemsettings_i.setAtomicPriceBuffer("sBTC", 1500000000000000); - // SIP-120 Set the atomic volatility window for this synth (in seconds); - systemsettings_i.setAtomicVolatilityConsiderationWindow("sETH", 600); - // SIP-120 Set the atomic volatility window for this synth (in seconds); - systemsettings_i.setAtomicVolatilityConsiderationWindow("sBTC", 600); - // SIP-120 Set the atomic volatility count for this synth during the volatility window; - systemsettings_i.setAtomicVolatilityUpdateThreshold("sETH", 3); - // SIP-120 Set the atomic volatility count for this synth during the volatility window; - systemsettings_i.setAtomicVolatilityUpdateThreshold("sBTC", 3); - // SIP-120 Set the DEX price aggregator (uniswap TWAP oracle reader); - exchangerates_i.setDexPriceAggregator(IDexPriceAggregator(0xf120F029Ac143633d1942e48aE2Dfa2036C5786c)); - // Ensure the CollateralShort contract has an interaction delay of zero on the OVM; - systemsettings_i.setInteractionDelay(0x1F2c3a1046c32729862fcB038369696e3273a516, 3600); - // Ensure the CollateralShort contract has its service fee set for collapsing loans (SIP-135); - systemsettings_i.setCollapseFeeRate(0x1F2c3a1046c32729862fcB038369696e3273a516, 0); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } -} diff --git a/contracts/migrations/Migration_Alnitak.sol b/contracts/migrations/Migration_Alnitak.sol deleted file mode 100644 index b294285eab..0000000000 --- a/contracts/migrations/Migration_Alnitak.sol +++ /dev/null @@ -1,211 +0,0 @@ -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../ProxyERC20.sol"; -import "../Proxy.sol"; -import "../ExchangeState.sol"; -import "../SystemStatus.sol"; -import "../legacy/LegacyTokenState.sol"; -import "../RewardEscrow.sol"; -import "../RewardsDistribution.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_Alnitak is BaseMigration { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F - ProxyERC20 public constant proxyerc20_i = ProxyERC20(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F); - // https://etherscan.io/address/0xC011A72400E58ecD99Ee497CF89E3775d4bd732F - Proxy public constant proxysynthetix_i = Proxy(0xC011A72400E58ecD99Ee497CF89E3775d4bd732F); - // https://etherscan.io/address/0x545973f28950f50fc6c7F52AAb4Ad214A27C0564 - ExchangeState public constant exchangestate_i = ExchangeState(0x545973f28950f50fc6c7F52AAb4Ad214A27C0564); - // https://etherscan.io/address/0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E - SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E); - // https://etherscan.io/address/0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD - LegacyTokenState public constant tokenstatesynthetix_i = LegacyTokenState(0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD); - // https://etherscan.io/address/0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F - RewardEscrow public constant rewardescrow_i = RewardEscrow(0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F); - // https://etherscan.io/address/0x29C295B046a73Cde593f21f63091B072d407e3F2 - RewardsDistribution public constant rewardsdistribution_i = - RewardsDistribution(0x29C295B046a73Cde593f21f63091B072d407e3F2); - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() external pure returns (address[] memory contracts) { - contracts = new address[](8); - contracts[0] = address(addressresolver_i); - contracts[1] = address(proxyerc20_i); - contracts[2] = address(proxysynthetix_i); - contracts[3] = address(exchangestate_i); - contracts[4] = address(systemstatus_i); - contracts[5] = address(tokenstatesynthetix_i); - contracts[6] = address(rewardescrow_i); - contracts[7] = address(rewardsdistribution_i); - } - - function migrate(address currentOwner) external onlyDeployer { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - // NEW CONTRACTS DEPLOYED TO BE ADDED TO PROTOCOL - // https://etherscan.io/address/0x43AE8037179a5746D618DA077A38DdeEa9640cBa - address new_Synthetix_contract = 0x43AE8037179a5746D618DA077A38DdeEa9640cBa; - // https://etherscan.io/address/0x613c773c7a1D85D2F1DCC051B0573D33470762Eb - address new_Exchanger_contract = 0x613c773c7a1D85D2F1DCC051B0573D33470762Eb; - - require( - ISynthetixNamedContract(new_Synthetix_contract).CONTRACT_NAME() == "Synthetix", - "Invalid contract supplied for Synthetix" - ); - require( - ISynthetixNamedContract(new_Exchanger_contract).CONTRACT_NAME() == "Exchanger", - "Invalid contract supplied for Exchanger" - ); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - addressresolver_i.acceptOwnership(); - proxyerc20_i.acceptOwnership(); - proxysynthetix_i.acceptOwnership(); - exchangestate_i.acceptOwnership(); - systemstatus_i.acceptOwnership(); - tokenstatesynthetix_i.acceptOwnership(); - rewardescrow_i.acceptOwnership(); - rewardsdistribution_i.acceptOwnership(); - - // MIGRATION - // Import all new contracts into the address resolver; - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](2); - addressresolver_importAddresses_names_0_0[0] = bytes32("Synthetix"); - addressresolver_importAddresses_names_0_0[1] = bytes32("Exchanger"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](2); - addressresolver_importAddresses_destinations_0_1[0] = address(new_Synthetix_contract); - addressresolver_importAddresses_destinations_0_1[1] = address(new_Exchanger_contract); - addressresolver_i.importAddresses( - addressresolver_importAddresses_names_0_0, - addressresolver_importAddresses_destinations_0_1 - ); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0xAD95C918af576c82Df740878C3E983CBD175daB6); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(0xcf9E60005C9aca983caf65d3669a24fDd0775fc0); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(new_Exchanger_contract); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0xB774711F0BC1306ce892ef8C02D0476dCccB46B7); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0x62922670313bf6b41C580143d1f6C173C5C20019); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0xd69b189020EF614796578AfE4d10378c5e7e1138); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(new_Synthetix_contract); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0x9bB05EF2cA7DBAafFC3da1939D1492e6b00F39b8); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(0x4D8dBD193d89b7B506BE5dC9Db75B91dA00D6a1d); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(0xC61b352fCc311Ae6B0301459A970150005e74b3E); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(0x37B648a07476F4941D3D647f81118AFd55fa8a04); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(0x5eDf7dd83fE2889D264fa9D3b93d0a6e6A45D6C6); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(0x9745606DA6e162866DAD7bF80f2AbF145EDD7571); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(0x2962EA4E749e54b10CFA557770D597027BA67cB3); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - // Rebuild the resolver caches in all MixinResolver contracts - batch 2; - MixinResolver[] memory addressresolver_rebuildCaches_destinations_2_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_2_0[0] = MixinResolver(0xDB91E4B3b6E19bF22E810C43273eae48C9037e74); - addressresolver_rebuildCaches_destinations_2_0[1] = MixinResolver(0xab4e760fEEe20C5c2509061b995e06b542D3112B); - addressresolver_rebuildCaches_destinations_2_0[2] = MixinResolver(0xda3c83750b1FA31Fda838136ef3f853b41cb7a5a); - addressresolver_rebuildCaches_destinations_2_0[3] = MixinResolver(0x47bD14817d7684082E04934878EE2Dd3576Ae19d); - addressresolver_rebuildCaches_destinations_2_0[4] = MixinResolver(0x6F927644d55E32318629198081923894FbFe5c07); - addressresolver_rebuildCaches_destinations_2_0[5] = MixinResolver(0xe3D5E1c1bA874C0fF3BA31b999967F24d5ca04e5); - addressresolver_rebuildCaches_destinations_2_0[6] = MixinResolver(0xA962208CDC8588F9238fae169d0F63306c353F4F); - addressresolver_rebuildCaches_destinations_2_0[7] = MixinResolver(0xcd980Fc5CcdAe62B18A52b83eC64200121A929db); - addressresolver_rebuildCaches_destinations_2_0[8] = MixinResolver(0xAf090d6E583C082f2011908cf95c2518BE7A53ac); - addressresolver_rebuildCaches_destinations_2_0[9] = MixinResolver(0x21ee4afBd6c151fD9A69c1389598170B1d45E0e3); - addressresolver_rebuildCaches_destinations_2_0[10] = MixinResolver(0xcb6Cb218D558ae7fF6415f95BDA6616FCFF669Cb); - addressresolver_rebuildCaches_destinations_2_0[11] = MixinResolver(0x7B29C9e188De18563B19d162374ce6836F31415a); - addressresolver_rebuildCaches_destinations_2_0[12] = MixinResolver(0xC22e51FA362654ea453B4018B616ef6f6ab3b779); - addressresolver_rebuildCaches_destinations_2_0[13] = MixinResolver(0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270); - addressresolver_rebuildCaches_destinations_2_0[14] = MixinResolver(0xAa1b12E3e5F70aBCcd1714F4260A74ca21e7B17b); - addressresolver_rebuildCaches_destinations_2_0[15] = MixinResolver(0x0F393ce493d8FB0b83915248a21a3104932ed97c); - addressresolver_rebuildCaches_destinations_2_0[16] = MixinResolver(0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb); - addressresolver_rebuildCaches_destinations_2_0[17] = MixinResolver(0x4287dac1cC7434991119Eba7413189A66fFE65cF); - addressresolver_rebuildCaches_destinations_2_0[18] = MixinResolver(0x34c76BC146b759E58886e821D62548AC1e0BA7Bc); - addressresolver_rebuildCaches_destinations_2_0[19] = MixinResolver(0x0E8Fa2339314AB7E164818F26207897bBe29C3af); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_2_0); - // Rebuild the resolver caches in all MixinResolver contracts - batch 3; - MixinResolver[] memory addressresolver_rebuildCaches_destinations_3_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_3_0[0] = MixinResolver(0xe615Df79AC987193561f37E77465bEC2aEfe9aDb); - addressresolver_rebuildCaches_destinations_3_0[1] = MixinResolver(0x3E2dA260B4A85782A629320EB027A3B7c28eA9f1); - addressresolver_rebuildCaches_destinations_3_0[2] = MixinResolver(0xc02DD182Ce029E6d7f78F37492DFd39E4FEB1f8b); - addressresolver_rebuildCaches_destinations_3_0[3] = MixinResolver(0x0d1c4e5C07B071aa4E6A14A604D4F6478cAAC7B4); - addressresolver_rebuildCaches_destinations_3_0[4] = MixinResolver(0x13D0F5B8630520eA04f694F17A001fb95eaFD30E); - addressresolver_rebuildCaches_destinations_3_0[5] = MixinResolver(0x815CeF3b7773f35428B4353073B086ecB658f73C); - addressresolver_rebuildCaches_destinations_3_0[6] = MixinResolver(0xb0e0BA880775B7F2ba813b3800b3979d719F0379); - addressresolver_rebuildCaches_destinations_3_0[7] = MixinResolver(0x8e082925e78538955bC0e2F363FC5d1Ab3be739b); - addressresolver_rebuildCaches_destinations_3_0[8] = MixinResolver(0x399BA516a6d68d6Ad4D5f3999902D0DeAcaACDdd); - addressresolver_rebuildCaches_destinations_3_0[9] = MixinResolver(0x9530FA32a3059114AC20A5812870Da12D97d1174); - addressresolver_rebuildCaches_destinations_3_0[10] = MixinResolver(0x249612F641111022f2f48769f3Df5D85cb3E26a2); - addressresolver_rebuildCaches_destinations_3_0[11] = MixinResolver(0x04720DbBD4599aD26811545595d97fB813E84964); - addressresolver_rebuildCaches_destinations_3_0[12] = MixinResolver(0x2acfe6265D358d982cB1c3B521199973CD443C71); - addressresolver_rebuildCaches_destinations_3_0[13] = MixinResolver(0x46A7Af405093B27DA6DeF193C508Bd9240A255FA); - addressresolver_rebuildCaches_destinations_3_0[14] = MixinResolver(0x8350d1b2d6EF5289179fe49E5b0F208165B4e32e); - addressresolver_rebuildCaches_destinations_3_0[15] = MixinResolver(0x29DD4A59F4D339226867e77aF211724eaBb45c02); - addressresolver_rebuildCaches_destinations_3_0[16] = MixinResolver(0xf7B8dF8b16dA302d85603B8e7F95111a768458Cc); - addressresolver_rebuildCaches_destinations_3_0[17] = MixinResolver(0x0517A56da8A517e3b2D484Cc5F1Da4BDCfE68ec3); - addressresolver_rebuildCaches_destinations_3_0[18] = MixinResolver(0x099CfAd1640fc7EA686ab1D83F0A285Ba0470882); - addressresolver_rebuildCaches_destinations_3_0[19] = MixinResolver(0x19cC1f63e344D74A87D955E3F3E95B28DDDc61d8); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_3_0); - // Rebuild the resolver caches in all MixinResolver contracts - batch 4; - MixinResolver[] memory addressresolver_rebuildCaches_destinations_4_0 = new MixinResolver[](19); - addressresolver_rebuildCaches_destinations_4_0[0] = MixinResolver(0x4D50A0e5f068ACdC80A1da2dd1f0Ad48845df2F8); - addressresolver_rebuildCaches_destinations_4_0[1] = MixinResolver(0xb73c665825dAa926D6ef09417FbE5654473c1b49); - addressresolver_rebuildCaches_destinations_4_0[2] = MixinResolver(0x806A599d60B2FdBda379D5890287D2fba1026cC0); - addressresolver_rebuildCaches_destinations_4_0[3] = MixinResolver(0xCea42504874586a718954746A564B72bc7eba3E3); - addressresolver_rebuildCaches_destinations_4_0[4] = MixinResolver(0x947d5656725fB9A8f9c826A91b6082b07E2745B7); - addressresolver_rebuildCaches_destinations_4_0[5] = MixinResolver(0x186E56A62E7caCE1308f1A1B0dbb27f33F80f16f); - addressresolver_rebuildCaches_destinations_4_0[6] = MixinResolver(0x931c5516EE121a177bD2B60e0122Da5B27630ABc); - addressresolver_rebuildCaches_destinations_4_0[7] = MixinResolver(0x6Dc6a64724399524184C2c44a526A2cff1BaA507); - addressresolver_rebuildCaches_destinations_4_0[8] = MixinResolver(0x87eb6e935e3C7E3E3A0E31a5658498bC87dE646E); - addressresolver_rebuildCaches_destinations_4_0[9] = MixinResolver(0x53869BDa4b8d85aEDCC9C6cAcf015AF9447Cade7); - addressresolver_rebuildCaches_destinations_4_0[10] = MixinResolver(0x1cB27Ac646afAE192dF9928A2808C0f7f586Af7d); - addressresolver_rebuildCaches_destinations_4_0[11] = MixinResolver(0x3dD7b893c25025CabFBd290A5E06BaFF3DE335b8); - addressresolver_rebuildCaches_destinations_4_0[12] = MixinResolver(0x1A4505543C92084bE57ED80113eaB7241171e7a8); - addressresolver_rebuildCaches_destinations_4_0[13] = MixinResolver(0xF6ce55E09De0F9F97210aAf6DB88Ed6b6792Ca1f); - addressresolver_rebuildCaches_destinations_4_0[14] = MixinResolver(0xacAAB69C2BA65A2DB415605F309007e18D4F5E8C); - addressresolver_rebuildCaches_destinations_4_0[15] = MixinResolver(0x9A5Ea0D8786B8d17a70410A905Aed1443fae5A38); - addressresolver_rebuildCaches_destinations_4_0[16] = MixinResolver(0x5c8344bcdC38F1aB5EB5C1d4a35DdEeA522B5DfA); - addressresolver_rebuildCaches_destinations_4_0[17] = MixinResolver(0xaa03aB31b55DceEeF845C8d17890CC61cD98eD04); - addressresolver_rebuildCaches_destinations_4_0[18] = MixinResolver(0x1F2c3a1046c32729862fcB038369696e3273a516); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_4_0); - // Ensure the SNX proxy has the correct Synthetix target set; - proxyerc20_i.setTarget(Proxyable(new_Synthetix_contract)); - // Ensure the legacy SNX proxy has the correct Synthetix target set; - proxysynthetix_i.setTarget(Proxyable(new_Synthetix_contract)); - // Ensure the Exchanger contract can write to its State; - exchangestate_i.setAssociatedContract(new_Exchanger_contract); - // Ensure the Exchanger contract can suspend synths - see SIP-65; - systemstatus_i.updateAccessControl("Synth", new_Exchanger_contract, true, false); - // Ensure the Synthetix contract can write to its TokenState contract; - tokenstatesynthetix_i.setAssociatedContract(new_Synthetix_contract); - // Ensure the legacy RewardEscrow contract is connected to the Synthetix contract; - rewardescrow_i.setSynthetix(ISynthetix(new_Synthetix_contract)); - // Ensure the RewardsDistribution has Synthetix set as its authority for distribution; - rewardsdistribution_i.setAuthority(new_Synthetix_contract); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - addressresolver_i.nominateNewOwner(owner); - proxyerc20_i.nominateNewOwner(owner); - proxysynthetix_i.nominateNewOwner(owner); - exchangestate_i.nominateNewOwner(owner); - systemstatus_i.nominateNewOwner(owner); - tokenstatesynthetix_i.nominateOwner(owner); - rewardescrow_i.nominateNewOwner(owner); - rewardsdistribution_i.nominateNewOwner(owner); - } -} diff --git a/contracts/migrations/Migration_Alsephina.sol b/contracts/migrations/Migration_Alsephina.sol deleted file mode 100644 index 2cf06c94c1..0000000000 --- a/contracts/migrations/Migration_Alsephina.sol +++ /dev/null @@ -1,205 +0,0 @@ -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../ExchangeState.sol"; -import "../SystemStatus.sol"; -import "../ExchangeRatesWithDexPricing.sol"; -import "../SystemSettings.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_Alsephina is BaseMigration { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0x545973f28950f50fc6c7F52AAb4Ad214A27C0564 - ExchangeState public constant exchangestate_i = ExchangeState(0x545973f28950f50fc6c7F52AAb4Ad214A27C0564); - // https://etherscan.io/address/0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E - SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E); - // https://etherscan.io/address/0xF68ECd50de7733015318361295547D8E939F93E6 - ExchangeRatesWithDexPricing public constant exchangerates_i = - ExchangeRatesWithDexPricing(0xF68ECd50de7733015318361295547D8E939F93E6); - // https://etherscan.io/address/0x80d65Bb7b9436A86c1928F93D6E7cc186987Ac54 - SystemSettings public constant systemsettings_i = SystemSettings(0x80d65Bb7b9436A86c1928F93D6E7cc186987Ac54); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://etherscan.io/address/0xa62F71D599Ec6179B4f6569adD69ffC7E1A7a1c5 - address public constant new_SystemSettingsLib_contract = 0xa62F71D599Ec6179B4f6569adD69ffC7E1A7a1c5; - // https://etherscan.io/address/0x80d65Bb7b9436A86c1928F93D6E7cc186987Ac54 - address public constant new_SystemSettings_contract = 0x80d65Bb7b9436A86c1928F93D6E7cc186987Ac54; - // https://etherscan.io/address/0xF68ECd50de7733015318361295547D8E939F93E6 - address public constant new_ExchangeRates_contract = 0xF68ECd50de7733015318361295547D8E939F93E6; - // https://etherscan.io/address/0x3e343E89F4fF8057806F54F2208940B1Cd5C40ca - address public constant new_Exchanger_contract = 0x3e343E89F4fF8057806F54F2208940B1Cd5C40ca; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](5); - contracts[0] = address(addressresolver_i); - contracts[1] = address(exchangestate_i); - contracts[2] = address(systemstatus_i); - contracts[3] = address(exchangerates_i); - contracts[4] = address(systemsettings_i); - } - - function migrate(address currentOwner) external onlyOwner { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - require( - ISynthetixNamedContract(new_SystemSettings_contract).CONTRACT_NAME() == "SystemSettings", - "Invalid contract supplied for SystemSettings" - ); - require( - ISynthetixNamedContract(new_ExchangeRates_contract).CONTRACT_NAME() == "ExchangeRatesWithDexPricing", - "Invalid contract supplied for ExchangeRates" - ); - require( - ISynthetixNamedContract(new_Exchanger_contract).CONTRACT_NAME() == "ExchangerWithFeeRecAlternatives", - "Invalid contract supplied for Exchanger" - ); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - addressresolver_rebuildCaches_1(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 2; - addressresolver_rebuildCaches_2(); - // Ensure the Exchanger contract can write to its State; - exchangestate_i.setAssociatedContract(new_Exchanger_contract); - // Ensure the Exchanger contract can suspend synths - see SIP-65; - systemstatus_i.updateAccessControl("Synth", new_Exchanger_contract, true, false); - // Ensure the ExchangeRates contract has the standalone feed for SNX; - exchangerates_i.addAggregator("SNX", 0xDC3EA94CD0AC27d9A86C180091e7f78C683d3699); - // Ensure the ExchangeRates contract has the standalone feed for ETH; - exchangerates_i.addAggregator("ETH", 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); - // Ensure the ExchangeRates contract has the feed for sEUR; - exchangerates_i.addAggregator("sEUR", 0xb49f677943BC038e9857d61E7d053CaA2C1734C1); - // Ensure the ExchangeRates contract has the feed for sJPY; - exchangerates_i.addAggregator("sJPY", 0xBcE206caE7f0ec07b545EddE332A47C2F75bbeb3); - // Ensure the ExchangeRates contract has the feed for sAUD; - exchangerates_i.addAggregator("sAUD", 0x77F9710E7d0A19669A13c055F62cd80d313dF022); - // Ensure the ExchangeRates contract has the feed for sGBP; - exchangerates_i.addAggregator("sGBP", 0x5c0Ab2d9b5a7ed9f470386e82BB36A3613cDd4b5); - // Ensure the ExchangeRates contract has the feed for sCHF; - exchangerates_i.addAggregator("sCHF", 0x449d117117838fFA61263B61dA6301AA2a88B13A); - // Ensure the ExchangeRates contract has the feed for sKRW; - exchangerates_i.addAggregator("sKRW", 0x01435677FB11763550905594A16B645847C1d0F3); - // Ensure the ExchangeRates contract has the feed for sBTC; - exchangerates_i.addAggregator("sBTC", 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c); - // Ensure the ExchangeRates contract has the feed for sETH; - exchangerates_i.addAggregator("sETH", 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); - // Ensure the ExchangeRates contract has the feed for sLINK; - exchangerates_i.addAggregator("sLINK", 0x2c1d072e956AFFC0D435Cb7AC38EF18d24d9127c); - // Ensure the ExchangeRates contract has the feed for sADA; - exchangerates_i.addAggregator("sADA", 0xAE48c91dF1fE419994FFDa27da09D5aC69c30f55); - // Ensure the ExchangeRates contract has the feed for sAAVE; - exchangerates_i.addAggregator("sAAVE", 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9); - // Ensure the ExchangeRates contract has the feed for sDOT; - exchangerates_i.addAggregator("sDOT", 0x1C07AFb8E2B827c5A4739C6d59Ae3A5035f28734); - // Ensure the ExchangeRates contract has the feed for sETHBTC; - exchangerates_i.addAggregator("sETHBTC", 0xAc559F25B1619171CbC396a50854A3240b6A4e99); - // Ensure the ExchangeRates contract has the feed for sDEFI; - exchangerates_i.addAggregator("sDEFI", 0xa8E875F94138B0C5b51d1e1d5dE35bbDdd28EA87); - // Set exchange dynamic fee threshold (SIP-184); - systemsettings_i.setExchangeDynamicFeeThreshold(4000000000000000); - // Set exchange dynamic fee weight decay (SIP-184); - systemsettings_i.setExchangeDynamicFeeWeightDecay(900000000000000000); - // Set exchange dynamic fee rounds (SIP-184); - systemsettings_i.setExchangeDynamicFeeRounds(0); - // Set exchange max dynamic fee (SIP-184); - systemsettings_i.setExchangeMaxDynamicFee(50000000000000000); - // SIP-120 Set the DEX price aggregator (uniswap TWAP oracle reader); - exchangerates_i.setDexPriceAggregator(IDexPriceAggregator(0xf120F029Ac143633d1942e48aE2Dfa2036C5786c)); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } - - function addressresolver_importAddresses_0() internal { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](3); - addressresolver_importAddresses_names_0_0[0] = bytes32("SystemSettings"); - addressresolver_importAddresses_names_0_0[1] = bytes32("ExchangeRates"); - addressresolver_importAddresses_names_0_0[2] = bytes32("Exchanger"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](3); - addressresolver_importAddresses_destinations_0_1[0] = address(new_SystemSettings_contract); - addressresolver_importAddresses_destinations_0_1[1] = address(new_ExchangeRates_contract); - addressresolver_importAddresses_destinations_0_1[2] = address(new_Exchanger_contract); - addressresolver_i.importAddresses( - addressresolver_importAddresses_names_0_0, - addressresolver_importAddresses_destinations_0_1 - ); - } - - function addressresolver_rebuildCaches_1() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(new_SystemSettings_contract); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0xAD95C918af576c82Df740878C3E983CBD175daB6); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(0x9D5551Cd3425Dd4585c3E7Eb7E4B98902222521E); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(new_Exchanger_contract); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0xC1AAE9d18bBe386B102435a8632C8063d31e747C); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0x067e398605E84F2D0aEEC1806e62768C5110DCc6); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0x5c8344bcdC38F1aB5EB5C1d4a35DdEeA522B5DfA); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0xaa03aB31b55DceEeF845C8d17890CC61cD98eD04); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0x1F2c3a1046c32729862fcB038369696e3273a516); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(0x7C22547779c8aa41bAE79E03E8383a0BefBCecf0); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(new_ExchangeRates_contract); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(0xDC01020857afbaE65224CfCeDb265d1216064c59); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(0x62922670313bf6b41C580143d1f6C173C5C20019); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(0xde3892383965FBa6eC434bE6350F85f140098708); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } - - function addressresolver_rebuildCaches_2() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_2_0 = new MixinResolver[](10); - addressresolver_rebuildCaches_destinations_2_0[0] = MixinResolver(0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D); - addressresolver_rebuildCaches_destinations_2_0[1] = MixinResolver(0xe2f532c389deb5E42DCe53e78A9762949A885455); - addressresolver_rebuildCaches_destinations_2_0[2] = MixinResolver(0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353); - addressresolver_rebuildCaches_destinations_2_0[3] = MixinResolver(0xc70B42930BD8D30A79B55415deC3be60827559f7); - addressresolver_rebuildCaches_destinations_2_0[4] = MixinResolver(0x3FFE35c3d412150C3B91d3E22eBA60E16030C608); - addressresolver_rebuildCaches_destinations_2_0[5] = MixinResolver(0x8f9fa817200F5B95f9572c8Acf2b31410C00335a); - addressresolver_rebuildCaches_destinations_2_0[6] = MixinResolver(0x0705F0716b12a703d4F8832Ec7b97C61771f0361); - addressresolver_rebuildCaches_destinations_2_0[7] = MixinResolver(0xfA60918C4417b64E722ca15d79C751c1f24Ab995); - addressresolver_rebuildCaches_destinations_2_0[8] = MixinResolver(0xcc3aab773e2171b2E257Ee17001400eE378aa52B); - addressresolver_rebuildCaches_destinations_2_0[9] = MixinResolver(0xe59dFC746D566EB40F92ed0B162004e24E3AC932); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_2_0); - } -} diff --git a/contracts/migrations/Migration_AlsephinaOptimism.sol b/contracts/migrations/Migration_AlsephinaOptimism.sol deleted file mode 100644 index 03b7db1277..0000000000 --- a/contracts/migrations/Migration_AlsephinaOptimism.sol +++ /dev/null @@ -1,152 +0,0 @@ - -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../ExchangeState.sol"; -import "../SystemStatus.sol"; -import "../ExchangeRates.sol"; -import "../SystemSettings.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_AlsephinaOptimism is BaseMigration { - // https://explorer.optimism.io/address/0x6d4a64C57612841c2C6745dB2a4E4db34F002D20; - address public constant OWNER = 0x6d4a64C57612841c2C6745dB2a4E4db34F002D20; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://explorer.optimism.io/address/0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C - AddressResolver public constant addressresolver_i = AddressResolver(0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C); - // https://explorer.optimism.io/address/0x7EF87c14f50CFFe2e73d2C87916C3128c56593A8 - ExchangeState public constant exchangestate_i = ExchangeState(0x7EF87c14f50CFFe2e73d2C87916C3128c56593A8); - // https://explorer.optimism.io/address/0xf83c5f65dBef4017CD19Ae99b15E1B8649AdbEb4 - SystemStatus public constant systemstatus_i = SystemStatus(0xf83c5f65dBef4017CD19Ae99b15E1B8649AdbEb4); - // https://explorer.optimism.io/address/0xB4437efD22B4CCe7E25B3c47A469BC719cBdB60c - ExchangeRates public constant exchangerates_i = ExchangeRates(0xB4437efD22B4CCe7E25B3c47A469BC719cBdB60c); - // https://explorer.optimism.io/address/0x28224ef515d01709916F5ac4D8a72664A7b56e98 - SystemSettings public constant systemsettings_i = SystemSettings(0x28224ef515d01709916F5ac4D8a72664A7b56e98); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://explorer.optimism.io/address/0xB4437efD22B4CCe7E25B3c47A469BC719cBdB60c - address public constant new_ExchangeRates_contract = 0xB4437efD22B4CCe7E25B3c47A469BC719cBdB60c; - // https://explorer.optimism.io/address/0x28224ef515d01709916F5ac4D8a72664A7b56e98 - address public constant new_SystemSettings_contract = 0x28224ef515d01709916F5ac4D8a72664A7b56e98; - // https://explorer.optimism.io/address/0x11Ac553488b2170A9ad751A5455d0C9A134C982f - address public constant new_Exchanger_contract = 0x11Ac553488b2170A9ad751A5455d0C9A134C982f; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](5); - contracts[0]= address(addressresolver_i); - contracts[1]= address(exchangestate_i); - contracts[2]= address(systemstatus_i); - contracts[3]= address(exchangerates_i); - contracts[4]= address(systemsettings_i); - } - - function migrate(address currentOwner) external onlyOwner { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - require(ISynthetixNamedContract(new_ExchangeRates_contract).CONTRACT_NAME() == "ExchangeRates", "Invalid contract supplied for ExchangeRates"); - require(ISynthetixNamedContract(new_SystemSettings_contract).CONTRACT_NAME() == "SystemSettings", "Invalid contract supplied for SystemSettings"); - require(ISynthetixNamedContract(new_Exchanger_contract).CONTRACT_NAME() == "Exchanger", "Invalid contract supplied for Exchanger"); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - addressresolver_rebuildCaches_1(); - // Ensure the Exchanger contract can write to its State; - exchangestate_i.setAssociatedContract(new_Exchanger_contract); - // Ensure the Exchanger contract can suspend synths - see SIP-65; - systemstatus_i.updateAccessControl("Synth", new_Exchanger_contract, true, false); - // Ensure the ExchangeRates contract has the standalone feed for SNX; - exchangerates_i.addAggregator("SNX", 0x588e1f339910c21c7E4864048E37017AafF4cBc6); - // Ensure the ExchangeRates contract has the standalone feed for ETH; - exchangerates_i.addAggregator("ETH", 0xA969bEB73d918f6100163Cd0fba3C586C269bee1); - // Ensure the ExchangeRates contract has the feed for sETH; - exchangerates_i.addAggregator("sETH", 0xA969bEB73d918f6100163Cd0fba3C586C269bee1); - // Ensure the ExchangeRates contract has the feed for sBTC; - exchangerates_i.addAggregator("sBTC", 0xc326371d4D866C6Ff522E69298e36Fe75797D358); - // Ensure the ExchangeRates contract has the feed for sLINK; - exchangerates_i.addAggregator("sLINK", 0x74d6B50283AC1D651f9Afdc33521e4c1E3332b78); - // Set exchange dynamic fee threshold (SIP-184); - systemsettings_i.setExchangeDynamicFeeThreshold(4000000000000000); - // Set exchange dynamic fee weight decay (SIP-184); - systemsettings_i.setExchangeDynamicFeeWeightDecay(900000000000000000); - // Set exchange dynamic fee rounds (SIP-184); - systemsettings_i.setExchangeDynamicFeeRounds(10); - // Set exchange max dynamic fee (SIP-184); - systemsettings_i.setExchangeMaxDynamicFee(50000000000000000); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } - - - function addressresolver_importAddresses_0() internal { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](3); - addressresolver_importAddresses_names_0_0[0] = bytes32("ExchangeRates"); - addressresolver_importAddresses_names_0_0[1] = bytes32("SystemSettings"); - addressresolver_importAddresses_names_0_0[2] = bytes32("Exchanger"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](3); - addressresolver_importAddresses_destinations_0_1[0] = address(new_ExchangeRates_contract); - addressresolver_importAddresses_destinations_0_1[1] = address(new_SystemSettings_contract); - addressresolver_importAddresses_destinations_0_1[2] = address(new_Exchanger_contract); - addressresolver_i.importAddresses(addressresolver_importAddresses_names_0_0, addressresolver_importAddresses_destinations_0_1); - } - - - function addressresolver_rebuildCaches_1() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0x14E6f8e6Da00a32C069b11b64e48EA1FEF2361D4); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0x01f8C5e421172B67cc14B7f5F369cfb10de0acD4); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(new_Exchanger_contract); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(0xA2412e0654CdD40F5677Aaad1a0c572e75dF246C); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0xD21969A86Ce5c41aAb2D492a0F802AA3e015cd9A); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0x15E7D4972a3E477878A5867A47617122BE2d1fF0); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0x308AD16ef90fe7caCb85B784A603CB6E71b1A41a); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0xEbCe9728E2fDdC26C9f4B00df5180BdC5e184953); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0x6202A3B0bE1D222971E93AaB084c6E584C29DB70); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0xad32aA4Bff8b61B4aE07E3BA437CF81100AF0cD7); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(0x8A91e92FDd86e734781c38DB52a390e1B99fba7c); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(new_ExchangeRates_contract); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(new_SystemSettings_contract); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(0xFDf3Be612c65464AEB4859047350a6220F304F52); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(0x20eBfbdD14c9D8093E9AC33e736Ac61bbaC90092); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(0x2DcAD1A019fba8301b77810Ae14007cc88ED004B); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(0x78aAA3fb165deCAA729DFE3cf0E97Ab6FCF484da); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(0xBD2657CF89F930F27eE1854EF4B389773DF43b29); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(0x8Ce809a955DB85b41e7A378D7659e348e0C6AdD2); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(0xF33e7B48538C9D0480a48f3b5eEf79026e2a28f6); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } -} diff --git a/contracts/migrations/Migration_Kaus.sol b/contracts/migrations/Migration_Kaus.sol deleted file mode 100644 index 9e9e18b842..0000000000 --- a/contracts/migrations/Migration_Kaus.sol +++ /dev/null @@ -1,166 +0,0 @@ -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../SynthetixState.sol"; -import "../Issuer.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_Kaus is BaseMigration { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82 - SynthetixState public constant synthetixstate_i = SynthetixState(0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82); - // https://etherscan.io/address/0xF67998902EBc37d885ad310C2430C822Ca981E1E - Issuer public constant issuer_i = Issuer(0xF67998902EBc37d885ad310C2430C822Ca981E1E); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://etherscan.io/address/0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F - address public constant new_ProxySynthetix_contract = 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F; - // https://etherscan.io/address/0x08118E04F58d7863b4fCF1de0e07c83a2541b89e - address public constant new_DebtCache_contract = 0x08118E04F58d7863b4fCF1de0e07c83a2541b89e; - // https://etherscan.io/address/0xF67998902EBc37d885ad310C2430C822Ca981E1E - address public constant new_Issuer_contract = 0xF67998902EBc37d885ad310C2430C822Ca981E1E; - // https://etherscan.io/address/0x57Ab1ec28D129707052df4dF418D58a2D46d5f51 - address public constant new_ProxysUSD_contract = 0x57Ab1ec28D129707052df4dF418D58a2D46d5f51; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](3); - contracts[0] = address(addressresolver_i); - contracts[1] = address(synthetixstate_i); - contracts[2] = address(issuer_i); - } - - function migrate(address currentOwner) external onlyDeployer { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - require( - ISynthetixNamedContract(new_DebtCache_contract).CONTRACT_NAME() == "DebtCache", - "Invalid contract supplied for DebtCache" - ); - require( - ISynthetixNamedContract(new_Issuer_contract).CONTRACT_NAME() == "Issuer", - "Invalid contract supplied for Issuer" - ); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - addressresolver_rebuildCaches_1(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 2; - addressresolver_rebuildCaches_2(); - // Ensure that Synthetix can write to its State contract; - synthetixstate_i.setAssociatedContract(new_Issuer_contract); - // Add synths to the Issuer contract - batch 1; - issuer_addSynths_6(); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } - - function addressresolver_importAddresses_0() internal { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](4); - addressresolver_importAddresses_names_0_0[0] = bytes32("ProxySynthetix"); - addressresolver_importAddresses_names_0_0[1] = bytes32("DebtCache"); - addressresolver_importAddresses_names_0_0[2] = bytes32("Issuer"); - addressresolver_importAddresses_names_0_0[3] = bytes32("ProxysUSD"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](4); - addressresolver_importAddresses_destinations_0_1[0] = address(new_ProxySynthetix_contract); - addressresolver_importAddresses_destinations_0_1[1] = address(new_DebtCache_contract); - addressresolver_importAddresses_destinations_0_1[2] = address(new_Issuer_contract); - addressresolver_importAddresses_destinations_0_1[3] = address(new_ProxysUSD_contract); - addressresolver_i.importAddresses( - addressresolver_importAddresses_names_0_0, - addressresolver_importAddresses_destinations_0_1 - ); - } - - function addressresolver_rebuildCaches_1() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0x7634F2A1741a683ccda37Dce864c187F990D7B4b); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(new_Issuer_contract); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(0xAD95C918af576c82Df740878C3E983CBD175daB6); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0x510adfDF6E7554C571b7Cd9305Ce91473610015e); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0x54f25546260C7539088982bcF4b7dC8EDEF19f21); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(new_DebtCache_contract); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0xe533139Af961c9747356D947838c98451015e234); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(0xC61b352fCc311Ae6B0301459A970150005e74b3E); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(0x37B648a07476F4941D3D647f81118AFd55fa8a04); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(0xcd980Fc5CcdAe62B18A52b83eC64200121A929db); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(0xC22e51FA362654ea453B4018B616ef6f6ab3b779); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } - - function addressresolver_rebuildCaches_2() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_2_0 = new MixinResolver[](5); - addressresolver_rebuildCaches_destinations_2_0[0] = MixinResolver(0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270); - addressresolver_rebuildCaches_destinations_2_0[1] = MixinResolver(0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb); - addressresolver_rebuildCaches_destinations_2_0[2] = MixinResolver(0x46A7Af405093B27DA6DeF193C508Bd9240A255FA); - addressresolver_rebuildCaches_destinations_2_0[3] = MixinResolver(0xC1AAE9d18bBe386B102435a8632C8063d31e747C); - addressresolver_rebuildCaches_destinations_2_0[4] = MixinResolver(0x067e398605E84F2D0aEEC1806e62768C5110DCc6); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_2_0); - } - - function issuer_addSynths_6() internal { - ISynth[] memory issuer_addSynths_synthsToAdd_6_0 = new ISynth[](14); - issuer_addSynths_synthsToAdd_6_0[0] = ISynth(0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b); - issuer_addSynths_synthsToAdd_6_0[1] = ISynth(0xC61b352fCc311Ae6B0301459A970150005e74b3E); - issuer_addSynths_synthsToAdd_6_0[2] = ISynth(0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427); - issuer_addSynths_synthsToAdd_6_0[3] = ISynth(0x37B648a07476F4941D3D647f81118AFd55fa8a04); - issuer_addSynths_synthsToAdd_6_0[4] = ISynth(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258); - issuer_addSynths_synthsToAdd_6_0[5] = ISynth(0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01); - issuer_addSynths_synthsToAdd_6_0[6] = ISynth(0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8); - issuer_addSynths_synthsToAdd_6_0[7] = ISynth(0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9); - issuer_addSynths_synthsToAdd_6_0[8] = ISynth(0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6); - issuer_addSynths_synthsToAdd_6_0[9] = ISynth(0xcd980Fc5CcdAe62B18A52b83eC64200121A929db); - issuer_addSynths_synthsToAdd_6_0[10] = ISynth(0xC22e51FA362654ea453B4018B616ef6f6ab3b779); - issuer_addSynths_synthsToAdd_6_0[11] = ISynth(0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270); - issuer_addSynths_synthsToAdd_6_0[12] = ISynth(0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb); - issuer_addSynths_synthsToAdd_6_0[13] = ISynth(0x46A7Af405093B27DA6DeF193C508Bd9240A255FA); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_6_0); - } -} diff --git a/contracts/migrations/Migration_Mirfak.sol b/contracts/migrations/Migration_Mirfak.sol deleted file mode 100644 index ebe4d86ed7..0000000000 --- a/contracts/migrations/Migration_Mirfak.sol +++ /dev/null @@ -1,581 +0,0 @@ -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../Proxy.sol"; -import "../FeePoolEternalStorage.sol"; -import "../FeePoolState.sol"; -import "../ProxyERC20.sol"; -import "../Proxy.sol"; -import "../ExchangeState.sol"; -import "../SystemStatus.sol"; -import "../legacy/LegacyTokenState.sol"; -import "../SynthetixState.sol"; -import "../RewardEscrow.sol"; -import "../RewardsDistribution.sol"; -import "../FeePool.sol"; -import "../MultiCollateralSynth.sol"; -import "../TokenState.sol"; -import "../Proxy.sol"; -import "../ProxyERC20.sol"; -import "../MultiCollateralSynth.sol"; -import "../TokenState.sol"; -import "../ProxyERC20.sol"; -import "../MultiCollateralSynth.sol"; -import "../TokenState.sol"; -import "../ProxyERC20.sol"; -import "../Issuer.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_Mirfak is BaseMigration { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0xb440DD674e1243644791a4AdfE3A2AbB0A92d309 - Proxy public constant proxyfeepool_i = Proxy(0xb440DD674e1243644791a4AdfE3A2AbB0A92d309); - // https://etherscan.io/address/0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB - FeePoolEternalStorage public constant feepooleternalstorage_i = - FeePoolEternalStorage(0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB); - // https://etherscan.io/address/0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02 - FeePoolState public constant feepoolstate_i = FeePoolState(0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02); - // https://etherscan.io/address/0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F - ProxyERC20 public constant proxyerc20_i = ProxyERC20(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F); - // https://etherscan.io/address/0xC011A72400E58ecD99Ee497CF89E3775d4bd732F - Proxy public constant proxysynthetix_i = Proxy(0xC011A72400E58ecD99Ee497CF89E3775d4bd732F); - // https://etherscan.io/address/0x545973f28950f50fc6c7F52AAb4Ad214A27C0564 - ExchangeState public constant exchangestate_i = ExchangeState(0x545973f28950f50fc6c7F52AAb4Ad214A27C0564); - // https://etherscan.io/address/0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E - SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E); - // https://etherscan.io/address/0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD - LegacyTokenState public constant tokenstatesynthetix_i = LegacyTokenState(0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD); - // https://etherscan.io/address/0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82 - SynthetixState public constant synthetixstate_i = SynthetixState(0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82); - // https://etherscan.io/address/0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F - RewardEscrow public constant rewardescrow_i = RewardEscrow(0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F); - // https://etherscan.io/address/0x29C295B046a73Cde593f21f63091B072d407e3F2 - RewardsDistribution public constant rewardsdistribution_i = - RewardsDistribution(0x29C295B046a73Cde593f21f63091B072d407e3F2); - // https://etherscan.io/address/0x510adfDF6E7554C571b7Cd9305Ce91473610015e - FeePool public constant feepool_i = FeePool(0x510adfDF6E7554C571b7Cd9305Ce91473610015e); - // https://etherscan.io/address/0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b - MultiCollateralSynth public constant synthsusd_i = MultiCollateralSynth(0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b); - // https://etherscan.io/address/0x05a9CBe762B36632b3594DA4F082340E0e5343e8 - TokenState public constant tokenstatesusd_i = TokenState(0x05a9CBe762B36632b3594DA4F082340E0e5343e8); - // https://etherscan.io/address/0x57Ab1E02fEE23774580C119740129eAC7081e9D3 - Proxy public constant proxysusd_i = Proxy(0x57Ab1E02fEE23774580C119740129eAC7081e9D3); - // https://etherscan.io/address/0x57Ab1ec28D129707052df4dF418D58a2D46d5f51 - ProxyERC20 public constant proxyerc20susd_i = ProxyERC20(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51); - // https://etherscan.io/address/0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9 - MultiCollateralSynth public constant synthsbtc_i = MultiCollateralSynth(0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9); - // https://etherscan.io/address/0x4F6296455F8d754c19821cF1EC8FeBF2cD456E67 - TokenState public constant tokenstatesbtc_i = TokenState(0x4F6296455F8d754c19821cF1EC8FeBF2cD456E67); - // https://etherscan.io/address/0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6 - ProxyERC20 public constant proxysbtc_i = ProxyERC20(0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6); - // https://etherscan.io/address/0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6 - MultiCollateralSynth public constant synthseth_i = MultiCollateralSynth(0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6); - // https://etherscan.io/address/0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c - TokenState public constant tokenstateseth_i = TokenState(0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c); - // https://etherscan.io/address/0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb - ProxyERC20 public constant proxyseth_i = ProxyERC20(0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb); - // https://etherscan.io/address/0x922C84B3894298296C34842D866BfC0d36C54778 - Issuer public constant issuer_i = Issuer(0x922C84B3894298296C34842D866BfC0d36C54778); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://etherscan.io/address/0x510adfDF6E7554C571b7Cd9305Ce91473610015e - address public constant new_FeePool_contract = 0x510adfDF6E7554C571b7Cd9305Ce91473610015e; - // https://etherscan.io/address/0x54f25546260C7539088982bcF4b7dC8EDEF19f21 - address public constant new_Synthetix_contract = 0x54f25546260C7539088982bcF4b7dC8EDEF19f21; - // https://etherscan.io/address/0x7634F2A1741a683ccda37Dce864c187F990D7B4b - address public constant new_Exchanger_contract = 0x7634F2A1741a683ccda37Dce864c187F990D7B4b; - // https://etherscan.io/address/0xe92B4c7428152052B0930c81F4c687a5F1A12292 - address public constant new_DebtCache_contract = 0xe92B4c7428152052B0930c81F4c687a5F1A12292; - // https://etherscan.io/address/0x922C84B3894298296C34842D866BfC0d36C54778 - address public constant new_Issuer_contract = 0x922C84B3894298296C34842D866BfC0d36C54778; - // https://etherscan.io/address/0xe533139Af961c9747356D947838c98451015e234 - address public constant new_SynthRedeemer_contract = 0xe533139Af961c9747356D947838c98451015e234; - // https://etherscan.io/address/0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b - address public constant new_SynthsUSD_contract = 0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b; - // https://etherscan.io/address/0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9 - address public constant new_SynthsBTC_contract = 0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9; - // https://etherscan.io/address/0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6 - address public constant new_SynthsETH_contract = 0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](24); - contracts[0] = address(addressresolver_i); - contracts[1] = address(proxyfeepool_i); - contracts[2] = address(feepooleternalstorage_i); - contracts[3] = address(feepoolstate_i); - contracts[4] = address(proxyerc20_i); - contracts[5] = address(proxysynthetix_i); - contracts[6] = address(exchangestate_i); - contracts[7] = address(systemstatus_i); - contracts[8] = address(tokenstatesynthetix_i); - contracts[9] = address(synthetixstate_i); - contracts[10] = address(rewardescrow_i); - contracts[11] = address(rewardsdistribution_i); - contracts[12] = address(feepool_i); - contracts[13] = address(synthsusd_i); - contracts[14] = address(tokenstatesusd_i); - contracts[15] = address(proxysusd_i); - contracts[16] = address(proxyerc20susd_i); - contracts[17] = address(synthsbtc_i); - contracts[18] = address(tokenstatesbtc_i); - contracts[19] = address(proxysbtc_i); - contracts[20] = address(synthseth_i); - contracts[21] = address(tokenstateseth_i); - contracts[22] = address(proxyseth_i); - contracts[23] = address(issuer_i); - } - - function migrate(address currentOwner) external onlyDeployer { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - require( - ISynthetixNamedContract(new_FeePool_contract).CONTRACT_NAME() == "FeePool", - "Invalid contract supplied for FeePool" - ); - require( - ISynthetixNamedContract(new_Synthetix_contract).CONTRACT_NAME() == "Synthetix", - "Invalid contract supplied for Synthetix" - ); - require( - ISynthetixNamedContract(new_Exchanger_contract).CONTRACT_NAME() == "ExchangerWithVirtualSynth", - "Invalid contract supplied for Exchanger" - ); - require( - ISynthetixNamedContract(new_DebtCache_contract).CONTRACT_NAME() == "DebtCache", - "Invalid contract supplied for DebtCache" - ); - require( - ISynthetixNamedContract(new_Issuer_contract).CONTRACT_NAME() == "Issuer", - "Invalid contract supplied for Issuer" - ); - require( - ISynthetixNamedContract(new_SynthRedeemer_contract).CONTRACT_NAME() == "SynthRedeemer", - "Invalid contract supplied for SynthRedeemer" - ); - require( - ISynthetixNamedContract(new_SynthsUSD_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsUSD" - ); - require( - ISynthetixNamedContract(new_SynthsBTC_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsBTC" - ); - require( - ISynthetixNamedContract(new_SynthsETH_contract).CONTRACT_NAME() == "MultiCollateralSynth", - "Invalid contract supplied for SynthsETH" - ); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - addressresolver_rebuildCaches_1(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 2; - addressresolver_rebuildCaches_2(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 3; - addressresolver_rebuildCaches_3(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 4; - addressresolver_rebuildCaches_4(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 5; - addressresolver_rebuildCaches_5(); - // Ensure the ProxyFeePool contract has the correct FeePool target set; - proxyfeepool_i.setTarget(Proxyable(new_FeePool_contract)); - // Ensure the FeePool contract can write to its EternalStorage; - feepooleternalstorage_i.setAssociatedContract(new_FeePool_contract); - // Ensure the FeePool contract can write to its State; - feepoolstate_i.setFeePool(IFeePool(new_FeePool_contract)); - // Ensure the SNX proxy has the correct Synthetix target set; - proxyerc20_i.setTarget(Proxyable(new_Synthetix_contract)); - // Ensure the legacy SNX proxy has the correct Synthetix target set; - proxysynthetix_i.setTarget(Proxyable(new_Synthetix_contract)); - // Ensure the Exchanger contract can write to its State; - exchangestate_i.setAssociatedContract(new_Exchanger_contract); - // Ensure the Exchanger contract can suspend synths - see SIP-65; - systemstatus_i.updateAccessControl("Synth", new_Exchanger_contract, true, false); - // Ensure the Synthetix contract can write to its TokenState contract; - tokenstatesynthetix_i.setAssociatedContract(new_Synthetix_contract); - // Ensure that Synthetix can write to its State contract; - synthetixstate_i.setAssociatedContract(new_Issuer_contract); - // Ensure the legacy RewardEscrow contract is connected to the Synthetix contract; - rewardescrow_i.setSynthetix(ISynthetix(new_Synthetix_contract)); - // Ensure the legacy RewardEscrow contract is connected to the FeePool contract; - rewardescrow_i.setFeePool(IFeePool(new_FeePool_contract)); - // Ensure the RewardsDistribution has Synthetix set as its authority for distribution; - rewardsdistribution_i.setAuthority(new_Synthetix_contract); - // Import fee period from existing fee pool at index 0; - importFeePeriod_0(); - // Import fee period from existing fee pool at index 1; - importFeePeriod_1(); - // Ensure the new synth has the totalSupply from the previous one; - copyTotalSupplyFrom_sUSD(); - // Ensure the sUSD synth can write to its TokenState; - tokenstatesusd_i.setAssociatedContract(new_SynthsUSD_contract); - // Ensure the sUSD synth Proxy is correctly connected to the Synth; - proxysusd_i.setTarget(Proxyable(new_SynthsUSD_contract)); - // Ensure the special ERC20 proxy for sUSD has its target set to the Synth; - proxyerc20susd_i.setTarget(Proxyable(new_SynthsUSD_contract)); - // Ensure the new synth has the totalSupply from the previous one; - copyTotalSupplyFrom_sBTC(); - // Ensure the sBTC synth can write to its TokenState; - tokenstatesbtc_i.setAssociatedContract(new_SynthsBTC_contract); - // Ensure the sBTC synth Proxy is correctly connected to the Synth; - proxysbtc_i.setTarget(Proxyable(new_SynthsBTC_contract)); - // Ensure the new synth has the totalSupply from the previous one; - copyTotalSupplyFrom_sETH(); - // Ensure the sETH synth can write to its TokenState; - tokenstateseth_i.setAssociatedContract(new_SynthsETH_contract); - // Ensure the sETH synth Proxy is correctly connected to the Synth; - proxyseth_i.setTarget(Proxyable(new_SynthsETH_contract)); - // Add synths to the Issuer contract - batch 1; - issuer_addSynths_39(); - // Add synths to the Issuer contract - batch 2; - issuer_addSynths_40(); - // Add synths to the Issuer contract - batch 3; - issuer_addSynths_41(); - // Add synths to the Issuer contract - batch 4; - issuer_addSynths_42(); - // Add synths to the Issuer contract - batch 5; - issuer_addSynths_43(); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } - - function addressresolver_importAddresses_0() internal { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](9); - addressresolver_importAddresses_names_0_0[0] = bytes32("FeePool"); - addressresolver_importAddresses_names_0_0[1] = bytes32("Synthetix"); - addressresolver_importAddresses_names_0_0[2] = bytes32("Exchanger"); - addressresolver_importAddresses_names_0_0[3] = bytes32("DebtCache"); - addressresolver_importAddresses_names_0_0[4] = bytes32("Issuer"); - addressresolver_importAddresses_names_0_0[5] = bytes32("SynthRedeemer"); - addressresolver_importAddresses_names_0_0[6] = bytes32("SynthsUSD"); - addressresolver_importAddresses_names_0_0[7] = bytes32("SynthsBTC"); - addressresolver_importAddresses_names_0_0[8] = bytes32("SynthsETH"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](9); - addressresolver_importAddresses_destinations_0_1[0] = address(new_FeePool_contract); - addressresolver_importAddresses_destinations_0_1[1] = address(new_Synthetix_contract); - addressresolver_importAddresses_destinations_0_1[2] = address(new_Exchanger_contract); - addressresolver_importAddresses_destinations_0_1[3] = address(new_DebtCache_contract); - addressresolver_importAddresses_destinations_0_1[4] = address(new_Issuer_contract); - addressresolver_importAddresses_destinations_0_1[5] = address(new_SynthRedeemer_contract); - addressresolver_importAddresses_destinations_0_1[6] = address(new_SynthsUSD_contract); - addressresolver_importAddresses_destinations_0_1[7] = address(new_SynthsBTC_contract); - addressresolver_importAddresses_destinations_0_1[8] = address(new_SynthsETH_contract); - addressresolver_i.importAddresses( - addressresolver_importAddresses_names_0_0, - addressresolver_importAddresses_destinations_0_1 - ); - } - - function addressresolver_rebuildCaches_1() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(new_Exchanger_contract); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(new_Issuer_contract); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(new_SynthsUSD_contract); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0xC61b352fCc311Ae6B0301459A970150005e74b3E); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0x37B648a07476F4941D3D647f81118AFd55fa8a04); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(0x5eDf7dd83fE2889D264fa9D3b93d0a6e6A45D6C6); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(0x9745606DA6e162866DAD7bF80f2AbF145EDD7571); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(0x2962EA4E749e54b10CFA557770D597027BA67cB3); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(new_SynthsBTC_contract); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(new_SynthsETH_contract); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(0xda3c83750b1FA31Fda838136ef3f853b41cb7a5a); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(0x47bD14817d7684082E04934878EE2Dd3576Ae19d); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(0x6F927644d55E32318629198081923894FbFe5c07); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(0xe3D5E1c1bA874C0fF3BA31b999967F24d5ca04e5); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(0xA962208CDC8588F9238fae169d0F63306c353F4F); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } - - function addressresolver_rebuildCaches_2() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_2_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_2_0[0] = MixinResolver(0xcd980Fc5CcdAe62B18A52b83eC64200121A929db); - addressresolver_rebuildCaches_destinations_2_0[1] = MixinResolver(0xAf090d6E583C082f2011908cf95c2518BE7A53ac); - addressresolver_rebuildCaches_destinations_2_0[2] = MixinResolver(0x21ee4afBd6c151fD9A69c1389598170B1d45E0e3); - addressresolver_rebuildCaches_destinations_2_0[3] = MixinResolver(0xcb6Cb218D558ae7fF6415f95BDA6616FCFF669Cb); - addressresolver_rebuildCaches_destinations_2_0[4] = MixinResolver(0x7B29C9e188De18563B19d162374ce6836F31415a); - addressresolver_rebuildCaches_destinations_2_0[5] = MixinResolver(0xC22e51FA362654ea453B4018B616ef6f6ab3b779); - addressresolver_rebuildCaches_destinations_2_0[6] = MixinResolver(0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270); - addressresolver_rebuildCaches_destinations_2_0[7] = MixinResolver(0xAa1b12E3e5F70aBCcd1714F4260A74ca21e7B17b); - addressresolver_rebuildCaches_destinations_2_0[8] = MixinResolver(0x0F393ce493d8FB0b83915248a21a3104932ed97c); - addressresolver_rebuildCaches_destinations_2_0[9] = MixinResolver(0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb); - addressresolver_rebuildCaches_destinations_2_0[10] = MixinResolver(0x4287dac1cC7434991119Eba7413189A66fFE65cF); - addressresolver_rebuildCaches_destinations_2_0[11] = MixinResolver(0x34c76BC146b759E58886e821D62548AC1e0BA7Bc); - addressresolver_rebuildCaches_destinations_2_0[12] = MixinResolver(0x0E8Fa2339314AB7E164818F26207897bBe29C3af); - addressresolver_rebuildCaches_destinations_2_0[13] = MixinResolver(0xe615Df79AC987193561f37E77465bEC2aEfe9aDb); - addressresolver_rebuildCaches_destinations_2_0[14] = MixinResolver(0x3E2dA260B4A85782A629320EB027A3B7c28eA9f1); - addressresolver_rebuildCaches_destinations_2_0[15] = MixinResolver(0xc02DD182Ce029E6d7f78F37492DFd39E4FEB1f8b); - addressresolver_rebuildCaches_destinations_2_0[16] = MixinResolver(0x0d1c4e5C07B071aa4E6A14A604D4F6478cAAC7B4); - addressresolver_rebuildCaches_destinations_2_0[17] = MixinResolver(0x13D0F5B8630520eA04f694F17A001fb95eaFD30E); - addressresolver_rebuildCaches_destinations_2_0[18] = MixinResolver(0x815CeF3b7773f35428B4353073B086ecB658f73C); - addressresolver_rebuildCaches_destinations_2_0[19] = MixinResolver(0xb0e0BA880775B7F2ba813b3800b3979d719F0379); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_2_0); - } - - function addressresolver_rebuildCaches_3() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_3_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_3_0[0] = MixinResolver(0x8e082925e78538955bC0e2F363FC5d1Ab3be739b); - addressresolver_rebuildCaches_destinations_3_0[1] = MixinResolver(0x399BA516a6d68d6Ad4D5f3999902D0DeAcaACDdd); - addressresolver_rebuildCaches_destinations_3_0[2] = MixinResolver(0x9530FA32a3059114AC20A5812870Da12D97d1174); - addressresolver_rebuildCaches_destinations_3_0[3] = MixinResolver(0x249612F641111022f2f48769f3Df5D85cb3E26a2); - addressresolver_rebuildCaches_destinations_3_0[4] = MixinResolver(0x04720DbBD4599aD26811545595d97fB813E84964); - addressresolver_rebuildCaches_destinations_3_0[5] = MixinResolver(0x2acfe6265D358d982cB1c3B521199973CD443C71); - addressresolver_rebuildCaches_destinations_3_0[6] = MixinResolver(0x46A7Af405093B27DA6DeF193C508Bd9240A255FA); - addressresolver_rebuildCaches_destinations_3_0[7] = MixinResolver(0x8350d1b2d6EF5289179fe49E5b0F208165B4e32e); - addressresolver_rebuildCaches_destinations_3_0[8] = MixinResolver(0x29DD4A59F4D339226867e77aF211724eaBb45c02); - addressresolver_rebuildCaches_destinations_3_0[9] = MixinResolver(0xf7B8dF8b16dA302d85603B8e7F95111a768458Cc); - addressresolver_rebuildCaches_destinations_3_0[10] = MixinResolver(0x0517A56da8A517e3b2D484Cc5F1Da4BDCfE68ec3); - addressresolver_rebuildCaches_destinations_3_0[11] = MixinResolver(0x099CfAd1640fc7EA686ab1D83F0A285Ba0470882); - addressresolver_rebuildCaches_destinations_3_0[12] = MixinResolver(0x19cC1f63e344D74A87D955E3F3E95B28DDDc61d8); - addressresolver_rebuildCaches_destinations_3_0[13] = MixinResolver(0x4D50A0e5f068ACdC80A1da2dd1f0Ad48845df2F8); - addressresolver_rebuildCaches_destinations_3_0[14] = MixinResolver(0xb73c665825dAa926D6ef09417FbE5654473c1b49); - addressresolver_rebuildCaches_destinations_3_0[15] = MixinResolver(0x806A599d60B2FdBda379D5890287D2fba1026cC0); - addressresolver_rebuildCaches_destinations_3_0[16] = MixinResolver(0xCea42504874586a718954746A564B72bc7eba3E3); - addressresolver_rebuildCaches_destinations_3_0[17] = MixinResolver(0x947d5656725fB9A8f9c826A91b6082b07E2745B7); - addressresolver_rebuildCaches_destinations_3_0[18] = MixinResolver(0x186E56A62E7caCE1308f1A1B0dbb27f33F80f16f); - addressresolver_rebuildCaches_destinations_3_0[19] = MixinResolver(0x931c5516EE121a177bD2B60e0122Da5B27630ABc); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_3_0); - } - - function addressresolver_rebuildCaches_4() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_4_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_4_0[0] = MixinResolver(0x6Dc6a64724399524184C2c44a526A2cff1BaA507); - addressresolver_rebuildCaches_destinations_4_0[1] = MixinResolver(0x87eb6e935e3C7E3E3A0E31a5658498bC87dE646E); - addressresolver_rebuildCaches_destinations_4_0[2] = MixinResolver(0x53869BDa4b8d85aEDCC9C6cAcf015AF9447Cade7); - addressresolver_rebuildCaches_destinations_4_0[3] = MixinResolver(0x1cB27Ac646afAE192dF9928A2808C0f7f586Af7d); - addressresolver_rebuildCaches_destinations_4_0[4] = MixinResolver(0x3dD7b893c25025CabFBd290A5E06BaFF3DE335b8); - addressresolver_rebuildCaches_destinations_4_0[5] = MixinResolver(0x1A4505543C92084bE57ED80113eaB7241171e7a8); - addressresolver_rebuildCaches_destinations_4_0[6] = MixinResolver(0xF6ce55E09De0F9F97210aAf6DB88Ed6b6792Ca1f); - addressresolver_rebuildCaches_destinations_4_0[7] = MixinResolver(0xacAAB69C2BA65A2DB415605F309007e18D4F5E8C); - addressresolver_rebuildCaches_destinations_4_0[8] = MixinResolver(0x9A5Ea0D8786B8d17a70410A905Aed1443fae5A38); - addressresolver_rebuildCaches_destinations_4_0[9] = MixinResolver(0xC1AAE9d18bBe386B102435a8632C8063d31e747C); - addressresolver_rebuildCaches_destinations_4_0[10] = MixinResolver(0x5c8344bcdC38F1aB5EB5C1d4a35DdEeA522B5DfA); - addressresolver_rebuildCaches_destinations_4_0[11] = MixinResolver(0xaa03aB31b55DceEeF845C8d17890CC61cD98eD04); - addressresolver_rebuildCaches_destinations_4_0[12] = MixinResolver(0x1F2c3a1046c32729862fcB038369696e3273a516); - addressresolver_rebuildCaches_destinations_4_0[13] = MixinResolver(0xAD95C918af576c82Df740878C3E983CBD175daB6); - addressresolver_rebuildCaches_destinations_4_0[14] = MixinResolver(new_FeePool_contract); - addressresolver_rebuildCaches_destinations_4_0[15] = MixinResolver(0x62922670313bf6b41C580143d1f6C173C5C20019); - addressresolver_rebuildCaches_destinations_4_0[16] = MixinResolver(0xCd9D4988C0AE61887B075bA77f08cbFAd2b65068); - addressresolver_rebuildCaches_destinations_4_0[17] = MixinResolver(0xd69b189020EF614796578AfE4d10378c5e7e1138); - addressresolver_rebuildCaches_destinations_4_0[18] = MixinResolver(new_Synthetix_contract); - addressresolver_rebuildCaches_destinations_4_0[19] = MixinResolver(new_DebtCache_contract); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_4_0); - } - - function addressresolver_rebuildCaches_5() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_5_0 = new MixinResolver[](3); - addressresolver_rebuildCaches_destinations_5_0[0] = MixinResolver(new_SynthRedeemer_contract); - addressresolver_rebuildCaches_destinations_5_0[1] = MixinResolver(0x067e398605E84F2D0aEEC1806e62768C5110DCc6); - addressresolver_rebuildCaches_destinations_5_0[2] = MixinResolver(0x7A3d898b717e50a96fd8b232E9d15F0A547A7eeb); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_5_0); - } - - function importFeePeriod_0() internal { - // https://etherscan.io/address/0xcf9E60005C9aca983caf65d3669a24fDd0775fc0; - FeePool existingFeePool = FeePool(0xcf9E60005C9aca983caf65d3669a24fDd0775fc0); - // https://etherscan.io/address/0x510adfDF6E7554C571b7Cd9305Ce91473610015e; - FeePool newFeePool = FeePool(0x510adfDF6E7554C571b7Cd9305Ce91473610015e); - ( - uint64 feePeriodId_0, - uint64 startingDebtIndex_0, - uint64 startTime_0, - uint feesToDistribute_0, - uint feesClaimed_0, - uint rewardsToDistribute_0, - uint rewardsClaimed_0 - ) = existingFeePool.recentFeePeriods(0); - newFeePool.importFeePeriod( - 0, - feePeriodId_0, - startingDebtIndex_0, - startTime_0, - feesToDistribute_0, - feesClaimed_0, - rewardsToDistribute_0, - rewardsClaimed_0 - ); - } - - function importFeePeriod_1() internal { - // https://etherscan.io/address/0xcf9E60005C9aca983caf65d3669a24fDd0775fc0; - FeePool existingFeePool = FeePool(0xcf9E60005C9aca983caf65d3669a24fDd0775fc0); - // https://etherscan.io/address/0x510adfDF6E7554C571b7Cd9305Ce91473610015e; - FeePool newFeePool = FeePool(0x510adfDF6E7554C571b7Cd9305Ce91473610015e); - ( - uint64 feePeriodId_1, - uint64 startingDebtIndex_1, - uint64 startTime_1, - uint feesToDistribute_1, - uint feesClaimed_1, - uint rewardsToDistribute_1, - uint rewardsClaimed_1 - ) = existingFeePool.recentFeePeriods(1); - newFeePool.importFeePeriod( - 1, - feePeriodId_1, - startingDebtIndex_1, - startTime_1, - feesToDistribute_1, - feesClaimed_1, - rewardsToDistribute_1, - rewardsClaimed_1 - ); - } - - function copyTotalSupplyFrom_sUSD() internal { - // https://etherscan.io/address/0x4D8dBD193d89b7B506BE5dC9Db75B91dA00D6a1d; - Synth existingSynth = Synth(0x4D8dBD193d89b7B506BE5dC9Db75B91dA00D6a1d); - // https://etherscan.io/address/0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b; - Synth newSynth = Synth(0x967968963517AFDC9b8Ccc9AD6649bC507E83a7b); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sBTC() internal { - // https://etherscan.io/address/0xDB91E4B3b6E19bF22E810C43273eae48C9037e74; - Synth existingSynth = Synth(0xDB91E4B3b6E19bF22E810C43273eae48C9037e74); - // https://etherscan.io/address/0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9; - Synth newSynth = Synth(0xC8a5f06858a1B49A7F703EacD433A1444a5e5bd9); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function copyTotalSupplyFrom_sETH() internal { - // https://etherscan.io/address/0xab4e760fEEe20C5c2509061b995e06b542D3112B; - Synth existingSynth = Synth(0xab4e760fEEe20C5c2509061b995e06b542D3112B); - // https://etherscan.io/address/0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6; - Synth newSynth = Synth(0xCFA46B4923c0E75B7b84E9FBde70ED26feFefBf6); - newSynth.setTotalSupply(existingSynth.totalSupply()); - } - - function issuer_addSynths_39() internal { - ISynth[] memory issuer_addSynths_synthsToAdd_39_0 = new ISynth[](15); - issuer_addSynths_synthsToAdd_39_0[0] = ISynth(new_SynthsUSD_contract); - issuer_addSynths_synthsToAdd_39_0[1] = ISynth(0xC61b352fCc311Ae6B0301459A970150005e74b3E); - issuer_addSynths_synthsToAdd_39_0[2] = ISynth(0x388fD1A8a7d36e03eFA1ab100a1c5159a3A3d427); - issuer_addSynths_synthsToAdd_39_0[3] = ISynth(0x37B648a07476F4941D3D647f81118AFd55fa8a04); - issuer_addSynths_synthsToAdd_39_0[4] = ISynth(0xEF285D339c91aDf1dD7DE0aEAa6250805FD68258); - issuer_addSynths_synthsToAdd_39_0[5] = ISynth(0xcf9bB94b5d65589039607BA66e3DAC686d3eFf01); - issuer_addSynths_synthsToAdd_39_0[6] = ISynth(0xCeC4e038371d32212C6Dcdf36Fdbcb6F8a34C6d8); - issuer_addSynths_synthsToAdd_39_0[7] = ISynth(0x5eDf7dd83fE2889D264fa9D3b93d0a6e6A45D6C6); - issuer_addSynths_synthsToAdd_39_0[8] = ISynth(0x9745606DA6e162866DAD7bF80f2AbF145EDD7571); - issuer_addSynths_synthsToAdd_39_0[9] = ISynth(0x2962EA4E749e54b10CFA557770D597027BA67cB3); - issuer_addSynths_synthsToAdd_39_0[10] = ISynth(new_SynthsBTC_contract); - issuer_addSynths_synthsToAdd_39_0[11] = ISynth(new_SynthsETH_contract); - issuer_addSynths_synthsToAdd_39_0[12] = ISynth(0xda3c83750b1FA31Fda838136ef3f853b41cb7a5a); - issuer_addSynths_synthsToAdd_39_0[13] = ISynth(0x47bD14817d7684082E04934878EE2Dd3576Ae19d); - issuer_addSynths_synthsToAdd_39_0[14] = ISynth(0x6F927644d55E32318629198081923894FbFe5c07); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_39_0); - } - - function issuer_addSynths_40() internal { - ISynth[] memory issuer_addSynths_synthsToAdd_40_0 = new ISynth[](15); - issuer_addSynths_synthsToAdd_40_0[0] = ISynth(0xe3D5E1c1bA874C0fF3BA31b999967F24d5ca04e5); - issuer_addSynths_synthsToAdd_40_0[1] = ISynth(0xA962208CDC8588F9238fae169d0F63306c353F4F); - issuer_addSynths_synthsToAdd_40_0[2] = ISynth(0xcd980Fc5CcdAe62B18A52b83eC64200121A929db); - issuer_addSynths_synthsToAdd_40_0[3] = ISynth(0xAf090d6E583C082f2011908cf95c2518BE7A53ac); - issuer_addSynths_synthsToAdd_40_0[4] = ISynth(0x21ee4afBd6c151fD9A69c1389598170B1d45E0e3); - issuer_addSynths_synthsToAdd_40_0[5] = ISynth(0xcb6Cb218D558ae7fF6415f95BDA6616FCFF669Cb); - issuer_addSynths_synthsToAdd_40_0[6] = ISynth(0x7B29C9e188De18563B19d162374ce6836F31415a); - issuer_addSynths_synthsToAdd_40_0[7] = ISynth(0xC22e51FA362654ea453B4018B616ef6f6ab3b779); - issuer_addSynths_synthsToAdd_40_0[8] = ISynth(0xaB38249f4f56Ef868F6b5E01D9cFa26B952c1270); - issuer_addSynths_synthsToAdd_40_0[9] = ISynth(0xAa1b12E3e5F70aBCcd1714F4260A74ca21e7B17b); - issuer_addSynths_synthsToAdd_40_0[10] = ISynth(0x0F393ce493d8FB0b83915248a21a3104932ed97c); - issuer_addSynths_synthsToAdd_40_0[11] = ISynth(0xfD0435A588BF5c5a6974BA19Fa627b772833d4eb); - issuer_addSynths_synthsToAdd_40_0[12] = ISynth(0x4287dac1cC7434991119Eba7413189A66fFE65cF); - issuer_addSynths_synthsToAdd_40_0[13] = ISynth(0x34c76BC146b759E58886e821D62548AC1e0BA7Bc); - issuer_addSynths_synthsToAdd_40_0[14] = ISynth(0x0E8Fa2339314AB7E164818F26207897bBe29C3af); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_40_0); - } - - function issuer_addSynths_41() internal { - ISynth[] memory issuer_addSynths_synthsToAdd_41_0 = new ISynth[](15); - issuer_addSynths_synthsToAdd_41_0[0] = ISynth(0xe615Df79AC987193561f37E77465bEC2aEfe9aDb); - issuer_addSynths_synthsToAdd_41_0[1] = ISynth(0x3E2dA260B4A85782A629320EB027A3B7c28eA9f1); - issuer_addSynths_synthsToAdd_41_0[2] = ISynth(0xc02DD182Ce029E6d7f78F37492DFd39E4FEB1f8b); - issuer_addSynths_synthsToAdd_41_0[3] = ISynth(0x0d1c4e5C07B071aa4E6A14A604D4F6478cAAC7B4); - issuer_addSynths_synthsToAdd_41_0[4] = ISynth(0x13D0F5B8630520eA04f694F17A001fb95eaFD30E); - issuer_addSynths_synthsToAdd_41_0[5] = ISynth(0x815CeF3b7773f35428B4353073B086ecB658f73C); - issuer_addSynths_synthsToAdd_41_0[6] = ISynth(0xb0e0BA880775B7F2ba813b3800b3979d719F0379); - issuer_addSynths_synthsToAdd_41_0[7] = ISynth(0x8e082925e78538955bC0e2F363FC5d1Ab3be739b); - issuer_addSynths_synthsToAdd_41_0[8] = ISynth(0x399BA516a6d68d6Ad4D5f3999902D0DeAcaACDdd); - issuer_addSynths_synthsToAdd_41_0[9] = ISynth(0x9530FA32a3059114AC20A5812870Da12D97d1174); - issuer_addSynths_synthsToAdd_41_0[10] = ISynth(0x249612F641111022f2f48769f3Df5D85cb3E26a2); - issuer_addSynths_synthsToAdd_41_0[11] = ISynth(0x04720DbBD4599aD26811545595d97fB813E84964); - issuer_addSynths_synthsToAdd_41_0[12] = ISynth(0x2acfe6265D358d982cB1c3B521199973CD443C71); - issuer_addSynths_synthsToAdd_41_0[13] = ISynth(0x46A7Af405093B27DA6DeF193C508Bd9240A255FA); - issuer_addSynths_synthsToAdd_41_0[14] = ISynth(0x8350d1b2d6EF5289179fe49E5b0F208165B4e32e); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_41_0); - } - - function issuer_addSynths_42() internal { - ISynth[] memory issuer_addSynths_synthsToAdd_42_0 = new ISynth[](15); - issuer_addSynths_synthsToAdd_42_0[0] = ISynth(0x29DD4A59F4D339226867e77aF211724eaBb45c02); - issuer_addSynths_synthsToAdd_42_0[1] = ISynth(0xf7B8dF8b16dA302d85603B8e7F95111a768458Cc); - issuer_addSynths_synthsToAdd_42_0[2] = ISynth(0x0517A56da8A517e3b2D484Cc5F1Da4BDCfE68ec3); - issuer_addSynths_synthsToAdd_42_0[3] = ISynth(0x099CfAd1640fc7EA686ab1D83F0A285Ba0470882); - issuer_addSynths_synthsToAdd_42_0[4] = ISynth(0x19cC1f63e344D74A87D955E3F3E95B28DDDc61d8); - issuer_addSynths_synthsToAdd_42_0[5] = ISynth(0x4D50A0e5f068ACdC80A1da2dd1f0Ad48845df2F8); - issuer_addSynths_synthsToAdd_42_0[6] = ISynth(0xb73c665825dAa926D6ef09417FbE5654473c1b49); - issuer_addSynths_synthsToAdd_42_0[7] = ISynth(0x806A599d60B2FdBda379D5890287D2fba1026cC0); - issuer_addSynths_synthsToAdd_42_0[8] = ISynth(0xCea42504874586a718954746A564B72bc7eba3E3); - issuer_addSynths_synthsToAdd_42_0[9] = ISynth(0x947d5656725fB9A8f9c826A91b6082b07E2745B7); - issuer_addSynths_synthsToAdd_42_0[10] = ISynth(0x186E56A62E7caCE1308f1A1B0dbb27f33F80f16f); - issuer_addSynths_synthsToAdd_42_0[11] = ISynth(0x931c5516EE121a177bD2B60e0122Da5B27630ABc); - issuer_addSynths_synthsToAdd_42_0[12] = ISynth(0x6Dc6a64724399524184C2c44a526A2cff1BaA507); - issuer_addSynths_synthsToAdd_42_0[13] = ISynth(0x87eb6e935e3C7E3E3A0E31a5658498bC87dE646E); - issuer_addSynths_synthsToAdd_42_0[14] = ISynth(0x53869BDa4b8d85aEDCC9C6cAcf015AF9447Cade7); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_42_0); - } - - function issuer_addSynths_43() internal { - ISynth[] memory issuer_addSynths_synthsToAdd_43_0 = new ISynth[](6); - issuer_addSynths_synthsToAdd_43_0[0] = ISynth(0x1cB27Ac646afAE192dF9928A2808C0f7f586Af7d); - issuer_addSynths_synthsToAdd_43_0[1] = ISynth(0x3dD7b893c25025CabFBd290A5E06BaFF3DE335b8); - issuer_addSynths_synthsToAdd_43_0[2] = ISynth(0x1A4505543C92084bE57ED80113eaB7241171e7a8); - issuer_addSynths_synthsToAdd_43_0[3] = ISynth(0xF6ce55E09De0F9F97210aAf6DB88Ed6b6792Ca1f); - issuer_addSynths_synthsToAdd_43_0[4] = ISynth(0xacAAB69C2BA65A2DB415605F309007e18D4F5E8C); - issuer_addSynths_synthsToAdd_43_0[5] = ISynth(0x9A5Ea0D8786B8d17a70410A905Aed1443fae5A38); - issuer_i.addSynths(issuer_addSynths_synthsToAdd_43_0); - } -} diff --git a/contracts/migrations/Migration_Peacock.sol b/contracts/migrations/Migration_Peacock.sol deleted file mode 100644 index faaa6a2631..0000000000 --- a/contracts/migrations/Migration_Peacock.sol +++ /dev/null @@ -1,202 +0,0 @@ - -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../Proxy.sol"; -import "../FeePoolEternalStorage.sol"; -import "../FeePoolState.sol"; -import "../RewardEscrow.sol"; -import "../FeePool.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_Peacock is BaseMigration { - // https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83 - AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83); - // https://etherscan.io/address/0xb440DD674e1243644791a4AdfE3A2AbB0A92d309 - Proxy public constant proxyfeepool_i = Proxy(0xb440DD674e1243644791a4AdfE3A2AbB0A92d309); - // https://etherscan.io/address/0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB - FeePoolEternalStorage public constant feepooleternalstorage_i = FeePoolEternalStorage(0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB); - // https://etherscan.io/address/0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02 - FeePoolState public constant feepoolstate_i = FeePoolState(0x11164F6a47C3f8472D19b9aDd516Fc780cb7Ee02); - // https://etherscan.io/address/0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F - RewardEscrow public constant rewardescrow_i = RewardEscrow(0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F); - // https://etherscan.io/address/0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd - FeePool public constant feepool_i = FeePool(0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://etherscan.io/address/0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd - address public constant new_FeePool_contract = 0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](6); - contracts[0]= address(addressresolver_i); - contracts[1]= address(proxyfeepool_i); - contracts[2]= address(feepooleternalstorage_i); - contracts[3]= address(feepoolstate_i); - contracts[4]= address(rewardescrow_i); - contracts[5]= address(feepool_i); - } - - function migrate(address currentOwner) external onlyDeployer { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - require(ISynthetixNamedContract(new_FeePool_contract).CONTRACT_NAME() == "FeePool", "Invalid contract supplied for FeePool"); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - addressresolver_rebuildCaches_1(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 2; - addressresolver_rebuildCaches_2(); - // Ensure the ProxyFeePool contract has the correct FeePool target set; - proxyfeepool_i.setTarget(Proxyable(new_FeePool_contract)); - // Ensure the FeePool contract can write to its EternalStorage; - feepooleternalstorage_i.setAssociatedContract(new_FeePool_contract); - // Ensure the FeePool contract can write to its State; - feepoolstate_i.setFeePool(IFeePool(new_FeePool_contract)); - // Ensure the legacy RewardEscrow contract is connected to the FeePool contract; - rewardescrow_i.setFeePool(IFeePool(new_FeePool_contract)); - // Import fee period from existing fee pool at index 0; - importFeePeriod_0(); - // Import fee period from existing fee pool at index 1; - importFeePeriod_1(); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } - - - function addressresolver_importAddresses_0() internal { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](1); - addressresolver_importAddresses_names_0_0[0] = bytes32("FeePool"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](1); - addressresolver_importAddresses_destinations_0_1[0] = address(new_FeePool_contract); - addressresolver_i.importAddresses(addressresolver_importAddresses_names_0_0, addressresolver_importAddresses_destinations_0_1); - } - - - function addressresolver_rebuildCaches_1() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](20); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0xDA4eF8520b1A57D7d63f1E249606D1A459698876); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0x2A417C61B8062363e4ff50900779463b45d235f6); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(0xC2F1F551bfAd1E9A3b4816513bFd41d77f40F915); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(0x02f9bC46beD33acdB9cb002fe346734CeF8a9480); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0xAFDd6B5A8aB32156dBFb4060ff87F6d9E31191bA); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0xe301da3d2D3e96e57D05b8E557656629cDdbe7A0); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0x4ed5c5D5793f86c8a85E1a96E37b6d374DE0E85A); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0x005d19CA7ff9D79a5Bdf0805Fc01D9D7c53B6827); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0xde3892383965FBa6eC434bE6350F85f140098708); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0x39DDbbb113AF3434048b9d8018a3e99d67C6eE0D); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(0xe2f532c389deb5E42DCe53e78A9762949A885455); - addressresolver_rebuildCaches_destinations_1_0[11] = MixinResolver(0x2B3eb5eF0EF06f2E02ef60B3F36Be4793d321353); - addressresolver_rebuildCaches_destinations_1_0[12] = MixinResolver(0xc70B42930BD8D30A79B55415deC3be60827559f7); - addressresolver_rebuildCaches_destinations_1_0[13] = MixinResolver(0x3FFE35c3d412150C3B91d3E22eBA60E16030C608); - addressresolver_rebuildCaches_destinations_1_0[14] = MixinResolver(0x8f9fa817200F5B95f9572c8Acf2b31410C00335a); - addressresolver_rebuildCaches_destinations_1_0[15] = MixinResolver(0x0705F0716b12a703d4F8832Ec7b97C61771f0361); - addressresolver_rebuildCaches_destinations_1_0[16] = MixinResolver(0xfA60918C4417b64E722ca15d79C751c1f24Ab995); - addressresolver_rebuildCaches_destinations_1_0[17] = MixinResolver(0xcc3aab773e2171b2E257Ee17001400eE378aa52B); - addressresolver_rebuildCaches_destinations_1_0[18] = MixinResolver(0xe59dFC746D566EB40F92ed0B162004e24E3AC932); - addressresolver_rebuildCaches_destinations_1_0[19] = MixinResolver(0xC1AAE9d18bBe386B102435a8632C8063d31e747C); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } - - - function addressresolver_rebuildCaches_2() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_2_0 = new MixinResolver[](4); - addressresolver_rebuildCaches_destinations_2_0[0] = MixinResolver(0x5c8344bcdC38F1aB5EB5C1d4a35DdEeA522B5DfA); - addressresolver_rebuildCaches_destinations_2_0[1] = MixinResolver(0xaa03aB31b55DceEeF845C8d17890CC61cD98eD04); - addressresolver_rebuildCaches_destinations_2_0[2] = MixinResolver(0x1F2c3a1046c32729862fcB038369696e3273a516); - addressresolver_rebuildCaches_destinations_2_0[3] = MixinResolver(new_FeePool_contract); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_2_0); - } - - - function importFeePeriod_0() internal { - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579; - FeePool existingFeePool = FeePool(0xc398406FFfBEd5B0680e706634490062CB1DB579); - // https://etherscan.io/address/0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd; - FeePool newFeePool = FeePool(0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd); - ( - uint64 feePeriodId_0, - uint64 startingDebtIndex_0, - uint64 startTime_0, - uint feesToDistribute_0, - uint feesClaimed_0, - uint rewardsToDistribute_0, - uint rewardsClaimed_0 - ) = existingFeePool.recentFeePeriods(0); - newFeePool.importFeePeriod( - 0, - feePeriodId_0, - startingDebtIndex_0, - startTime_0, - feesToDistribute_0, - feesClaimed_0, - rewardsToDistribute_0, - rewardsClaimed_0 - ); - } - - - function importFeePeriod_1() internal { - // https://etherscan.io/address/0xc398406FFfBEd5B0680e706634490062CB1DB579; - FeePool existingFeePool = FeePool(0xc398406FFfBEd5B0680e706634490062CB1DB579); - // https://etherscan.io/address/0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd; - FeePool newFeePool = FeePool(0xF66d34426C10CE91cDBcd86F8e9594AfB83049bd); - ( - uint64 feePeriodId_1, - uint64 startingDebtIndex_1, - uint64 startTime_1, - uint feesToDistribute_1, - uint feesClaimed_1, - uint rewardsToDistribute_1, - uint rewardsClaimed_1 - ) = existingFeePool.recentFeePeriods(1); - newFeePool.importFeePeriod( - 1, - feePeriodId_1, - startingDebtIndex_1, - startTime_1, - feesToDistribute_1, - feesClaimed_1, - rewardsToDistribute_1, - rewardsClaimed_1 - ); - } -} diff --git a/contracts/migrations/Migration_PeacockOptimism.sol b/contracts/migrations/Migration_PeacockOptimism.sol deleted file mode 100644 index c24c453de8..0000000000 --- a/contracts/migrations/Migration_PeacockOptimism.sol +++ /dev/null @@ -1,175 +0,0 @@ - -pragma solidity ^0.5.16; - -import "../BaseMigration.sol"; -import "../AddressResolver.sol"; -import "../Proxy.sol"; -import "../FeePoolEternalStorage.sol"; -import "../FeePoolState.sol"; -import "../FeePool.sol"; - -interface ISynthetixNamedContract { - // solhint-disable func-name-mixedcase - function CONTRACT_NAME() external view returns (bytes32); -} - -// solhint-disable contract-name-camelcase -contract Migration_PeacockOptimism is BaseMigration { - // https://explorer.optimism.io/address/0x6d4a64C57612841c2C6745dB2a4E4db34F002D20; - address public constant OWNER = 0x6d4a64C57612841c2C6745dB2a4E4db34F002D20; - - // ---------------------------- - // EXISTING SYNTHETIX CONTRACTS - // ---------------------------- - - // https://explorer.optimism.io/address/0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C - AddressResolver public constant addressresolver_i = AddressResolver(0x95A6a3f44a70172E7d50a9e28c85Dfd712756B8C); - // https://explorer.optimism.io/address/0x4a16A42407AA491564643E1dfc1fd50af29794eF - Proxy public constant proxyfeepool_i = Proxy(0x4a16A42407AA491564643E1dfc1fd50af29794eF); - // https://explorer.optimism.io/address/0x41140Bf6498a36f2E44eFd49f21dAe3bbb7367c8 - FeePoolEternalStorage public constant feepooleternalstorage_i = FeePoolEternalStorage(0x41140Bf6498a36f2E44eFd49f21dAe3bbb7367c8); - // https://explorer.optimism.io/address/0x6e0d26cffc3a63d763F1546f749bf62ebC7d72D8 - FeePoolState public constant feepoolstate_i = FeePoolState(0x6e0d26cffc3a63d763F1546f749bf62ebC7d72D8); - // https://explorer.optimism.io/address/0xFDf3Be612c65464AEB4859047350a6220F304F52 - FeePool public constant feepool_i = FeePool(0xFDf3Be612c65464AEB4859047350a6220F304F52); - - // ---------------------------------- - // NEW CONTRACTS DEPLOYED TO BE ADDED - // ---------------------------------- - - // https://explorer.optimism.io/address/0xFDf3Be612c65464AEB4859047350a6220F304F52 - address public constant new_FeePool_contract = 0xFDf3Be612c65464AEB4859047350a6220F304F52; - - constructor() public BaseMigration(OWNER) {} - - function contractsRequiringOwnership() public pure returns (address[] memory contracts) { - contracts = new address[](5); - contracts[0]= address(addressresolver_i); - contracts[1]= address(proxyfeepool_i); - contracts[2]= address(feepooleternalstorage_i); - contracts[3]= address(feepoolstate_i); - contracts[4]= address(feepool_i); - } - - function migrate(address currentOwner) external onlyDeployer { - require(owner == currentOwner, "Only the assigned owner can be re-assigned when complete"); - - require(ISynthetixNamedContract(new_FeePool_contract).CONTRACT_NAME() == "FeePool", "Invalid contract supplied for FeePool"); - - // ACCEPT OWNERSHIP for all contracts that require ownership to make changes - acceptAll(); - - // MIGRATION - // Import all new contracts into the address resolver; - addressresolver_importAddresses_0(); - // Rebuild the resolver caches in all MixinResolver contracts - batch 1; - addressresolver_rebuildCaches_1(); - // Ensure the ProxyFeePool contract has the correct FeePool target set; - proxyfeepool_i.setTarget(Proxyable(new_FeePool_contract)); - // Ensure the FeePool contract can write to its EternalStorage; - feepooleternalstorage_i.setAssociatedContract(new_FeePool_contract); - // Ensure the FeePool contract can write to its State; - feepoolstate_i.setFeePool(IFeePool(new_FeePool_contract)); - // Import fee period from existing fee pool at index 0; - importFeePeriod_0(); - // Import fee period from existing fee pool at index 1; - importFeePeriod_1(); - - // NOMINATE OWNERSHIP back to owner for aforementioned contracts - nominateAll(); - } - - function acceptAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - Owned(contracts[i]).acceptOwnership(); - } - } - - function nominateAll() internal { - address[] memory contracts = contractsRequiringOwnership(); - for (uint i = 0; i < contracts.length; i++) { - returnOwnership(contracts[i]); - } - } - - - function addressresolver_importAddresses_0() internal { - bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](1); - addressresolver_importAddresses_names_0_0[0] = bytes32("FeePool"); - address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](1); - addressresolver_importAddresses_destinations_0_1[0] = address(new_FeePool_contract); - addressresolver_i.importAddresses(addressresolver_importAddresses_names_0_0, addressresolver_importAddresses_destinations_0_1); - } - - - function addressresolver_rebuildCaches_1() internal { - MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](11); - addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0x47eE58801C1AC44e54FF2651aE50525c5cfc66d0); - addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0xFe06fbe87E9f705B5D337D82dF8Fd812774974F9); - addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(0xA2412e0654CdD40F5677Aaad1a0c572e75dF246C); - addressresolver_rebuildCaches_destinations_1_0[3] = MixinResolver(0x27be2EFAd45DeBd732C1EBf5C9F7b49D498D4a93); - addressresolver_rebuildCaches_destinations_1_0[4] = MixinResolver(0x78aAA3fb165deCAA729DFE3cf0E97Ab6FCF484da); - addressresolver_rebuildCaches_destinations_1_0[5] = MixinResolver(0xBD2657CF89F930F27eE1854EF4B389773DF43b29); - addressresolver_rebuildCaches_destinations_1_0[6] = MixinResolver(0x8Ce809a955DB85b41e7A378D7659e348e0C6AdD2); - addressresolver_rebuildCaches_destinations_1_0[7] = MixinResolver(0xF33e7B48538C9D0480a48f3b5eEf79026e2a28f6); - addressresolver_rebuildCaches_destinations_1_0[8] = MixinResolver(0x308AD16ef90fe7caCb85B784A603CB6E71b1A41a); - addressresolver_rebuildCaches_destinations_1_0[9] = MixinResolver(0xEbCe9728E2fDdC26C9f4B00df5180BdC5e184953); - addressresolver_rebuildCaches_destinations_1_0[10] = MixinResolver(new_FeePool_contract); - addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0); - } - - - function importFeePeriod_0() internal { - // https://explorer.optimism.io/address/0xbc12131c93Da011B2844FA76c373A8cf5b0db4B5; - FeePool existingFeePool = FeePool(0xbc12131c93Da011B2844FA76c373A8cf5b0db4B5); - // https://explorer.optimism.io/address/0xFDf3Be612c65464AEB4859047350a6220F304F52; - FeePool newFeePool = FeePool(0xFDf3Be612c65464AEB4859047350a6220F304F52); - ( - uint64 feePeriodId_0, - uint64 startingDebtIndex_0, - uint64 startTime_0, - uint feesToDistribute_0, - uint feesClaimed_0, - uint rewardsToDistribute_0, - uint rewardsClaimed_0 - ) = existingFeePool.recentFeePeriods(0); - newFeePool.importFeePeriod( - 0, - feePeriodId_0, - startingDebtIndex_0, - startTime_0, - feesToDistribute_0, - feesClaimed_0, - rewardsToDistribute_0, - rewardsClaimed_0 - ); - } - - - function importFeePeriod_1() internal { - // https://explorer.optimism.io/address/0xbc12131c93Da011B2844FA76c373A8cf5b0db4B5; - FeePool existingFeePool = FeePool(0xbc12131c93Da011B2844FA76c373A8cf5b0db4B5); - // https://explorer.optimism.io/address/0xFDf3Be612c65464AEB4859047350a6220F304F52; - FeePool newFeePool = FeePool(0xFDf3Be612c65464AEB4859047350a6220F304F52); - ( - uint64 feePeriodId_1, - uint64 startingDebtIndex_1, - uint64 startTime_1, - uint feesToDistribute_1, - uint feesClaimed_1, - uint rewardsToDistribute_1, - uint rewardsClaimed_1 - ) = existingFeePool.recentFeePeriods(1); - newFeePool.importFeePeriod( - 1, - feePeriodId_1, - startingDebtIndex_1, - startTime_1, - feesToDistribute_1, - feesClaimed_1, - rewardsToDistribute_1, - rewardsClaimed_1 - ); - } -} diff --git a/hardhat.config.js b/hardhat.config.js index 34cf6e727e..86219e76ab 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -35,7 +35,6 @@ module.exports = { }, paths: { sources: './contracts', - ignore: /migrations\//, tests: './test/contracts', artifacts: path.join(BUILD_FOLDER, 'artifacts'), cache: path.join(BUILD_FOLDER, CACHE_FOLDER), diff --git a/hardhat/tasks/task-node.js b/hardhat/tasks/task-node.js index 1dbec4a4cc..c19372bee4 100644 --- a/hardhat/tasks/task-node.js +++ b/hardhat/tasks/task-node.js @@ -22,14 +22,12 @@ task('node', 'Run a node') if (network !== 'local') { const networkHostReplace = (taskArguments.useOvm ? 'optimism-' : '') + network; - if (network === 'mainnet') { - taskArguments.fork = process.env.PROVIDER_URL_MAINNET.replace( - 'network', - networkHostReplace - ); + if (network === 'mainnet' && !useOvm) { + taskArguments.fork = process.env.PROVIDER_URL_MAINNET; + } else { + taskArguments.fork = + taskArguments.fork || process.env.PROVIDER_URL.replace('network', networkHostReplace); } - taskArguments.fork = - taskArguments.fork || process.env.PROVIDER_URL.replace('network', networkHostReplace); console.log(yellow(`Forking ${network}...`)); } diff --git a/package-lock.json b/package-lock.json index aa0d3491a6..56f8d500a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "@pinata/sdk": "1.1.11", "@uniswap/token-lists": "^1.0.0-beta.11", "ajv": "^6.12.4", + "async": "3.2.3", "axios": "0.21.2", "bn.js": "4.11.8", "chai": "4.2.0", @@ -86,33 +87,33 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -121,9 +122,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", - "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", + "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", "dev": true, "optional": true, "dependencies": { @@ -1739,9 +1740,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.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", "funding": [ { "type": "individual", @@ -2139,9 +2140,9 @@ "dev": true }, "node_modules/@gnosis.pm/safe-deployments": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.7.0.tgz", - "integrity": "sha512-OWc73XDBOJzoDk7GAQsasOxHnXKdJdOb28Jkv+JNie2LlRwZe1SMCu0iTozhwpLFp4BC+iDtuVWN7EVpe142ag==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.8.0.tgz", + "integrity": "sha512-xK2ZZXxCEGOw+6UZAeUmvqE/4C/XTpYmv1a8KzKUgSOxcGkHsIDqcjdKjqif7gOdnwHl4+XXJUtDQEuSLT4Scg==", "dev": true }, "node_modules/@gnosis.pm/safe-service-client": { @@ -2223,6 +2224,16 @@ "@types/node": "*" } }, + "node_modules/@nomiclabs/ethereumjs-vm/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/@nomiclabs/ethereumjs-vm/node_modules/ethereumjs-util": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", @@ -2240,9 +2251,9 @@ } }, "node_modules/@nomiclabs/hardhat-ethers": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.3.tgz", - "integrity": "sha512-IJ0gBotVtO7YyLZyHNgbxzskUtFok+JkRlKPo8YELqj1ms9XL6Qm3vsfsGdZr22wnJeVEF5TQPotKuwQk21Dag==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.4.tgz", + "integrity": "sha512-7LMR344TkdCYkMVF9LuC9VU2NBIi84akQiwqm7OufpWaDgHbWhuanY53rk3SVAW0E4HBk5xn5wl5+bN5f+Mq5w==", "dev": true, "peerDependencies": { "ethers": "^5.0.0", @@ -2661,9 +2672,9 @@ } }, "node_modules/@truffle/abi-utils": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.5.tgz", - "integrity": "sha512-eKDIn9LqUFP8MnHVohe8ncuza4p9bszz1NtJWc+sr5zUogtmWnnf8Ajyj7JJpNKhLNDVZVbLowVEVxWzSSpMHw==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.6.tgz", + "integrity": "sha512-jF71kHK61/C1l42WtTGxFiOYmfsxsM1LuVcVrh2Qb3LkV1UjXP0dWTq8jOHNyy8oyAXoX0nTymBIgJDiOf7d0Q==", "dev": true, "optional": true, "dependencies": { @@ -2747,14 +2758,14 @@ } }, "node_modules/@truffle/compile-common": { - "version": "0.7.23", - "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.7.23.tgz", - "integrity": "sha512-LWzeboJ9HmSZVgx5DMmKArOo96V4QZhS/+8beDOfeNT1W4QeKfkuVbAM0R77cXjiLnUsNjjFVXehnco6HiF8ww==", + "version": "0.7.24", + "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.7.24.tgz", + "integrity": "sha512-iF3zjXhxcFVAYEZfQA6Rh2vxQ4xSuk/7pKm7yKlLh3p9WjFaPE+dF8wbgQoehftUnBh6SY91uZI6XiD4QDuxYQ==", "dev": true, "optional": true, "dependencies": { "@truffle/error": "^0.0.14", - "colors": "^1.4.0" + "colors": "1.4.0" } }, "node_modules/@truffle/compile-common/node_modules/@truffle/error": { @@ -2765,16 +2776,16 @@ "optional": true }, "node_modules/@truffle/contract": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/@truffle/contract/-/contract-4.4.1.tgz", - "integrity": "sha512-KVpG9alKxdNzWOcRN97crZXXmmnnShq1SkM9hQN2fOckszzrmy6ctOhnZKNAb8tzfHBgODDCmiGQbTqaYizcrA==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/@truffle/contract/-/contract-4.4.3.tgz", + "integrity": "sha512-mydxiO8Qr8mSQ857vYQa80JckAmTHsc3u8MjFQZsFyuarHMQzUOwDlZa0KZS8sAQ8vTmFPn1aJbeNncqY/TFBQ==", "dev": true, "optional": true, "dependencies": { "@ensdomains/ensjs": "^2.0.1", "@truffle/blockchain-utils": "^0.0.31", "@truffle/contract-schema": "^3.4.4", - "@truffle/debug-utils": "^6.0.2", + "@truffle/debug-utils": "^6.0.4", "@truffle/error": "^0.0.14", "@truffle/interface-adapter": "^0.5.8", "bignumber.js": "^7.2.1", @@ -2823,14 +2834,14 @@ "optional": true }, "node_modules/@truffle/contract/node_modules/@truffle/codec": { - "version": "0.11.21", - "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.11.21.tgz", - "integrity": "sha512-ZDzaEPCUFWmQuFsXA3KzXmU4w4lpxSWZTGUcEDHxn6IqAmL7FY8mmdbR6LQ1wTRAa9oPf84PcehMpTNY47HVcg==", + "version": "0.11.22", + "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.11.22.tgz", + "integrity": "sha512-dp6ilchlLOBPGyezSBUO7ozHcShRpg6EvOgV9LLJ34/jJwOcnp7WOR9HTyxve93urgaAcg9ol/tTtBk4pz0/6A==", "dev": true, "optional": true, "dependencies": { - "@truffle/abi-utils": "^0.2.5", - "@truffle/compile-common": "^0.7.23", + "@truffle/abi-utils": "^0.2.6", + "@truffle/compile-common": "^0.7.24", "big.js": "^5.2.2", "bn.js": "^5.1.3", "cbor": "^5.1.0", @@ -2845,18 +2856,18 @@ } }, "node_modules/@truffle/contract/node_modules/@truffle/debug-utils": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@truffle/debug-utils/-/debug-utils-6.0.2.tgz", - "integrity": "sha512-gMZ2IHPS9cvWGinUwVMoZedOYJz4sSekUXGC5FQkBnR0XDVriPmuja4rdgXhkA9EFSqZdXu4JAL8IiEHp/1YIw==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@truffle/debug-utils/-/debug-utils-6.0.4.tgz", + "integrity": "sha512-T+GRns1RCsjRa9N3o/DMcnKBszrz5DPqMssoK3fQOut9Gse2CvpQlslc+S2xQZ6NAwSC0qmnN3UiIiPgcUGxUg==", "dev": true, "optional": true, "dependencies": { - "@truffle/codec": "^0.11.21", + "@truffle/codec": "^0.11.22", "@trufflesuite/chromafi": "^2.2.2", "bn.js": "^5.1.3", "chalk": "^2.4.2", "debug": "^4.3.1", - "highlightjs-solidity": "^2.0.2" + "highlightjs-solidity": "^2.0.3" } }, "node_modules/@truffle/contract/node_modules/@truffle/error": { @@ -2889,9 +2900,9 @@ } }, "node_modules/@truffle/contract/node_modules/@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true, "optional": true }, @@ -2958,9 +2969,9 @@ } }, "node_modules/@truffle/contract/node_modules/highlightjs-solidity": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/highlightjs-solidity/-/highlightjs-solidity-2.0.2.tgz", - "integrity": "sha512-q0aYUKiZ9MPQg41qx/KpXKaCpqql50qTvmwGYyLFfcjt9AE/+C9CwjVIdJZc7EYj6NGgJuFJ4im1gfgrzUU1fQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/highlightjs-solidity/-/highlightjs-solidity-2.0.3.tgz", + "integrity": "sha512-tjFm5dtIE61VQBzjlZmkCtY5fLs3CaEABbVuUNyXeW+UuOCsxMg3MsPFy0kCelHP74hPpkoqDejLrbnV1axAIw==", "dev": true, "optional": true }, @@ -3487,9 +3498,9 @@ } }, "node_modules/@truffle/interface-adapter/node_modules/@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "node_modules/@truffle/interface-adapter/node_modules/bignumber.js": { @@ -4019,9 +4030,9 @@ } }, "node_modules/@truffle/provider/node_modules/@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "node_modules/@truffle/provider/node_modules/bignumber.js": { @@ -4511,9 +4522,9 @@ } }, "node_modules/@types/abstract-leveldown": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-5.0.2.tgz", - "integrity": "sha512-+jA1XXF3jsz+Z7FcuiNqgK53hTa/luglT2TyTpKPqoYbxVY+mCPF22Rm+q3KPBrMHJwNXFrTViHszBOfU4vftQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ==", "dev": true }, "node_modules/@types/bignumber.js": { @@ -4604,9 +4615,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==" + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==" }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -5392,13 +5403,10 @@ } }, "node_modules/async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dev": true, - "dependencies": { - "lodash": "^4.17.14" - } + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "dev": true }, "node_modules/async-each": { "version": "1.0.3", @@ -5416,6 +5424,15 @@ "async": "^2.4.0" } }, + "node_modules/async-eventemitter/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", @@ -5918,9 +5935,9 @@ } }, "node_modules/bufferutil": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", - "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", + "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -6792,23 +6809,17 @@ } }, "node_modules/content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dev": true, "dependencies": { - "safe-buffer": "5.1.2" + "safe-buffer": "5.2.1" }, "engines": { "node": ">= 0.6" } }, - "node_modules/content-disposition/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "node_modules/content-hash": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/content-hash/-/content-hash-2.5.2.tgz", @@ -6874,9 +6885,9 @@ } }, "node_modules/core-js-pure": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.20.0.tgz", - "integrity": "sha512-qsrbIwWSEEYOM7z616jAVgwhuDDtPLwZSpUsU3vyUkHYqKTf/uwOJBZg2V7lMurYWkpVlaVOxBrfX0Q3ppvjfg==", + "version": "3.20.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.20.2.tgz", + "integrity": "sha512-CmWHvSKn2vNL6p6StNp1EmMIfVY/pqn3JLAjfZQ8WZGPOlGoO92EkX9/Mk81i6GxvoPXjUqEQnpM3rJ5QxxIOg==", "dev": true, "hasInstallScript": true, "funding": { @@ -7032,9 +7043,9 @@ } }, "node_modules/css-select": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.0.tgz", - "integrity": "sha512-6YVG6hsH9yIb/si3Th/is8Pex7qnVHO6t7q7U6TIUnkQASGbS8tnUDBftnPynLNnuUl/r2+PTd0ekiiq7R0zJw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz", + "integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==", "dependencies": { "boolbase": "^1.0.0", "css-what": "^5.1.0", @@ -7086,9 +7097,9 @@ } }, "node_modules/date-fns": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.27.0.tgz", - "integrity": "sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q==", + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz", + "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==", "dev": true, "engines": { "node": ">=0.11" @@ -8104,14 +8115,13 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", - "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.2.tgz", + "integrity": "sha512-zquepFnWCY2ISMFwD/DqzaM++H+7PDzOpUvotJWm/y1BAFt5R4oeULgdrTejKqLkz7MA/tgstsUMNYc7wNdTrg==", "dev": true, "dependencies": { "debug": "^3.2.7", - "find-up": "^2.1.0", - "pkg-dir": "^2.0.0" + "find-up": "^2.1.0" }, "engines": { "node": ">=4" @@ -8242,9 +8252,9 @@ } }, "node_modules/eslint-plugin-node/node_modules/ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -8548,15 +8558,15 @@ "dev": true }, "node_modules/eth-gas-reporter": { - "version": "0.2.23", - "resolved": "https://registry.npmjs.org/eth-gas-reporter/-/eth-gas-reporter-0.2.23.tgz", - "integrity": "sha512-T8KsVakDEupvQxW3MfFfHDfJ7y8zl2+XhyEQk4hZ3qQsAh/FE27BfFHM9UhqNQvrJLz8zVWnPZWNcARwLT/lsA==", + "version": "0.2.24", + "resolved": "https://registry.npmjs.org/eth-gas-reporter/-/eth-gas-reporter-0.2.24.tgz", + "integrity": "sha512-RbXLC2bnuPHzIMU/rnLXXlb6oiHEEKu7rq2UrAX/0mfo0Lzrr/kb9QTjWjfz8eNvc+uu6J8AuBwI++b+MLNI2w==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.0.0-beta.146", "@solidity-parser/parser": "^0.14.0", "cli-table3": "^0.5.0", - "colors": "^1.1.2", + "colors": "1.4.0", "ethereumjs-util": "6.2.0", "ethers": "^4.0.40", "fs-readdir-recursive": "^1.1.0", @@ -9059,6 +9069,16 @@ "miller-rabin": "^4.0.0" } }, + "node_modules/ethashjs/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/ethereum-bloom-filters": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", @@ -9207,6 +9227,16 @@ "xtend": "~4.0.0" } }, + "node_modules/ethereumjs-block/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/ethereumjs-block/node_modules/deferred-leveldown": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz", @@ -9493,6 +9523,16 @@ "@types/node": "*" } }, + "node_modules/ethereumjs-blockchain/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/ethereumjs-blockchain/node_modules/ethereumjs-util": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", @@ -9553,6 +9593,16 @@ "node": ">=0.10.0" } }, + "node_modules/ethereumjs-testrpc/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "optional": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/ethereumjs-testrpc/node_modules/cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -10829,17 +10879,17 @@ } }, "node_modules/express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", + "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", "dev": true, "dependencies": { "accepts": "~1.3.7", "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", + "body-parser": "1.19.1", + "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "~1.1.2", @@ -10853,13 +10903,13 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", + "proxy-addr": "~2.0.7", + "qs": "6.9.6", "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", "statuses": "~1.5.0", "type-is": "~1.6.18", "utils-merge": "1.0.1", @@ -10869,45 +10919,6 @@ "node": ">= 0.10.0" } }, - "node_modules/express/node_modules/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "dev": true, - "dependencies": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/express/node_modules/bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/express/node_modules/cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/express/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -10917,28 +10928,6 @@ "ms": "2.0.0" } }, - "node_modules/express/node_modules/http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "dev": true, - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, "node_modules/express/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -10946,48 +10935,15 @@ "dev": true }, "node_modules/express/node_modules/qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "version": "6.9.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", + "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", "dev": true, "engines": { "node": ">=0.6" - } - }, - "node_modules/express/node_modules/raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "dev": true, - "dependencies": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/express/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/express/node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", - "dev": true - }, - "node_modules/express/node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "dev": true, - "engines": { - "node": ">=0.6" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/ext": { @@ -11116,9 +11072,9 @@ "optional": true }, "node_modules/fast-check": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-2.20.0.tgz", - "integrity": "sha512-tFNjLyPnOUg6iimVxOtoWMJOIyybCo7B8gUGm1yv43jDCQ0hlPUn0fmna/XO/n1yPxn/dxQw3+IygPSbMDiiog==", + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-2.21.0.tgz", + "integrity": "sha512-hkTRytqMceXfnSwPnryIqKkxKJjfcvtVqJrWRb8tgmfyUsGajIgQqDFxCJ+As+l9VLUCcmx6XIYoXeQe2Ih0UA==", "dev": true, "optional": true, "dependencies": { @@ -11145,9 +11101,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.10", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.10.tgz", + "integrity": "sha512-s9nFhFnvR63wls6/kM88kQqDhMu0AfdjqouE2l5GVQPbqLgyFjjU5ry/r2yKsJxpb9Py1EYNqieFrmMaX4v++A==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -11157,7 +11113,7 @@ "micromatch": "^4.0.4" }, "engines": { - "node": ">=8" + "node": ">=8.6.0" } }, "node_modules/fast-json-stable-stringify": { @@ -11612,9 +11568,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.14.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", - "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", + "version": "1.14.7", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", + "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==", "dev": true, "funding": [ { @@ -13146,9 +13102,9 @@ } }, "node_modules/globby/node_modules/ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -13189,9 +13145,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", "dev": true }, "node_modules/growl": { @@ -13318,13 +13274,13 @@ } }, "node_modules/hardhat-gas-reporter": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.6.tgz", - "integrity": "sha512-LlCEmSx1dZpnxKmODb2hmP5eJ1IAM5It3NnBNTUpBTxn9g9qPPI3JQTxj8AbGEiNc3r6V+w/mXYCmiC8pWvnoQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.7.tgz", + "integrity": "sha512-calJH1rbhUFwCnw0odJb3Cw+mDmBIsHdVyutsHhA3RY6JELyFVaVxCnITYGr/crkmHqt4tQCYROy7ty6DTLkuA==", "dev": true, "dependencies": { "array-uniq": "1.0.3", - "eth-gas-reporter": "^0.2.23", + "eth-gas-reporter": "^0.2.24", "sha1": "^1.1.1" }, "peerDependencies": { @@ -13451,9 +13407,9 @@ } }, "node_modules/hardhat-interact/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.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.2.tgz", + "integrity": "sha512-hkbx7x/MKcRjyrO4StKXCzCpWer6s97xnm34xkfPiarhtEUVAN4TBBpamM+z66WcTt7H5B53YwbRj1n7i8pZoQ==", "dev": true, "funding": [ { @@ -13488,9 +13444,9 @@ } }, "node_modules/hardhat-interact/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.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.1.tgz", + "integrity": "sha512-YaU2dQ7DuhL5Au7KbcQLHxcRHfgyNgvFV4sQOo0HrtW3Zkrc9ctWNz8wXQ4uCSfSDsqX2vcjhroxU5RQRV0nqA==", "dev": true, "funding": [ { @@ -13688,9 +13644,9 @@ "dev": true }, "node_modules/hardhat-interact/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.5.3", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.3.tgz", + "integrity": "sha512-fTT4WT8/hTe/BLwRUtl7I5zlpF3XC3P/Xwqxc5AIP2HGlH15qpmjs0Ou78az93b1rLITzXLFxoNX63B8ZbUd7g==", "dev": true, "funding": [ { @@ -13718,11 +13674,11 @@ "@ethersproject/json-wallets": "5.5.0", "@ethersproject/keccak256": "5.5.0", "@ethersproject/logger": "5.5.0", - "@ethersproject/networks": "5.5.1", + "@ethersproject/networks": "5.5.2", "@ethersproject/pbkdf2": "5.5.0", "@ethersproject/properties": "5.5.0", - "@ethersproject/providers": "5.5.1", - "@ethersproject/random": "5.5.0", + "@ethersproject/providers": "5.5.2", + "@ethersproject/random": "5.5.1", "@ethersproject/rlp": "5.5.0", "@ethersproject/sha2": "5.5.0", "@ethersproject/signing-key": "5.5.0", @@ -14777,22 +14733,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/husky/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/husky/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -14802,72 +14742,6 @@ "node": ">=8" } }, - "node_modules/husky/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/husky/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/husky/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/husky/node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/husky/node_modules/pkg-dir": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", - "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", - "dev": true, - "dependencies": { - "find-up": "^5.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/husky/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -15348,9 +15222,9 @@ } }, "node_modules/is-core-module": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", - "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -16838,6 +16712,16 @@ "semaphore": ">=1.0.1" } }, + "node_modules/merkle-patricia-tree/node_modules/async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/merkle-patricia-tree/node_modules/ethereumjs-util": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz", @@ -18005,9 +17889,9 @@ } }, "node_modules/object-inspect": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.1.tgz", - "integrity": "sha512-If7BjFlpkzzBeV1cqgT3OSWT3azyoxDGajR+iGnFBfVV2EWyDyWaZZW2ERDjUaY2QM8i5jI3Sj7mhsM4DDAqWA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -18549,9 +18433,9 @@ "dev": true }, "node_modules/picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, "engines": { "node": ">=8.6" @@ -18593,15 +18477,85 @@ } }, "node_modules/pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", "dev": true, "dependencies": { - "find-up": "^2.1.0" + "find-up": "^5.0.0" }, "engines": { - "node": ">=4" + "node": ">=10" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" } }, "node_modules/please-upgrade-node": { @@ -18850,9 +18804,9 @@ } }, "node_modules/pretty-quick/node_modules/ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -19116,9 +19070,9 @@ } }, "node_modules/qs": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.2.tgz", - "integrity": "sha512-mSIdjzqznWgfd4pMii7sHtaYF8rx8861hBO80SraY5GT0XQibWZWJSid0avzHGkDIZLImux2S5mXO0Hfct2QCw==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", "dev": true, "dependencies": { "side-channel": "^1.0.4" @@ -19617,9 +19571,9 @@ } }, "node_modules/request/node_modules/qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "dev": true, "engines": { "node": ">=0.6" @@ -19650,13 +19604,17 @@ "dev": true }, "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", "dev": true, "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -20087,12 +20045,12 @@ "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, "node_modules/secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "hasInstallScript": true, "dependencies": { - "elliptic": "^6.5.2", + "elliptic": "^6.5.4", "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0" }, @@ -20150,9 +20108,9 @@ } }, "node_modules/send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "dev": true, "dependencies": { "debug": "2.6.9", @@ -20162,9 +20120,9 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" @@ -20188,43 +20146,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "node_modules/send/node_modules/http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", - "dev": true, - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "node_modules/send/node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", - "dev": true - }, - "node_modules/send/node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, "node_modules/sentence-case": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-2.1.1.tgz", @@ -20246,15 +20167,15 @@ } }, "node_modules/serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "dev": true, "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" }, "engines": { "node": ">= 0.8.0" @@ -20411,9 +20332,9 @@ } }, "node_modules/shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "dependencies": { "glob": "^7.0.0", @@ -21326,6 +21247,7 @@ "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", "dev": true, "dependencies": { "atob": "^2.1.2", @@ -21358,6 +21280,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", + "deprecated": "See https://github.com/lydell/source-map-url#deprecated", "dev": true }, "node_modules/spawn-command": { @@ -21417,9 +21340,9 @@ "dev": true }, "node_modules/sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, "dependencies": { "asn1": "~0.2.3", @@ -21872,6 +21795,18 @@ "node": ">=0.10.0" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/swap-case": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz", @@ -22871,9 +22806,9 @@ } }, "node_modules/utf-8-validate": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", - "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.8.tgz", + "integrity": "sha512-k4dW/Qja1BYDl2qD4tOMB9PFVha/UJtxTc1cXYOe3WwA/2m0Yn4qB7wLMpJyLJ/7DR0XnTut3HsCSzDT4ZvKgA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -23395,9 +23330,9 @@ } }, "node_modules/web3-bzz/node_modules/@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "node_modules/web3-bzz/node_modules/underscore": { @@ -23754,9 +23689,9 @@ } }, "node_modules/web3-core/node_modules/@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "node_modules/web3-core/node_modules/bignumber.js": { @@ -24343,9 +24278,9 @@ } }, "node_modules/web3-eth-personal/node_modules/@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "node_modules/web3-eth-personal/node_modules/bn.js": { @@ -29271,35 +29206,35 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.16.7" } }, "@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true }, "@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } }, "@babel/runtime": { - "version": "7.16.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", - "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", + "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", "dev": true, "optional": true, "requires": { @@ -30596,9 +30531,9 @@ "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" }, "@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.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", "requires": { "@ethersproject/logger": "^5.5.0" } @@ -30841,9 +30776,9 @@ "dev": true }, "@gnosis.pm/safe-deployments": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.7.0.tgz", - "integrity": "sha512-OWc73XDBOJzoDk7GAQsasOxHnXKdJdOb28Jkv+JNie2LlRwZe1SMCu0iTozhwpLFp4BC+iDtuVWN7EVpe142ag==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@gnosis.pm/safe-deployments/-/safe-deployments-1.8.0.tgz", + "integrity": "sha512-xK2ZZXxCEGOw+6UZAeUmvqE/4C/XTpYmv1a8KzKUgSOxcGkHsIDqcjdKjqif7gOdnwHl4+XXJUtDQEuSLT4Scg==", "dev": true }, "@gnosis.pm/safe-service-client": { @@ -30916,6 +30851,16 @@ "@types/node": "*" } }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "requires": { + "lodash": "^4.17.14" + } + }, "ethereumjs-util": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", @@ -30935,9 +30880,9 @@ } }, "@nomiclabs/hardhat-ethers": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.3.tgz", - "integrity": "sha512-IJ0gBotVtO7YyLZyHNgbxzskUtFok+JkRlKPo8YELqj1ms9XL6Qm3vsfsGdZr22wnJeVEF5TQPotKuwQk21Dag==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.4.tgz", + "integrity": "sha512-7LMR344TkdCYkMVF9LuC9VU2NBIi84akQiwqm7OufpWaDgHbWhuanY53rk3SVAW0E4HBk5xn5wl5+bN5f+Mq5w==", "dev": true, "requires": {} }, @@ -31312,9 +31257,9 @@ } }, "@truffle/abi-utils": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.5.tgz", - "integrity": "sha512-eKDIn9LqUFP8MnHVohe8ncuza4p9bszz1NtJWc+sr5zUogtmWnnf8Ajyj7JJpNKhLNDVZVbLowVEVxWzSSpMHw==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.6.tgz", + "integrity": "sha512-jF71kHK61/C1l42WtTGxFiOYmfsxsM1LuVcVrh2Qb3LkV1UjXP0dWTq8jOHNyy8oyAXoX0nTymBIgJDiOf7d0Q==", "dev": true, "optional": true, "requires": { @@ -31394,14 +31339,14 @@ } }, "@truffle/compile-common": { - "version": "0.7.23", - "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.7.23.tgz", - "integrity": "sha512-LWzeboJ9HmSZVgx5DMmKArOo96V4QZhS/+8beDOfeNT1W4QeKfkuVbAM0R77cXjiLnUsNjjFVXehnco6HiF8ww==", + "version": "0.7.24", + "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.7.24.tgz", + "integrity": "sha512-iF3zjXhxcFVAYEZfQA6Rh2vxQ4xSuk/7pKm7yKlLh3p9WjFaPE+dF8wbgQoehftUnBh6SY91uZI6XiD4QDuxYQ==", "dev": true, "optional": true, "requires": { "@truffle/error": "^0.0.14", - "colors": "^1.4.0" + "colors": "1.4.0" }, "dependencies": { "@truffle/error": { @@ -31414,16 +31359,16 @@ } }, "@truffle/contract": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/@truffle/contract/-/contract-4.4.1.tgz", - "integrity": "sha512-KVpG9alKxdNzWOcRN97crZXXmmnnShq1SkM9hQN2fOckszzrmy6ctOhnZKNAb8tzfHBgODDCmiGQbTqaYizcrA==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/@truffle/contract/-/contract-4.4.3.tgz", + "integrity": "sha512-mydxiO8Qr8mSQ857vYQa80JckAmTHsc3u8MjFQZsFyuarHMQzUOwDlZa0KZS8sAQ8vTmFPn1aJbeNncqY/TFBQ==", "dev": true, "optional": true, "requires": { "@ensdomains/ensjs": "^2.0.1", "@truffle/blockchain-utils": "^0.0.31", "@truffle/contract-schema": "^3.4.4", - "@truffle/debug-utils": "^6.0.2", + "@truffle/debug-utils": "^6.0.4", "@truffle/error": "^0.0.14", "@truffle/interface-adapter": "^0.5.8", "bignumber.js": "^7.2.1", @@ -31462,14 +31407,14 @@ "optional": true }, "@truffle/codec": { - "version": "0.11.21", - "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.11.21.tgz", - "integrity": "sha512-ZDzaEPCUFWmQuFsXA3KzXmU4w4lpxSWZTGUcEDHxn6IqAmL7FY8mmdbR6LQ1wTRAa9oPf84PcehMpTNY47HVcg==", + "version": "0.11.22", + "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.11.22.tgz", + "integrity": "sha512-dp6ilchlLOBPGyezSBUO7ozHcShRpg6EvOgV9LLJ34/jJwOcnp7WOR9HTyxve93urgaAcg9ol/tTtBk4pz0/6A==", "dev": true, "optional": true, "requires": { - "@truffle/abi-utils": "^0.2.5", - "@truffle/compile-common": "^0.7.23", + "@truffle/abi-utils": "^0.2.6", + "@truffle/compile-common": "^0.7.24", "big.js": "^5.2.2", "bn.js": "^5.1.3", "cbor": "^5.1.0", @@ -31484,18 +31429,18 @@ } }, "@truffle/debug-utils": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@truffle/debug-utils/-/debug-utils-6.0.2.tgz", - "integrity": "sha512-gMZ2IHPS9cvWGinUwVMoZedOYJz4sSekUXGC5FQkBnR0XDVriPmuja4rdgXhkA9EFSqZdXu4JAL8IiEHp/1YIw==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@truffle/debug-utils/-/debug-utils-6.0.4.tgz", + "integrity": "sha512-T+GRns1RCsjRa9N3o/DMcnKBszrz5DPqMssoK3fQOut9Gse2CvpQlslc+S2xQZ6NAwSC0qmnN3UiIiPgcUGxUg==", "dev": true, "optional": true, "requires": { - "@truffle/codec": "^0.11.21", + "@truffle/codec": "^0.11.22", "@trufflesuite/chromafi": "^2.2.2", "bn.js": "^5.1.3", "chalk": "^2.4.2", "debug": "^4.3.1", - "highlightjs-solidity": "^2.0.2" + "highlightjs-solidity": "^2.0.3" } }, "@truffle/error": { @@ -31528,9 +31473,9 @@ } }, "@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true, "optional": true }, @@ -31601,9 +31546,9 @@ } }, "highlightjs-solidity": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/highlightjs-solidity/-/highlightjs-solidity-2.0.2.tgz", - "integrity": "sha512-q0aYUKiZ9MPQg41qx/KpXKaCpqql50qTvmwGYyLFfcjt9AE/+C9CwjVIdJZc7EYj6NGgJuFJ4im1gfgrzUU1fQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/highlightjs-solidity/-/highlightjs-solidity-2.0.3.tgz", + "integrity": "sha512-tjFm5dtIE61VQBzjlZmkCtY5fLs3CaEABbVuUNyXeW+UuOCsxMg3MsPFy0kCelHP74hPpkoqDejLrbnV1axAIw==", "dev": true, "optional": true }, @@ -32067,9 +32012,9 @@ } }, "@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "bignumber.js": { @@ -32537,9 +32482,9 @@ } }, "@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "bignumber.js": { @@ -32966,9 +32911,9 @@ } }, "@types/abstract-leveldown": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-5.0.2.tgz", - "integrity": "sha512-+jA1XXF3jsz+Z7FcuiNqgK53hTa/luglT2TyTpKPqoYbxVY+mCPF22Rm+q3KPBrMHJwNXFrTViHszBOfU4vftQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ==", "dev": true }, "@types/bignumber.js": { @@ -33058,9 +33003,9 @@ "dev": true }, "@types/node": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.0.tgz", - "integrity": "sha512-eMhwJXc931Ihh4tkU+Y7GiLzT/y/DBNpNtr4yU9O2w3SYBsr9NaOPhQlLKRmoWtI54uNwuo0IOUFQjVOTZYRvw==" + "version": "17.0.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.8.tgz", + "integrity": "sha512-YofkM6fGv4gDJq78g4j0mMuGMkZVxZDgtU0JRdx6FgiJDG+0fY0GKVolOV8WqVmEhLCXkQRjwDdKyPxJp/uucg==" }, "@types/parse-json": { "version": "4.0.0", @@ -33724,13 +33669,10 @@ "dev": true }, "async": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", - "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dev": true, - "requires": { - "lodash": "^4.17.14" - } + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "dev": true }, "async-each": { "version": "1.0.3", @@ -33746,6 +33688,17 @@ "dev": true, "requires": { "async": "^2.4.0" + }, + "dependencies": { + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + } } }, "async-limiter": { @@ -34182,9 +34135,9 @@ } }, "bufferutil": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", - "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.6.tgz", + "integrity": "sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw==", "dev": true, "requires": { "node-gyp-build": "^4.3.0" @@ -34920,20 +34873,12 @@ "dev": true }, "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dev": true, "requires": { - "safe-buffer": "5.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } + "safe-buffer": "5.2.1" } }, "content-hash": { @@ -34992,9 +34937,9 @@ "dev": true }, "core-js-pure": { - "version": "3.20.0", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.20.0.tgz", - "integrity": "sha512-qsrbIwWSEEYOM7z616jAVgwhuDDtPLwZSpUsU3vyUkHYqKTf/uwOJBZg2V7lMurYWkpVlaVOxBrfX0Q3ppvjfg==", + "version": "3.20.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.20.2.tgz", + "integrity": "sha512-CmWHvSKn2vNL6p6StNp1EmMIfVY/pqn3JLAjfZQ8WZGPOlGoO92EkX9/Mk81i6GxvoPXjUqEQnpM3rJ5QxxIOg==", "dev": true }, "core-util-is": { @@ -35124,9 +35069,9 @@ } }, "css-select": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.0.tgz", - "integrity": "sha512-6YVG6hsH9yIb/si3Th/is8Pex7qnVHO6t7q7U6TIUnkQASGbS8tnUDBftnPynLNnuUl/r2+PTd0ekiiq7R0zJw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz", + "integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==", "requires": { "boolbase": "^1.0.0", "css-what": "^5.1.0", @@ -35166,9 +35111,9 @@ } }, "date-fns": { - "version": "2.27.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.27.0.tgz", - "integrity": "sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q==", + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz", + "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==", "dev": true }, "death": { @@ -36074,14 +36019,13 @@ } }, "eslint-module-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", - "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.2.tgz", + "integrity": "sha512-zquepFnWCY2ISMFwD/DqzaM++H+7PDzOpUvotJWm/y1BAFt5R4oeULgdrTejKqLkz7MA/tgstsUMNYc7wNdTrg==", "dev": true, "requires": { "debug": "^3.2.7", - "find-up": "^2.1.0", - "pkg-dir": "^2.0.0" + "find-up": "^2.1.0" }, "dependencies": { "debug": { @@ -36186,9 +36130,9 @@ }, "dependencies": { "ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "semver": { @@ -36335,15 +36279,15 @@ } }, "eth-gas-reporter": { - "version": "0.2.23", - "resolved": "https://registry.npmjs.org/eth-gas-reporter/-/eth-gas-reporter-0.2.23.tgz", - "integrity": "sha512-T8KsVakDEupvQxW3MfFfHDfJ7y8zl2+XhyEQk4hZ3qQsAh/FE27BfFHM9UhqNQvrJLz8zVWnPZWNcARwLT/lsA==", + "version": "0.2.24", + "resolved": "https://registry.npmjs.org/eth-gas-reporter/-/eth-gas-reporter-0.2.24.tgz", + "integrity": "sha512-RbXLC2bnuPHzIMU/rnLXXlb6oiHEEKu7rq2UrAX/0mfo0Lzrr/kb9QTjWjfz8eNvc+uu6J8AuBwI++b+MLNI2w==", "dev": true, "requires": { "@ethersproject/abi": "^5.0.0-beta.146", "@solidity-parser/parser": "^0.14.0", "cli-table3": "^0.5.0", - "colors": "^1.1.2", + "colors": "1.4.0", "ethereumjs-util": "6.2.0", "ethers": "^4.0.40", "fs-readdir-recursive": "^1.1.0", @@ -36755,6 +36699,18 @@ "buffer-xor": "^2.0.1", "ethereumjs-util": "^7.0.2", "miller-rabin": "^4.0.0" + }, + "dependencies": { + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "requires": { + "lodash": "^4.17.14" + } + } } }, "ethereum-bloom-filters": { @@ -36909,6 +36865,16 @@ "xtend": "~4.0.0" } }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "requires": { + "lodash": "^4.17.14" + } + }, "deferred-leveldown": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz", @@ -37198,6 +37164,16 @@ "@types/node": "*" } }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "requires": { + "lodash": "^4.17.14" + } + }, "ethereumjs-util": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", @@ -37246,6 +37222,16 @@ "dev": true, "optional": true }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "optional": true, + "requires": { + "lodash": "^4.17.14" + } + }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -38194,17 +38180,17 @@ } }, "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", + "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", "dev": true, "requires": { "accepts": "~1.3.7", "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", + "body-parser": "1.19.1", + "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "~1.1.2", @@ -38218,49 +38204,19 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", + "proxy-addr": "~2.0.7", + "qs": "6.9.6", "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", "statuses": "~1.5.0", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" }, "dependencies": { - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "dev": true, - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - } - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "dev": true - }, - "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "dev": true - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -38270,25 +38226,6 @@ "ms": "2.0.0" } }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -38296,39 +38233,9 @@ "dev": true }, "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "dev": true - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "dev": true, - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", - "dev": true - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "version": "6.9.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", + "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", "dev": true } } @@ -38442,9 +38349,9 @@ "optional": true }, "fast-check": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-2.20.0.tgz", - "integrity": "sha512-tFNjLyPnOUg6iimVxOtoWMJOIyybCo7B8gUGm1yv43jDCQ0hlPUn0fmna/XO/n1yPxn/dxQw3+IygPSbMDiiog==", + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-2.21.0.tgz", + "integrity": "sha512-hkTRytqMceXfnSwPnryIqKkxKJjfcvtVqJrWRb8tgmfyUsGajIgQqDFxCJ+As+l9VLUCcmx6XIYoXeQe2Ih0UA==", "dev": true, "optional": true, "requires": { @@ -38464,9 +38371,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.10", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.10.tgz", + "integrity": "sha512-s9nFhFnvR63wls6/kM88kQqDhMu0AfdjqouE2l5GVQPbqLgyFjjU5ry/r2yKsJxpb9Py1EYNqieFrmMaX4v++A==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -38861,9 +38768,9 @@ } }, "follow-redirects": { - "version": "1.14.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", - "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", + "version": "1.14.7", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", + "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==", "dev": true }, "for-each": { @@ -40025,9 +39932,9 @@ }, "dependencies": { "ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true } } @@ -40063,9 +39970,9 @@ } }, "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "version": "4.2.9", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==", "dev": true }, "growl": { @@ -40634,13 +40541,13 @@ } }, "hardhat-gas-reporter": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.6.tgz", - "integrity": "sha512-LlCEmSx1dZpnxKmODb2hmP5eJ1IAM5It3NnBNTUpBTxn9g9qPPI3JQTxj8AbGEiNc3r6V+w/mXYCmiC8pWvnoQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.7.tgz", + "integrity": "sha512-calJH1rbhUFwCnw0odJb3Cw+mDmBIsHdVyutsHhA3RY6JELyFVaVxCnITYGr/crkmHqt4tQCYROy7ty6DTLkuA==", "dev": true, "requires": { "array-uniq": "1.0.3", - "eth-gas-reporter": "^0.2.23", + "eth-gas-reporter": "^0.2.24", "sha1": "^1.1.1" } }, @@ -40720,9 +40627,9 @@ } }, "@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.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.2.tgz", + "integrity": "sha512-hkbx7x/MKcRjyrO4StKXCzCpWer6s97xnm34xkfPiarhtEUVAN4TBBpamM+z66WcTt7H5B53YwbRj1n7i8pZoQ==", "dev": true, "requires": { "@ethersproject/abstract-provider": "^5.5.0", @@ -40747,9 +40654,9 @@ } }, "@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.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.1.tgz", + "integrity": "sha512-YaU2dQ7DuhL5Au7KbcQLHxcRHfgyNgvFV4sQOo0HrtW3Zkrc9ctWNz8wXQ4uCSfSDsqX2vcjhroxU5RQRV0nqA==", "dev": true, "requires": { "@ethersproject/bytes": "^5.5.0", @@ -40872,9 +40779,9 @@ "dev": true }, "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.5.3", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.3.tgz", + "integrity": "sha512-fTT4WT8/hTe/BLwRUtl7I5zlpF3XC3P/Xwqxc5AIP2HGlH15qpmjs0Ou78az93b1rLITzXLFxoNX63B8ZbUd7g==", "dev": true, "requires": { "@ethersproject/abi": "5.5.0", @@ -40892,11 +40799,11 @@ "@ethersproject/json-wallets": "5.5.0", "@ethersproject/keccak256": "5.5.0", "@ethersproject/logger": "5.5.0", - "@ethersproject/networks": "5.5.1", + "@ethersproject/networks": "5.5.2", "@ethersproject/pbkdf2": "5.5.0", "@ethersproject/properties": "5.5.0", - "@ethersproject/providers": "5.5.1", - "@ethersproject/random": "5.5.0", + "@ethersproject/providers": "5.5.2", + "@ethersproject/random": "5.5.1", "@ethersproject/rlp": "5.5.0", "@ethersproject/sha2": "5.5.0", "@ethersproject/signing-key": "5.5.0", @@ -41257,64 +41164,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, "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 }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", - "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", - "dev": true, - "requires": { - "find-up": "^5.0.0" - } - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -41658,9 +41513,9 @@ } }, "is-core-module": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", - "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", "dev": true, "requires": { "has": "^1.0.3" @@ -42866,6 +42721,16 @@ "semaphore": ">=1.0.1" }, "dependencies": { + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "peer": true, + "requires": { + "lodash": "^4.17.14" + } + }, "ethereumjs-util": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz", @@ -43824,9 +43689,9 @@ } }, "object-inspect": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.1.tgz", - "integrity": "sha512-If7BjFlpkzzBeV1cqgT3OSWT3azyoxDGajR+iGnFBfVV2EWyDyWaZZW2ERDjUaY2QM8i5jI3Sj7mhsM4DDAqWA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true }, "object-keys": { @@ -44264,9 +44129,9 @@ "dev": true }, "picomatch": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, "pify": { @@ -44293,12 +44158,57 @@ } }, "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", "dev": true, "requires": { - "find-up": "^2.1.0" + "find-up": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } } }, "please-upgrade-node": { @@ -44485,9 +44395,9 @@ } }, "ignore": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz", - "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "locate-path": { @@ -44697,9 +44607,9 @@ "optional": true }, "qs": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.2.tgz", - "integrity": "sha512-mSIdjzqznWgfd4pMii7sHtaYF8rx8861hBO80SraY5GT0XQibWZWJSid0avzHGkDIZLImux2S5mXO0Hfct2QCw==", + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", "dev": true, "requires": { "side-channel": "^1.0.4" @@ -45038,9 +44948,9 @@ } }, "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", "dev": true } } @@ -45096,13 +45006,14 @@ "dev": true }, "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz", + "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==", "dev": true, "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-cwd": { @@ -45433,11 +45344,11 @@ "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, "secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", "requires": { - "elliptic": "^6.5.2", + "elliptic": "^6.5.4", "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0" } @@ -45474,9 +45385,9 @@ "dev": true }, "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "dev": true, "requires": { "debug": "2.6.9", @@ -45486,9 +45397,9 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" @@ -45510,37 +45421,6 @@ "dev": true } } - }, - "http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", - "dev": true - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", - "dev": true } } }, @@ -45565,15 +45445,15 @@ } }, "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "dev": true, "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" } }, "servify": { @@ -45693,9 +45573,9 @@ "dev": true }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "requires": { "glob": "^7.0.0", @@ -46525,9 +46405,9 @@ "dev": true }, "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", "dev": true, "requires": { "asn1": "~0.2.3", @@ -46906,6 +46786,12 @@ } } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "swap-case": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/swap-case/-/swap-case-1.1.2.tgz", @@ -47747,9 +47633,9 @@ "dev": true }, "utf-8-validate": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", - "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.8.tgz", + "integrity": "sha512-k4dW/Qja1BYDl2qD4tOMB9PFVha/UJtxTc1cXYOe3WwA/2m0Yn4qB7wLMpJyLJ/7DR0XnTut3HsCSzDT4ZvKgA==", "dev": true, "requires": { "node-gyp-build": "^4.3.0" @@ -48239,9 +48125,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "underscore": { @@ -48277,9 +48163,9 @@ } }, "@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "bignumber.js": { @@ -49166,9 +49052,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.37.tgz", - "integrity": "sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA==", + "version": "12.20.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.41.tgz", + "integrity": "sha512-f6xOqucbDirG7LOzedpvzjP3UTmHttRou3Mosx3vL9wr9AIQGhcPgVnqa8ihpZYnxyM1rxeNCvTyukPKZtq10Q==", "dev": true }, "bn.js": { diff --git a/package.json b/package.json index ac952133da..8b1bbddc3a 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@eth-optimism/contracts": "0.3.4", "@eth-optimism/core-utils": "~0.4.5", "@eth-optimism/smock": "1.1.10", - "@gnosis.pm/safe-core-sdk": "1.3.0", + "@gnosis.pm/safe-core-sdk": "1.3.0", "@gnosis.pm/safe-service-client": "1.1.0", "@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-truffle5": "2.0.0", @@ -85,6 +85,7 @@ "@pinata/sdk": "1.1.11", "@uniswap/token-lists": "^1.0.0-beta.11", "ajv": "^6.12.4", + "async": "3.2.3", "axios": "0.21.2", "bn.js": "4.11.8", "chai": "4.2.0", diff --git a/publish/deployed/local-ovm/config.json b/publish/deployed/local-ovm/config.json index 16cedd4427..48712c7871 100644 --- a/publish/deployed/local-ovm/config.json +++ b/publish/deployed/local-ovm/config.json @@ -32,9 +32,6 @@ "FeePool": { "deploy": true }, - "FeePoolState": { - "deploy": true - }, "FeePoolEternalStorage": { "deploy": true }, @@ -71,7 +68,7 @@ "RewardsDistribution": { "deploy": true }, - "SynthetixState": { + "SynthetixDebtShare": { "deploy": true }, "SystemStatus": { diff --git a/publish/deployed/local/config.json b/publish/deployed/local/config.json index 9b492c6221..803c4de6b5 100644 --- a/publish/deployed/local/config.json +++ b/publish/deployed/local/config.json @@ -59,9 +59,6 @@ "FeePool": { "deploy": true }, - "FeePoolState": { - "deploy": true - }, "FeePoolEternalStorage": { "deploy": true }, @@ -101,7 +98,7 @@ "RewardsDistribution": { "deploy": true }, - "SynthetixState": { + "SynthetixDebtShare": { "deploy": true }, "SystemStatus": { diff --git a/publish/index.js b/publish/index.js index 4414ad0cba..f1aa24d0bf 100644 --- a/publish/index.js +++ b/publish/index.js @@ -13,6 +13,7 @@ require('./src/commands/deploy-staking-rewards').cmd(program); require('./src/commands/deploy').cmd(program); require('./src/commands/extract-staking-balances').cmd(program); require('./src/commands/finalize-release').cmd(program); +require('./src/commands/migrate-debt-shares').cmd(program); require('./src/commands/nominate').cmd(program); require('./src/commands/owner').cmd(program); require('./src/commands/persist-tokens').cmd(program); diff --git a/publish/releases.json b/publish/releases.json index 2cc104f91e..715dd9099b 100644 --- a/publish/releases.json +++ b/publish/releases.json @@ -402,12 +402,22 @@ ], "released": "both" }, - { + { "sip": 184, "layer": "both", "sources": ["Exchanger", "ExchangeRates", "SystemSettings"], "released": "both" }, + { + "sip": 185, + "layer": "both", + "sources": [ + "Synthetix", + "FeePool", + "Issuer", + "SynthetixDebtShare" + ] + }, { "sip": 187, "layer": "both", diff --git a/publish/src/commands/deploy/deploy-core.js b/publish/src/commands/deploy/deploy-core.js index 091a3d3d4b..a1104fa224 100644 --- a/publish/src/commands/deploy/deploy-core.js +++ b/publish/src/commands/deploy/deploy-core.js @@ -89,6 +89,12 @@ module.exports = async ({ args: [account, account], }); + await deployer.deployContract({ + name: 'SynthetixDebtShare', + deps: ['AddressResolver'], + args: [account, addressOf(readProxyForResolver)], + }); + const proxyFeePool = await deployer.deployContract({ name: 'ProxyFeePool', source: 'Proxy', diff --git a/publish/src/commands/deploy/import-fee-periods.js b/publish/src/commands/deploy/import-fee-periods.js index 62f6b7663b..c34c17a17f 100644 --- a/publish/src/commands/deploy/import-fee-periods.js +++ b/publish/src/commands/deploy/import-fee-periods.js @@ -86,7 +86,7 @@ module.exports = async ({ ); } else if (i === 0 && period.startTime < Date.now() / 1000 - 3600 * 24 * 7) { throw Error( - `The initial fee period is more than one week ago - this is likely an error. ` + + `The initial fee period is more than one week ago (${period.startTime}) - this is likely an error. ` + `Please check to make sure you are using the correct FeePool source (this should ` + `be the one most recently replaced). Given: ${explorerLinkPrefix}/address/${ExistingFeePool.address}` ); @@ -154,7 +154,6 @@ module.exports = async ({ const importArgs = [ index, feePeriod.feePeriodId, - feePeriod.startingDebtIndex, feePeriod.startTime, feePeriod.feesToDistribute, feePeriod.feesClaimed, @@ -179,7 +178,7 @@ module.exports = async ({ `FeePool newFeePool = FeePool(${FeePool.address})`, `( uint64 feePeriodId_${index}, - uint64 startingDebtIndex_${index}, + uint64 unused_${index}, uint64 startTime_${index}, uint feesToDistribute_${index}, uint feesClaimed_${index}, @@ -189,7 +188,6 @@ module.exports = async ({ `newFeePool.importFeePeriod( ${index}, feePeriodId_${index}, - startingDebtIndex_${index}, startTime_${index}, feesToDistribute_${index}, feesClaimed_${index}, diff --git a/publish/src/commands/migrate-debt-shares.js b/publish/src/commands/migrate-debt-shares.js new file mode 100644 index 0000000000..7451df8a73 --- /dev/null +++ b/publish/src/commands/migrate-debt-shares.js @@ -0,0 +1,185 @@ +'use strict'; + +const fs = require('fs'); + +const async = require('async'); + +const ethers = require('ethers'); + +const { gray, green } = require('chalk'); + +const { + ensureDeploymentPath, + ensureNetwork, + getDeploymentPathForNetwork, + loadConnections, + loadAndCheckRequiredSources, +} = require('../util'); + +const { performTransactionalStep } = require('../command-utils/transact'); + +const { getUsers } = require('../../..'); + +const migrateDebtShares = async ({ + network, + deploymentPath, + privateKey, + useOvm, + useFork, + maxFeePerGas, + maxPriorityFeePerGas, + providerUrl, + etherscanAddressCsv, + threshold, + batchSize = 500, +}) => { + ensureNetwork(network); + deploymentPath = deploymentPath || getDeploymentPathForNetwork({ network, useOvm }); + ensureDeploymentPath(deploymentPath); + + const { providerUrl: envProviderUrl, privateKey: envPrivateKey } = loadConnections({ + network, + useFork, + useOvm, + }); + + const { deployment, ownerActions, ownerActionsFile } = loadAndCheckRequiredSources({ + deploymentPath, + network, + }); + + if (!providerUrl) { + if (!envProviderUrl) { + throw new Error('Missing .env key of PROVIDER_URL. Please add and retry.'); + } + + providerUrl = envProviderUrl; + } + + // if not specified, or in a local network, override the private key passed as a CLI option, with the one specified in .env + if (network !== 'local' && !privateKey && !useFork) { + privateKey = envPrivateKey; + } + + const provider = new ethers.providers.JsonRpcProvider(providerUrl); + + let signer; + if (!privateKey) { + const account = getUsers({ network, user: 'owner', useOvm }).address; + signer = provider.getSigner(account); + signer.address = await signer.getAddress(); + } else { + signer = new ethers.Wallet(privateKey, provider); + } + + console.log(gray(`Using account with public key ${signer.address}`)); + + // get synthetix system contract + const { address: synthetixAddress } = deployment.targets['ProxySynthetix']; + const { abi: synthetixABI } = deployment.sources[deployment.targets['Synthetix'].source]; + const Synthetix = new ethers.Contract(synthetixAddress, synthetixABI, provider); + + const { address: debtSharesAddress } = deployment.targets['SynthetixDebtShare']; + const { abi: debtSharesABI } = deployment.sources[ + deployment.targets['SynthetixDebtShare'].source + ]; + const SynthetixDebtShare = new ethers.Contract(debtSharesAddress, debtSharesABI, provider); + + // get a list of addresses + const addrs = fs.readFileSync(etherscanAddressCsv).toString('utf8'); + + const lines = addrs.split('\n'); + + const addressCollateralAmounts = []; + + const sUSD = ethers.utils.formatBytes32String('sUSD'); + + let totalDebtAccounted = ethers.BigNumber.from(0); + let totalDebtForgiven = ethers.BigNumber.from(0); + + await async.eachOfLimit(lines, 30, async (line, i) => { + if (line === '') return; + + const address = JSON.parse(line.split(',')[0]); + + if (i % 1000 === 0) { + console.log('scanning address', i, 'of', lines.length); + } + + try { + const debtBalanceOf = await Synthetix.debtBalanceOf(address, sUSD); + + if (debtBalanceOf.gt(ethers.utils.parseEther(threshold))) { + addressCollateralAmounts.push({ address, debtBalanceOf }); + totalDebtAccounted = totalDebtAccounted.add(debtBalanceOf); + } else { + totalDebtForgiven = totalDebtForgiven.add(debtBalanceOf); + } + } catch (err) { + console.log('had error for address', address, err); + } + }); + + console.log( + 'recorded', + addressCollateralAmounts.length, + 'addresses with debt totalling', + ethers.utils.formatEther(totalDebtAccounted), + 'forgiving', + ethers.utils.formatEther(totalDebtForgiven) + ); + + for (let i = 0; i < addressCollateralAmounts.length; i += batchSize) { + const batch = addressCollateralAmounts.slice(i, i + batchSize); + + const addrs = batch.map(a => a.address); + const amounts = batch.map(a => a.debtBalanceOf); + + await performTransactionalStep({ + contract: 'SynthetixDebtShare', + encodeABI: network === 'mainnet', + maxFeePerGas, + maxPriorityFeePerGas, + ownerActions, + ownerActionsFile, + signer, + target: SynthetixDebtShare, + write: 'importAddresses', + writeArg: [addrs, amounts], // explicitly pass array of args so array not splat as params + }); + + console.log('wrote action for import of addresses', i, 'through', i + batchSize); + } + + console.log(green('Completed successfully')); +}; + +module.exports = { + migrateDebtShares, + cmd: program => + program + .command('migrate-debt-shares') + .description('Migrate to Debt Shares from debtLedger') + .option('-g, --max-fee-per-gas ', 'Maximum base gas fee price in GWEI') + .option('--max-priority-fee-per-gas ', 'Priority gas fee price in GWEI', '2') + .option('-n, --network ', 'The network to run off.', x => x.toLowerCase(), 'kovan') + .option( + '-k, --use-fork', + 'Perform the deployment on a forked chain running on localhost (see fork command).', + false + ) + .option('-y, --yes', 'Dont prompt, just reply yes.') + .option('-z, --use-ovm', 'Target deployment for the OVM (Optimism).') + .option( + '-p, --provider-url ', + 'Ethereum network provider URL. If default, will use PROVIDER_URL found in the .env file.' + ) + .option('--etherscan-address-csv ', 'CSV of all addresses to scan', 'snx-addrs.csv') + .option( + '--threshold ', + 'Forgive debt amounts for holders who have less than the given threshold of debt', + '0' + ) + .option('--batch-size', 'Number of addresses per import transaction', 500) + .action(migrateDebtShares), +}; diff --git a/test/contracts/BaseSynthetix.js b/test/contracts/BaseSynthetix.js index 18959c8ae1..ff96d20fd2 100644 --- a/test/contracts/BaseSynthetix.js +++ b/test/contracts/BaseSynthetix.js @@ -53,7 +53,6 @@ contract('BaseSynthetix', async accounts => { synths: ['sUSD', 'sETH', 'sEUR', 'sAUD'], contracts: [ 'BaseSynthetix', - 'SynthetixState', 'SupplySchedule', 'AddressResolver', 'ExchangeRates', diff --git a/test/contracts/DebtCache.js b/test/contracts/DebtCache.js index 9a319d3c63..0d9f000eeb 100644 --- a/test/contracts/DebtCache.js +++ b/test/contracts/DebtCache.js @@ -581,8 +581,8 @@ contract('DebtCache', async accounts => { it('When the debt snapshot is invalid, cannot issue, burn, exchange, claim, or transfer when holding debt.', async () => { // Ensure the account has some synths to attempt to burn later. - await synthetix.transfer(account1, toUnit('1000'), { from: owner }); - await synthetix.transfer(account2, toUnit('1000'), { from: owner }); + await synthetix.transfer(account1, toUnit('10000'), { from: owner }); + await synthetix.transfer(account2, toUnit('10000'), { from: owner }); await synthetix.issueSynths(toUnit('10'), { from: account1 }); // Stale the debt snapshot diff --git a/test/contracts/FeePool.js b/test/contracts/FeePool.js index 07a6cd881c..5aed5e6217 100644 --- a/test/contracts/FeePool.js +++ b/test/contracts/FeePool.js @@ -7,11 +7,10 @@ const { assert, addSnapshotBeforeRestoreAfterEach } = require('./common'); const FeePool = artifacts.require('FeePool'); const FlexibleStorage = artifacts.require('FlexibleStorage'); -const { fastForward, toUnit, toPreciseUnit, fromUnit, multiplyDecimal } = require('../utils')(); +const { fastForward, toUnit, toBN, fromUnit, multiplyDecimal } = require('../utils')(); const { ensureOnlyExpectedMutativeFunctions, - onlyGivenAddressCanInvoke, setStatus, getDecodedLogs, decodedEventEqual, @@ -19,6 +18,7 @@ const { setExchangeFeeRateForSynths, setupPriceAggregators, updateAggregatorRates, + onlyGivenAddressCanInvoke, } = require('./helpers'); const { setupAllContracts } = require('./setup'); @@ -28,6 +28,8 @@ const { defaults: { ISSUANCE_RATIO, FEE_PERIOD_DURATION, TARGET_THRESHOLD }, } = require('../..'); +const CLAIM_AMOUNT_DELTA_TOLERATED = '50'; + contract('FeePool', async accounts => { const [deployerAccount, owner, , account1, account2] = accounts; @@ -65,7 +67,6 @@ contract('FeePool', async accounts => { systemStatus, systemSettings, exchangeRates, - feePoolState, rewardsDistribution, delegateApprovals, sUSDContract, @@ -80,7 +81,6 @@ contract('FeePool', async accounts => { DelegateApprovals: delegateApprovals, ExchangeRates: exchangeRates, FeePool: feePool, - FeePoolState: feePoolState, DebtCache: debtCache, ProxyFeePool: feePoolProxy, RewardsDistribution: rewardsDistribution, @@ -97,11 +97,9 @@ contract('FeePool', async accounts => { 'Exchanger', 'FeePool', 'FeePoolEternalStorage', - 'FeePoolState', 'DebtCache', 'Proxy', 'Synthetix', - 'SynthetixState', 'SystemSettings', 'SystemStatus', 'RewardEscrowV2', @@ -139,7 +137,6 @@ contract('FeePool', async accounts => { abi: feePool.abi, ignoreParents: ['Proxyable', 'LimitedSetup', 'MixinResolver'], expected: [ - 'appendAccountIssuanceRecord', 'recordFeePaid', 'setRewardsToDistribute', 'closeCurrentFeePeriod', @@ -168,7 +165,6 @@ contract('FeePool', async accounts => { // Assert that our first period is open. assert.deepEqual(await instance.recentFeePeriods(0), { feePeriodId: 1, - startingDebtIndex: 0, feesToDistribute: 0, feesClaimed: 0, }); @@ -177,7 +173,6 @@ contract('FeePool', async accounts => { assert.deepEqual(await instance.recentFeePeriods(1), { feePeriodId: 0, startTime: 0, - startingDebtIndex: 0, feesToDistribute: 0, feesClaimed: 0, }); @@ -213,14 +208,6 @@ contract('FeePool', async accounts => { reason: 'RewardsDistribution only', }); }); - it('appendAccountIssuanceRecord() cannot be invoked directly by any account', async () => { - await onlyGivenAddressCanInvoke({ - fnc: feePool.appendAccountIssuanceRecord, - accounts, - args: [account1, toUnit('0.001'), '0'], - reason: 'Issuer and SynthetixState only', - }); - }); }); describe('when the issuanceRatio is 0.2', () => { @@ -256,28 +243,21 @@ contract('FeePool', async accounts => { const feeInUSD = exchange.sub(amountReceivedFromExchange(exchange)); // First period - assert.deepEqual(await feePool.recentFeePeriods(0), { - feePeriodId: 3, - startingDebtIndex: 2, - feesToDistribute: 0, - feesClaimed: 0, + assert.deepInclude(await feePool.recentFeePeriods(0), { + feesToDistribute: toBN(0), + feesClaimed: toBN(0), }); // Second period - assert.deepEqual(await feePool.recentFeePeriods(1), { - feePeriodId: 2, - startingDebtIndex: 2, - feesToDistribute: feeInUSD, - feesClaimed: feeInUSD.divRound(web3.utils.toBN('2')), - }); + const secondPeriod = await feePool.recentFeePeriods(1); + assert.bnEqual(secondPeriod.feesToDistribute, feeInUSD); + assert.bnEqual(secondPeriod.feesClaimed, feeInUSD.divRound(web3.utils.toBN('2'))); // Everything else should be zero for (let i = 3; i < length; i++) { - assert.deepEqual(await feePool.recentFeePeriods(i), { - feePeriodId: 0, - startingDebtIndex: 0, - feesToDistribute: 0, - feesClaimed: 0, + assert.deepInclude(await feePool.recentFeePeriods(i), { + feesToDistribute: toBN(0), + feesClaimed: toBN(0), }); } @@ -289,17 +269,16 @@ contract('FeePool', async accounts => { // All periods except last should now be 0 for (let i = 0; i < length - 1; i++) { - assert.deepEqual(await feePool.recentFeePeriods(i), { - feesToDistribute: 0, - feesClaimed: 0, + assert.deepInclude(await feePool.recentFeePeriods(i), { + feesToDistribute: toBN(0), + feesClaimed: toBN(0), }); } // Last period should have rolled over fees to distribute - assert.deepEqual(await feePool.recentFeePeriods(length - 1), { - feesToDistribute: feeInUSD.div(web3.utils.toBN('2')), - feesClaimed: 0, - }); + const lastPeriod = await feePool.recentFeePeriods(length - 1); + assert.bnEqual(lastPeriod.feesToDistribute, toBN(feeInUSD.div(web3.utils.toBN('2')))); + assert.bnEqual(lastPeriod.feesClaimed, toBN(0)); }); it('should correctly calculate the totalFeesAvailable for a single open period', async () => { @@ -408,7 +387,7 @@ contract('FeePool', async accounts => { assert.bnClose( feesAvailable[0], fee.div(web3.utils.toBN('3')).mul(web3.utils.toBN('2')), - '11' + CLAIM_AMOUNT_DELTA_TOLERATED ); // But account2 shouldn't be entitled to anything. @@ -454,14 +433,14 @@ contract('FeePool', async accounts => { feesAvailable = await feePool.feesAvailable(owner); assert.bnClose(feesAvailable[0], oneThird(fee)); feesAvailable = await feePool.feesAvailable(account1); - assert.bnClose(feesAvailable[0], twoThirds(fee), '11'); + assert.bnClose(feesAvailable[0], twoThirds(fee), CLAIM_AMOUNT_DELTA_TOLERATED); // The owner decides to claim their fees. await feePool.claimFees({ from: owner }); // account1 should still have the same amount of fees available. feesAvailable = await feePool.feesAvailable(account1); - assert.bnClose(feesAvailable[0], twoThirds(fee), '11'); + assert.bnClose(feesAvailable[0], twoThirds(fee), CLAIM_AMOUNT_DELTA_TOLERATED); // If we close the next FEE_PERIOD_LENGTH fee periods off without claiming, their // fee amount that was unclaimed will roll forward, but will get proportionally @@ -527,30 +506,24 @@ contract('FeePool', async accounts => { it('should allow account1 to close the current fee period', async () => { await fastForward(await feePool.feePeriodDuration()); + const lastFeePeriodId = (await feePool.recentFeePeriods(0)).feePeriodId; + const transaction = await feePool.closeCurrentFeePeriod({ from: account1 }); assert.eventEqual(transaction, 'FeePeriodClosed', { feePeriodId: 1 }); // Assert that our first period is new. - assert.deepEqual(await feePool.recentFeePeriods(0), { - feePeriodId: 2, - startingDebtIndex: 0, - feesToDistribute: 0, - feesClaimed: 0, - }); + assert.bnNotEqual((await feePool.recentFeePeriods(0)).feePeriodId, lastFeePeriodId); // And that the second was the old one - assert.deepEqual(await feePool.recentFeePeriods(1), { - feePeriodId: 1, - startingDebtIndex: 0, - feesToDistribute: 0, - feesClaimed: 0, - }); + assert.bnEqual((await feePool.recentFeePeriods(1)).feePeriodId, lastFeePeriodId); // fast forward and close another fee Period await fastForward(await feePool.feePeriodDuration()); + const secondFeePeriodId = (await feePool.recentFeePeriods(0)).feePeriodId; + const secondPeriodClose = await feePool.closeCurrentFeePeriod({ from: account1 }); - assert.eventEqual(secondPeriodClose, 'FeePeriodClosed', { feePeriodId: 2 }); + assert.eventEqual(secondPeriodClose, 'FeePeriodClosed', { feePeriodId: secondFeePeriodId }); }); it('should import feePeriods and close the current fee period correctly', async () => { // startTime for most recent period is mocked to start same time as the 2018-03-13T00:00:00 datetime @@ -559,7 +532,6 @@ contract('FeePool', async accounts => { // recentPeriod 0 index: 0, feePeriodId: 22, - startingDebtIndex: 0, startTime: 1520859600, feesToDistribute: '5800660797674490860', feesClaimed: '0', @@ -570,7 +542,6 @@ contract('FeePool', async accounts => { // recentPeriod 1 index: 1, feePeriodId: 21, - startingDebtIndex: 0, startTime: 1520254800, feesToDistribute: '934419341128642893704', feesClaimed: '0', @@ -584,7 +555,6 @@ contract('FeePool', async accounts => { await feePool.importFeePeriod( period.index, period.feePeriodId, - period.startingDebtIndex, period.startTime, period.feesToDistribute, period.feesClaimed, @@ -600,11 +570,9 @@ contract('FeePool', async accounts => { assert.eventEqual(transaction, 'FeePeriodClosed', { feePeriodId: 22 }); // Assert that our first period is new. - assert.deepEqual(await feePool.recentFeePeriods(0), { - feePeriodId: 23, - startingDebtIndex: 0, - feesToDistribute: 0, - feesClaimed: 0, + assert.deepInclude(await feePool.recentFeePeriods(0), { + feesToDistribute: toBN(0), + feesClaimed: toBN(0), }); // And that the second was the old one and fees and rewards rolled over @@ -613,7 +581,6 @@ contract('FeePool', async accounts => { const rolledOverFees = feesToDistribute1.add(feesToDistribute2); // 940220001926317384564 assert.deepEqual(await feePool.recentFeePeriods(1), { feePeriodId: 22, - startingDebtIndex: 0, startTime: 1520859600, feesToDistribute: rolledOverFees, feesClaimed: '0', @@ -643,19 +610,15 @@ contract('FeePool', async accounts => { }); // Assert that our first period is new. - assert.deepEqual(await feePool.recentFeePeriods(0), { - feePeriodId: 2, - startingDebtIndex: 0, - feesToDistribute: 0, - feesClaimed: 0, + assert.deepInclude(await feePool.recentFeePeriods(0), { + feesToDistribute: toBN(0), + feesClaimed: toBN(0), }); // And that the second was the old one - assert.deepEqual(await feePool.recentFeePeriods(1), { - feePeriodId: 1, - startingDebtIndex: 0, - feesToDistribute: 0, - feesClaimed: 0, + assert.deepInclude(await feePool.recentFeePeriods(1), { + feesToDistribute: toBN(0), + feesClaimed: toBN(0), }); }); it('should correctly roll over unclaimed fees when closing fee periods', async () => { @@ -722,7 +685,6 @@ contract('FeePool', async accounts => { const period = await feePool.recentFeePeriods(i); assert.bnEqual(period.feePeriodId, i === 0 ? 1 : 0); - assert.bnEqual(period.startingDebtIndex, 0); assert.bnEqual(period.feesToDistribute, 0); assert.bnEqual(period.feesClaimed, 0); } @@ -734,6 +696,8 @@ contract('FeePool', async accounts => { }); const fee = await sUSDContract.balanceOf(FEE_ADDRESS); + const oldFeePeriodId = (await feePool.recentFeePeriods(0)).feePeriodId; + // And walk it forward one fee period. await closeFeePeriod(); @@ -742,16 +706,14 @@ contract('FeePool', async accounts => { // First period const firstPeriod = await feePool.recentFeePeriods(0); - assert.bnEqual(firstPeriod.feePeriodId, 2); - assert.bnEqual(firstPeriod.startingDebtIndex, 1); + assert.bnNotEqual(firstPeriod.feePeriodId, oldFeePeriodId); assert.bnEqual(firstPeriod.feesToDistribute, 0); assert.bnEqual(firstPeriod.feesClaimed, 0); // Second period const secondPeriod = await feePool.recentFeePeriods(1); - assert.bnEqual(secondPeriod.feePeriodId, 1); - assert.bnEqual(secondPeriod.startingDebtIndex, 0); + assert.bnEqual(secondPeriod.feePeriodId, oldFeePeriodId); assert.bnEqual(secondPeriod.feesToDistribute, fee); assert.bnEqual(secondPeriod.feesClaimed, 0); @@ -760,7 +722,6 @@ contract('FeePool', async accounts => { const period = await feePool.recentFeePeriods(i); assert.bnEqual(period.feePeriodId, 0); - assert.bnEqual(period.startingDebtIndex, 0); assert.bnEqual(period.feesToDistribute, 0); assert.bnEqual(period.feesClaimed, 0); } @@ -901,6 +862,45 @@ contract('FeePool', async accounts => { assert.bnEqual(newUSDBalance, oldsUSDBalance.add(feesAvailableUSD[0])); }); + it('should allow a user to claim their fees in sUSD after burning @gasprofile', async () => { + // Issue 10,000 sUSD for two different accounts. + await synthetix.transfer(account1, toUnit('1000000'), { + from: owner, + }); + + await synthetix.issueSynths(toUnit('10000'), { from: owner }); + await synthetix.issueSynths(toUnit('10000'), { from: account1 }); + + await synthetix.exchange(sUSD, toUnit(100), sAUD, { from: account1 }); + + await closeFeePeriod(); + + // Settle our debt + await synthetix.burnSynths(toUnit('999999'), { from: owner }); + + assert.bnEqual( + await synthetix.debtBalanceOf(owner, toBytes32('sUSD')), + toUnit('0'), + 'account has debt remaining' + ); + + // Assert that we have correct values in the fee pool + const feesAvailableUSD = await feePool.feesAvailable(owner); + const oldsUSDBalance = await sUSDContract.balanceOf(owner); + + // Now we should be able to claim them. + const claimFeesTx = await feePool.claimFees({ from: owner }); + + assert.eventEqual(claimFeesTx, 'FeesClaimed', { + sUSDAmount: feesAvailableUSD[0], + snxRewards: feesAvailableUSD[1], + }); + + const newUSDBalance = await sUSDContract.balanceOf(owner); + // We should have our fees + assert.bnEqual(newUSDBalance, oldsUSDBalance.add(feesAvailableUSD[0])); + }); + it('should allow a user to claim their fees if they minted debt during period', async () => { // Issue 10,000 sUSD for two different accounts. await synthetix.transfer(account1, toUnit('1000000'), { @@ -943,11 +943,6 @@ contract('FeePool', async accounts => { await closeFeePeriod(); - const issuanceDataOwner = await feePoolState.getAccountsDebtEntry(owner, 0); - - assert.bnEqual(issuanceDataOwner.debtPercentage, toPreciseUnit('1')); - assert.bnEqual(issuanceDataOwner.debtEntryIndex, '0'); - const feesAvailableOwner = await feePool.feesAvailable(owner); const feesAvailableAcc1 = await feePool.feesAvailable(account1); @@ -984,21 +979,12 @@ contract('FeePool', async accounts => { await closeFeePeriod(); } - // issuanceData for Owner and Account1 should hold order of minting - const issuanceDataOwner = await feePoolState.getAccountsDebtEntry(owner, 0); - assert.bnEqual(issuanceDataOwner.debtPercentage, toPreciseUnit('1')); - assert.bnEqual(issuanceDataOwner.debtEntryIndex, '0'); - - const issuanceDataAccount1 = await feePoolState.getAccountsDebtEntry(account1, 0); - assert.bnEqual(issuanceDataAccount1.debtPercentage, toPreciseUnit('0.5')); - assert.bnEqual(issuanceDataAccount1.debtEntryIndex, '1'); - // Period One checks const ownerDebtRatioForPeriod = await feePool.effectiveDebtRatioForPeriod(owner, 1); const account1DebtRatioForPeriod = await feePool.effectiveDebtRatioForPeriod(account1, 1); - assert.bnEqual(ownerDebtRatioForPeriod, toPreciseUnit('0.5')); - assert.bnEqual(account1DebtRatioForPeriod, toPreciseUnit('0.5')); + assert.bnEqual(ownerDebtRatioForPeriod, toUnit('0.5')); + assert.bnEqual(account1DebtRatioForPeriod, toUnit('0.5')); // Assert that we have correct values in the fee pool const feesAvailable = await feePool.feesAvailable(owner); @@ -1238,22 +1224,16 @@ contract('FeePool', async accounts => { }); describe('effectiveDebtRatioForPeriod', async () => { - it('should revert if period is > than FEE_PERIOD_LENGTH', async () => { + it('should return 0 if period is > than FEE_PERIOD_LENGTH', async () => { // returns length of periods const length = (await feePool.FEE_PERIOD_LENGTH()).toNumber(); // adding an extra period should revert as not available (period rollsover at last one) - await assert.revert( - feePool.effectiveDebtRatioForPeriod(owner, length + 1), - 'Exceeds the FEE_PERIOD_LENGTH' - ); + await assert.bnEqual(await feePool.effectiveDebtRatioForPeriod(owner, length + 1), 0); }); - it('should revert if checking current unclosed period ', async () => { - await assert.revert( - feePool.effectiveDebtRatioForPeriod(owner, 0), - 'Current period is not closed yet' - ); + it('should return 0 if checking current unclosed period ', async () => { + await assert.bnEqual(await feePool.effectiveDebtRatioForPeriod(owner, 0), 0); }); }); diff --git a/test/contracts/FeePoolState.js b/test/contracts/FeePoolState.js deleted file mode 100644 index e88cc83c16..0000000000 --- a/test/contracts/FeePoolState.js +++ /dev/null @@ -1,441 +0,0 @@ -'use strict'; - -const { artifacts, contract } = require('hardhat'); - -const { assert } = require('./common'); - -const { toPreciseUnit, toUnit } = require('../utils')(); -const { onlyGivenAddressCanInvoke, ensureOnlyExpectedMutativeFunctions } = require('./helpers'); - -const FeePoolState = artifacts.require('FeePoolState'); - -contract('FeePoolState', async accounts => { - const [ - deployerAccount, - owner, - , - feePoolAccount, - account1, - account2, - account3, - account4, - account5, - account6, - ] = accounts; - - let feePoolState; - - beforeEach(async () => { - feePoolState = await FeePoolState.new(owner, feePoolAccount, { from: deployerAccount }); - }); - - it('ensure only known functions are mutative', () => { - ensureOnlyExpectedMutativeFunctions({ - abi: FeePoolState.abi, - ignoreParents: ['Owned', 'LimitedSetup'], - expected: ['setFeePool', 'appendAccountIssuanceRecord', 'importIssuerData'], - }); - }); - - it('should set constructor params on deployment', async () => { - assert.equal(await feePoolState.feePool(), feePoolAccount); - assert.equal(await feePoolState.owner(), owner); - }); - - describe('setFeePool()', () => { - it('can only be invoked by the owner', async () => { - await onlyGivenAddressCanInvoke({ - fnc: feePoolState.setFeePool, - accounts, - address: owner, - args: [account1], - }); - }); - }); - - describe('Appending Account issuance record', async () => { - async function checkIssuanceLedgerData( - address, - issuanceLedgerIndex, - expectedEntryIndex, - expectedDebtPercentage - ) { - const accountLedger = await feePoolState.accountIssuanceLedger(address, issuanceLedgerIndex); // accountIssuanceLedger[address][index] - // console.log( - // 'debtEntryIndex, debtPercentage', - // issuanceLedgerIndex, - // accountLedger.debtEntryIndex.toString(), - // accountLedger.debtPercentage.toString() - // ); - assert.bnEqual(accountLedger.debtEntryIndex, expectedEntryIndex); - assert.bnEqual(accountLedger.debtPercentage, expectedDebtPercentage); - } - - const issuanceData = [ - { address: account3, debtRatio: toPreciseUnit('1'), debtEntryIndex: '0' }, - { address: account3, debtRatio: toPreciseUnit('0.5'), debtEntryIndex: '1' }, - { address: account3, debtRatio: toPreciseUnit('0.25'), debtEntryIndex: '2' }, - { address: account3, debtRatio: toPreciseUnit('0.125'), debtEntryIndex: '3' }, - { address: account3, debtRatio: toPreciseUnit('0.625'), debtEntryIndex: '4' }, - { address: account3, debtRatio: toPreciseUnit('0.3125'), debtEntryIndex: '5' }, - ]; - - it('should return the issuanceData that exists that is within the closingDebtIndex via applicableIssuanceData', async () => { - // Fill the accountIssuanceLedger with debt entries per period - for (var i = 0; i < issuanceData.length; i++) { - await feePoolState.appendAccountIssuanceRecord( - issuanceData[i].address, - issuanceData[i].debtRatio, - issuanceData[i].debtEntryIndex, - i + 1, - { - from: feePoolAccount, - } - ); - } - - // check the latest accountIssuance for account3 - // address, issuanceLedgerIndex, expectedEntryIndex, expectedDebtPercentage - await checkIssuanceLedgerData(account3, 0, '5', toPreciseUnit('0.3125')); - await checkIssuanceLedgerData(account3, 1, '4', toPreciseUnit('0.625')); - await checkIssuanceLedgerData(account3, 2, '3', toPreciseUnit('0.125')); - await checkIssuanceLedgerData(account3, 3, '2', toPreciseUnit('0.25')); - await checkIssuanceLedgerData(account3, 4, '1', toPreciseUnit('0.5')); - await checkIssuanceLedgerData(account3, 5, '0', toPreciseUnit('1')); - - let accountsDebtEntry; - // Assert that applicableIssuanceData returns the correct data - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 6); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.3125')); - assert.bnEqual(accountsDebtEntry[1], 5); - - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 5); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.3125')); - assert.bnEqual(accountsDebtEntry[1], 5); - - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 4); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.625')); - assert.bnEqual(accountsDebtEntry[1], 4); - - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 3); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.125')); - assert.bnEqual(accountsDebtEntry[1], 3); - - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 2); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.25')); - assert.bnEqual(accountsDebtEntry[1], 2); - - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 1); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.5')); - assert.bnEqual(accountsDebtEntry[1], 1); - - accountsDebtEntry = await feePoolState.applicableIssuanceData(account3, 0); - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('1')); - assert.bnEqual(accountsDebtEntry[1], 0); - }); - - it('should return the issuanceData for an account given an index', async () => { - let accountsDebtEntry; - - // simulate a mint and append debtRatio to ledger in Period[0] - const firstIndex = 1; - await feePoolState.appendAccountIssuanceRecord(account1, toPreciseUnit('1'), firstIndex, 0, { - from: feePoolAccount, - }); - - // check the latest accountIssuance for account1 - accountsDebtEntry = await feePoolState.getAccountsDebtEntry(account1, 0); - - // Assert they have their matching inputs - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('1')); - assert.bnEqual(accountsDebtEntry[1], firstIndex); - - // simulate a mint and append debtRatio to ledger in Period[0] - const secondIndex = 1; - await feePoolState.appendAccountIssuanceRecord( - account1, - toPreciseUnit('.5'), - secondIndex, - 0, - { - from: feePoolAccount, - } - ); - - // check the latest accountIssuance for account1 - accountsDebtEntry = await feePoolState.getAccountsDebtEntry(account1, 0); - - // Assert they have their matching inputs - assert.bnEqual(accountsDebtEntry[0], toPreciseUnit('.5')); - assert.bnEqual(accountsDebtEntry[1], secondIndex); - }); - - it('should importIssuerData', async () => { - const accounts = [account1, account2, account3, account4, account5, account6]; - const ratios = [ - toPreciseUnit('1'), - toPreciseUnit('0.5'), - toPreciseUnit('0.25'), - toPreciseUnit('0.125'), - toPreciseUnit('0.625'), - toPreciseUnit('0.3125'), - ]; - const issuanceLedgerIndex = 1; - const dummyDebtEntryIndex = 5555; - - // Import issuser data into the last closed period and 5555 as the feePeriodCloseIndex - await feePoolState.importIssuerData( - accounts, - ratios, - issuanceLedgerIndex, - dummyDebtEntryIndex, - { - from: owner, - } - ); - - // Iterate the accounts - for (let i = 0; i < accounts.length; i++) { - // accountIssuanceLedger[address][index] - const accountLedger = await feePoolState.accountIssuanceLedger( - accounts[i], - issuanceLedgerIndex - ); - // console.log( - // 'debtEntryIndex, debtPercentage', - // issuanceLedgerIndex, - // accountLedger.debtEntryIndex.toString(), - // accountLedger.debtPercentage.toString() - // ); - - // Assert they have their matching ratios - assert.bnEqual(accountLedger.debtPercentage, ratios[i]); - assert.bnEqual(accountLedger.debtEntryIndex, dummyDebtEntryIndex); - } - }); - - it('should append account issuance record for curent feePeriod', async () => { - const currentPeriodStartDebtIndex = 0; - - // simulate a mint and append debtRatio to ledger in Period[0] - await feePoolState.appendAccountIssuanceRecord( - issuanceData[0].address, - issuanceData[0].debtRatio, - issuanceData[0].debtEntryIndex, - currentPeriodStartDebtIndex, - { from: feePoolAccount } - ); - - // check the latest accountIssuance for account1 - await checkIssuanceLedgerData( - issuanceData[0].address, - 0, - issuanceData[0].debtEntryIndex, - issuanceData[0].debtRatio - ); - - // simulate a mint and append to ledger in Period[0] - await feePoolState.appendAccountIssuanceRecord( - issuanceData[1].address, - issuanceData[1].debtRatio, - issuanceData[1].debtEntryIndex, - currentPeriodStartDebtIndex, - { from: feePoolAccount } - ); - - // accountIssuanceLedger[0] has new issuanceData - await checkIssuanceLedgerData( - issuanceData[1].address, - 0, - issuanceData[1].debtEntryIndex, - issuanceData[1].debtRatio - ); - }); - - it('should append account issuance record twice for each feePeriod, up to feePeriod length', async () => { - const FEE_PERIOD_LENGTH = (await feePoolState.FEE_PERIOD_LENGTH()).toNumber(); - const initialDebtRatio = toUnit('1'); - const secondDebtRatio = toUnit('.5'); - let entryIndexCounter = 0; - let currentPeriodStartDebtIndex = 0; - - // loop through the feePeriods - for (let i = 0; i < FEE_PERIOD_LENGTH; i++) { - // write an entry to debt ledger in Period[0] - // console.log('init data entry,', initialDebtRatio.toString(), entryIndexCounter); - await feePoolState.appendAccountIssuanceRecord( - account3, - initialDebtRatio, - entryIndexCounter, - currentPeriodStartDebtIndex, - { - from: feePoolAccount, - } - ); - entryIndexCounter++; - // overwrite the previous entry to debt ledger in Period[0] - // console.log('overwrite data,', secondDebtRatio.toString(), entryIndexCounter); - await feePoolState.appendAccountIssuanceRecord( - account3, - secondDebtRatio, - entryIndexCounter, - i + 1, - { - from: feePoolAccount, - } - ); - entryIndexCounter++; - // Simulate the closing of this period (closeFeePeriod) - currentPeriodStartDebtIndex = entryIndexCounter + 1; - } - - // Assert that we always have the Last issuance data for each fee period - // The latest debtEntryIndex will be in the current Fee Period index [0] - await checkIssuanceLedgerData(account3, 0, '11', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 1, '9', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 2, '7', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 3, '5', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 4, '3', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 5, '1', secondDebtRatio); - }); - - it('should append account issuance record twice for each feePeriod, beyond the fee period length', async () => { - const FEE_PERIOD_LENGTH = 12; - const initialDebtRatio = toUnit('1'); - const secondDebtRatio = toUnit('.5'); - let entryIndexCounter = 0; - let currentPeriodStartDebtIndex = 0; - - // loop through the feePeriods - for (let i = 0; i < FEE_PERIOD_LENGTH; i++) { - // write an entry to debt ledger in Period[0] - // console.log('init data entry,', initialDebtRatio.toString(), entryIndexCounter); - await feePoolState.appendAccountIssuanceRecord( - account3, - initialDebtRatio, - entryIndexCounter, - currentPeriodStartDebtIndex, - { - from: feePoolAccount, - } - ); - entryIndexCounter++; - // overwrite the previous entry to debt ledger in Period[0] - // console.log('overwrite data,', secondDebtRatio.toString(), entryIndexCounter); - await feePoolState.appendAccountIssuanceRecord( - account3, - secondDebtRatio, - entryIndexCounter, - i + 1, - { - from: feePoolAccount, - } - ); - entryIndexCounter++; - // Simulate the closing of this period (closeFeePeriod) - currentPeriodStartDebtIndex = entryIndexCounter + 1; - } - - // Assert that we always have the Last issuance data for each fee period - // The latest debtEntryIndex will be in the current Fee Period index [0] - await checkIssuanceLedgerData(account3, 0, '23', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 1, '21', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 2, '19', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 3, '17', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 4, '15', secondDebtRatio); - - await checkIssuanceLedgerData(account3, 5, '13', secondDebtRatio); - }); - }); - - // TODO checks SynthetixState debt entry is same as stored FeePoolState Entry - // it.only('should allow an issuer to issue max synths and track debt issuance in feePool', async function() { - // // Send a price update to guarantee we're not depending on values from outside this test. - - // await updateAggregatorRates( - // exchangeRates, - // [sAUD, sEUR, SNX], - // ['0.5', '1.25', '0.1'].map(toUnit) - // ); - - // // Give some SNX to account1 - // await synthetix.transfer(account1, toUnit('10000'), { from: owner }); - - // // Determine maximum amount that can be issued. - // const maxIssuable = await synthetix.maxIssuableSynths(account1, sUSD); - - // // Issue - // await synthetix.issueSynths(maxIssuable, { from: account1 }); - - // // There should be 200 sUSD of value in the system - // assert.bnEqual(await synthetix.totalIssuedSynths(sUSD), toUnit('200')); - - // // And account1 should own all of it. - // assert.bnEqual(await synthetix.debtBalanceOf(account1, sUSD), toUnit('200')); - - // // And feePool.accountIssuanceLedger[account1] should record debt minted - // const issuanceDataFromState = await synthetixState.issuanceData(account1); - // const feePoolLedger = await feePool.accountIssuanceLedger(account1, 0); - - // assert.bnEqual(feePoolLedger.debtEntryIndex, 0); - // assert.bnEqual(feePoolLedger.debtEntryIndex, issuanceDataFromState.debtEntryIndex); - // assert.bnEqual(feePoolLedger.debtPercentage, toPreciseUnit('1')); - // assert.bnEqual(feePoolLedger.debtPercentage, issuanceDataFromState.initialDebtOwnership); - // }); - - // it('should allow an issuer to issue synths many times and track debt issuance in feePool', async function() { - // // Send a price update to guarantee we're not depending on values from outside this test. - - // await updateAggregatorRates( - // exchangeRates, - // [sAUD, sEUR, SNX], - // ['0.5', '1.25', '0.1'].map(toUnit), - // ); - - // // Give some SNX to account1 - // await synthetix.transfer(account1, toUnit('20000'), { from: owner }); - - // // Issue - // await synthetix.issueSynths(toUnit('200'), { from: account1 }); - - // // There should be 200 sUSD of value in the system - // assert.bnEqual(await synthetix.totalIssuedSynths(sUSD), toUnit('200')); - - // // And account1 should own all of it. - // assert.bnEqual(await synthetix.debtBalanceOf(account1, sUSD), toUnit('200')); - - // // And feePool.accountIssuanceLedger[account1] should record debt minted - // let issuanceDataFromState, feePoolLedger; - // issuanceDataFromState = await synthetixState.issuanceData(account1); - // feePoolLedger = await feePool.accountIssuanceLedger(account1, 0); - - // assert.bnEqual(feePoolLedger.debtEntryIndex, 0); - // assert.bnEqual(feePoolLedger.debtEntryIndex, issuanceDataFromState.debtEntryIndex); - // assert.bnEqual(feePoolLedger.debtPercentage, toPreciseUnit('1')); - // assert.bnEqual(feePoolLedger.debtPercentage, issuanceDataFromState.initialDebtOwnership); - - // // Issue - // await synthetix.issueSynths(toUnit('200'), { from: account1 }); - - // // And account1 should own all of it. - // assert.bnEqual(await synthetix.debtBalanceOf(account1, sUSD), toUnit('400')); - - // issuanceDataFromState = await synthetixState.issuanceData(account1); - // feePoolLedger = await feePool.accountIssuanceLedger(account1, 0); - - // // debtEntryIndex is updated to 1 and still own whole system - // assert.bnEqual(feePoolLedger.debtEntryIndex, 1); - // assert.bnEqual(feePoolLedger.debtEntryIndex, issuanceDataFromState.debtEntryIndex); - // assert.bnEqual(feePoolLedger.debtPercentage, toPreciseUnit('1')); - // assert.bnEqual(feePoolLedger.debtPercentage, issuanceDataFromState.initialDebtOwnership); - // }); -}); diff --git a/test/contracts/Issuer.js b/test/contracts/Issuer.js index da91822355..d19286f934 100644 --- a/test/contracts/Issuer.js +++ b/test/contracts/Issuer.js @@ -48,7 +48,6 @@ contract('Issuer (via Synthetix)', async accounts => { let synthetix, systemStatus, systemSettings, - synthetixState, delegateApprovals, exchangeRates, feePool, @@ -74,7 +73,6 @@ contract('Issuer (via Synthetix)', async accounts => { synths = ['sUSD', 'sAUD', 'sEUR', 'sETH']; ({ Synthetix: synthetix, - SynthetixState: synthetixState, SystemStatus: systemStatus, SystemSettings: systemSettings, ExchangeRates: exchangeRates, @@ -155,6 +153,7 @@ contract('Issuer (via Synthetix)', async accounts => { 'liquidateDelinquentAccount', 'removeSynth', 'removeSynths', + 'setCurrentPeriodId', ], }); }); @@ -290,13 +289,13 @@ contract('Issuer (via Synthetix)', async accounts => { await systemSettings.setMinimumStakeTime(120, { from: owner }); // issue synths first - await synthetix.issueSynths(web3.utils.toBN('5'), { from: account1 }); + await synthetix.issueSynths(toUnit('0.001'), { from: account1 }); // fastForward 30 seconds await fastForward(10); await assert.revert( - synthetix.burnSynths(web3.utils.toBN('5'), { from: account1 }), + synthetix.burnSynths(toUnit('0.001'), { from: account1 }), 'Minimum stake time not reached' ); @@ -304,7 +303,7 @@ contract('Issuer (via Synthetix)', async accounts => { await fastForward(125); // burn synths - await synthetix.burnSynths(web3.utils.toBN('5'), { from: account1 }); + await synthetix.burnSynths(toUnit('0.001'), { from: account1 }); }); }); }); @@ -1534,8 +1533,8 @@ contract('Issuer (via Synthetix)', async accounts => { let debtBalance2After = await synthetix.debtBalanceOf(account2, sUSD); // debtBalanceOf has rounding error but is within tolerance - assert.bnClose(debtBalance1After, toUnit('150000')); - assert.bnClose(debtBalance2After, toUnit('50000')); + assert.bnClose(debtBalance1After, toUnit('150000'), '100000'); + assert.bnClose(debtBalance2After, toUnit('50000'), '100000'); // Account 1 burns 100,000 await synthetix.burnSynths(toUnit('100000'), { from: account1 }); @@ -1543,8 +1542,8 @@ contract('Issuer (via Synthetix)', async accounts => { debtBalance1After = await synthetix.debtBalanceOf(account1, sUSD); debtBalance2After = await synthetix.debtBalanceOf(account2, sUSD); - assert.bnClose(debtBalance1After, toUnit('50000')); - assert.bnClose(debtBalance2After, toUnit('50000')); + assert.bnClose(debtBalance1After, toUnit('50000'), '100000'); + assert.bnClose(debtBalance2After, toUnit('50000'), '100000'); }); it('should revert if sender tries to issue synths with 0 amount', async () => { @@ -1553,7 +1552,7 @@ contract('Issuer (via Synthetix)', async accounts => { await assert.revert( synthetix.issueSynths(issuedSynths1, { from: account1 }), - 'SafeMath: division by zero' + 'Issuer: cannot issue 0 synths' ); }); }); @@ -1803,7 +1802,7 @@ contract('Issuer (via Synthetix)', async accounts => { // because this user is holding half the debt, when we burn 250 sUSD in a reclaim, // it removes it from the totalIssuedSynths and so both users have half of 250 // in owing synths - assert.bnEqual(debtBalance, divideDecimal('250', 2)); + assert.bnClose(debtBalance, divideDecimal('250', 2), '100000'); }); }); }); @@ -1866,7 +1865,7 @@ contract('Issuer (via Synthetix)', async accounts => { .sub(burntSynthsPt1) .sub(burntSynthsPt2); - assert.bnClose(debt, expectedDebt); + assert.bnClose(debt, expectedDebt, '100000'); }); it("should allow me to burn all synths I've issued when there are other issuers", async () => { @@ -1890,16 +1889,15 @@ contract('Issuer (via Synthetix)', async accounts => { // Issue and burn from account 2 all debt await synthetix.issueSynths(toUnit('43'), { from: account2 }); let debt = await synthetix.debtBalanceOf(account2, sUSD); - await synthetix.burnSynths(toUnit('43'), { from: account2 }); + + // due to rounding it may be necessary to supply higher than originally issued synths + await sUSDContract.transfer(account2, toUnit('1'), { + from: account1, + }); + await synthetix.burnSynths(toUnit('44'), { from: account2 }); debt = await synthetix.debtBalanceOf(account2, sUSD); assert.bnEqual(debt, 0); - - // Should set user issuanceData to 0 debtOwnership and retain debtEntryIndex of last action - assert.deepEqual(await synthetixState.issuanceData(account2), { - initialDebtOwnership: 0, - debtEntryIndex: 2, - }); }); }); @@ -1954,7 +1952,7 @@ contract('Issuer (via Synthetix)', async accounts => { // Here we make the variance a calculation of the number of times we issue/burn. // This is less than ideal, but is the result of calculating the debt based on // the results of the issue/burn each time. - const variance = web3.utils.toBN(totalTimesToIssue).mul(web3.utils.toBN('2')); + const variance = web3.utils.toBN(totalTimesToIssue).mul(web3.utils.toBN('100000000')); assert.bnClose(debtBalance, expectedDebtForAccount2, variance); }).timeout(60e3); @@ -2006,7 +2004,7 @@ contract('Issuer (via Synthetix)', async accounts => { // Here we make the variance a calculation of the number of times we issue/burn. // This is less than ideal, but is the result of calculating the debt based on // the results of the issue/burn each time. - const variance = web3.utils.toBN(totalTimesToIssue).mul(web3.utils.toBN('2')); + const variance = web3.utils.toBN(totalTimesToIssue).mul(web3.utils.toBN('100000000')); // max 0.1 gwei of drift per op assert.bnClose(debtBalance, expectedDebtForAccount2, variance); }).timeout(60e3); diff --git a/test/contracts/Liquidations.js b/test/contracts/Liquidations.js index 1255160b68..ca6548aa83 100644 --- a/test/contracts/Liquidations.js +++ b/test/contracts/Liquidations.js @@ -34,10 +34,8 @@ contract('Liquidations', accounts => { liquidations, sUSDContract, synthetix, - synthetixState, systemSettings, systemStatus, - feePoolState, debtCache, issuer; @@ -50,10 +48,8 @@ contract('Liquidations', accounts => { Liquidations: liquidations, SynthsUSD: sUSDContract, Synthetix: synthetix, - SynthetixState: synthetixState, SystemSettings: systemSettings, SystemStatus: systemStatus, - FeePoolState: feePoolState, DebtCache: debtCache, Issuer: issuer, } = await setupAllContracts({ @@ -64,14 +60,12 @@ contract('Liquidations', accounts => { 'ExchangeRates', 'Exchanger', // required for Synthetix to check if exchanger().hasWaitingPeriodOrSettlementOwing 'FeePool', - 'FeePoolState', // required for checking issuance data appended 'DebtCache', 'Issuer', 'Liquidations', 'SystemStatus', // test system status controls 'SystemSettings', 'Synthetix', - 'SynthetixState', 'CollateralManager', 'RewardEscrowV2', // required for Issuer._collateral() to load balances ], @@ -739,7 +733,7 @@ contract('Liquidations', accounts => { it('then Alice debt is reduced by 100 sUSD', async () => { const aliceDebtAfter = await synthetix.debtBalanceOf(alice, sUSD); const difference = aliceDebtBefore.sub(aliceDebtAfter); - assert.bnEqual(difference, sUSD100); + assert.bnClose(difference, sUSD100, '1000'); }); it('then Alice has less SNX + penalty', async () => { const aliceSNXAfter = await synthetix.collateral(alice); @@ -754,17 +748,6 @@ contract('Liquidations', accounts => { const aliceSNXAfter = await synthetix.collateral(alice); assert.bnEqual(aliceSNXAfter, toUnit('690')); }); - it('then Alice issuance ratio is updated in feePoolState', async () => { - const accountsDebtEntry = await feePoolState.getAccountsDebtEntry(alice, 0); - const issuanceState = await synthetixState.issuanceData(alice); - - assert.bnEqual( - issuanceState.initialDebtOwnership, - accountsDebtEntry.debtPercentage - ); - - assert.bnEqual(issuanceState.debtEntryIndex, accountsDebtEntry.debtEntryIndex); - }); describe('given carol has obtained sUSD to liquidate alice', () => { const sUSD5 = toUnit('5'); const sUSD50 = toUnit('50'); @@ -813,20 +796,6 @@ contract('Liquidations', accounts => { const aliceSNXAfter = await synthetix.collateral(alice); assert.bnEqual(aliceSNXAfter, toUnit('635')); }); - it('then Alice issuance ratio is updated in feePoolState', async () => { - const accountsDebtEntry = await feePoolState.getAccountsDebtEntry(alice, 0); - const issuanceState = await synthetixState.issuanceData(alice); - - assert.bnEqual( - issuanceState.initialDebtOwnership, - accountsDebtEntry.debtPercentage - ); - - assert.bnEqual( - issuanceState.debtEntryIndex, - accountsDebtEntry.debtEntryIndex - ); - }); }); describe('when carol liquidates Alice with 50 sUSD', () => { let liquidationTransaction; @@ -858,27 +827,17 @@ contract('Liquidations', accounts => { const aliceSNXAfter = await synthetix.collateral(alice); assert.bnEqual(aliceSNXAfter, toUnit('635')); }); - it('then Alice issuance ratio is updated in feePoolState', async () => { - const accountsDebtEntry = await feePoolState.getAccountsDebtEntry(alice, 0); - const issuanceState = await synthetixState.issuanceData(alice); - - assert.bnEqual( - issuanceState.initialDebtOwnership, - accountsDebtEntry.debtPercentage - ); - - assert.bnEqual( - issuanceState.debtEntryIndex, - accountsDebtEntry.debtEntryIndex - ); - }); it('then events AccountLiquidated are emitted', async () => { - assert.eventEqual(liquidationTransaction, 'AccountLiquidated', { - account: alice, - snxRedeemed: SNX55, - amountLiquidated: sUSD50, - liquidator: carol, - }); + assert.eventEqual( + liquidationTransaction.logs.find(l => l.event === 'AccountLiquidated'), + 'AccountLiquidated', + { + account: alice, + snxRedeemed: SNX55, + amountLiquidated: sUSD50, + liquidator: carol, + } + ); }); describe('when Bob liqudates Alice with 1000 sUSD', () => { const sUSD1000 = toUnit('1000'); @@ -932,22 +891,17 @@ contract('Liquidations', accounts => { assert.bnEqual(isOpenForLiquidation, false); }); it('then events AccountLiquidated & AccountRemovedFromLiquidation are emitted', async () => { - assert.eventsEqual( - liquidationTransaction, + assert.eventEqual( + liquidationTransaction.logs.find(l => l.event === 'AccountLiquidated'), 'AccountLiquidated', { account: alice, - }, - 'Transfer', - { - from: alice, - to: bob, } - // 'AccountRemovedFromLiquidation', // TODO this should be emitted from liquidation in this test case - // { - // account: alice, - // } ); + + /* assert.eventEqual(liquidationTransaction.logs.find(l => l.event === 'AccountRemovedFromLiquidation'), 'AccountRemovedFromLiquidation', { + account: alice, + }); */ // TODO this should be emitted from liquidation in this test case }); it('then Alice issuanceRatio is now at the target issuanceRatio', async () => { const aliceCRatioAfter = await synthetix.collateralisationRatio(alice); diff --git a/test/contracts/RewardsIntegrationTests.js b/test/contracts/RewardsIntegrationTests.js index 546d3757c5..5dd396e7de 100644 --- a/test/contracts/RewardsIntegrationTests.js +++ b/test/contracts/RewardsIntegrationTests.js @@ -6,7 +6,7 @@ const { assert, addSnapshotBeforeRestoreAfterEach } = require('./common'); const { toBytes32 } = require('../..'); -const { fastForward, toUnit, toPreciseUnit, multiplyDecimal } = require('../utils')(); +const { fastForward, toUnit, multiplyDecimal } = require('../utils')(); const { setExchangeFeeRateForSynths, @@ -100,11 +100,9 @@ contract('Rewards Integration Tests', accounts => { const twoFifths = amount => amount.div(web3.utils.toBN('5')).mul(web3.utils.toBN('2')); // PERCENTAGES - const twentyPercent = toPreciseUnit('0.2'); - // const twentyFivePercent = toPreciseUnit('0.25'); - // const thirtyThreePercent = toPreciseUnit('0.333333333333333333333333333'); - const fortyPercent = toPreciseUnit('0.4'); - const fiftyPercent = toPreciseUnit('0.5'); + const twentyPercent = toUnit('0.2'); + const fortyPercent = toUnit('0.4'); + const fiftyPercent = toUnit('0.5'); // AMOUNTS const tenK = toUnit('10000'); @@ -118,6 +116,8 @@ contract('Rewards Integration Tests', accounts => { const WEEK = 604800; // const YEAR = 31556926; + const gweiTolerance = '1000000000'; + // ACCOUNTS const [deployerAccount, owner, , feeAuthority, account1, account2, account3] = accounts; @@ -159,7 +159,6 @@ contract('Rewards Integration Tests', accounts => { 'ExchangeRates', 'FeePool', 'FeePoolEternalStorage', // necessary to claimFees() - 'FeePoolState', // necessary to claimFees() 'DebtCache', 'RewardEscrowV2', 'RewardsDistribution', // required for Synthetix.mint() @@ -236,15 +235,24 @@ contract('Rewards Integration Tests', accounts => { // All 3 accounts have 1/3 of the rewards const accOneEscrowed = await rewardEscrow.getVestingEntry(account1, 1); - assert.bnEqual(accOneEscrowed.escrowAmount, third(periodOneMintableSupplyMinusMinterReward)); + assert.bnClose( + accOneEscrowed.escrowAmount, + third(periodOneMintableSupplyMinusMinterReward), + gweiTolerance + ); const accTwoEscrowed = await rewardEscrow.getVestingEntry(account2, 2); - assert.bnEqual(accTwoEscrowed.escrowAmount, third(periodOneMintableSupplyMinusMinterReward)); + assert.bnClose( + accTwoEscrowed.escrowAmount, + third(periodOneMintableSupplyMinusMinterReward), + gweiTolerance + ); const accThreeEscrowed = await rewardEscrow.getVestingEntry(account3, 3); - assert.bnEqual( + assert.bnClose( accThreeEscrowed.escrowAmount, - third(periodOneMintableSupplyMinusMinterReward) + third(periodOneMintableSupplyMinusMinterReward), + gweiTolerance ); }); @@ -315,7 +323,7 @@ contract('Rewards Integration Tests', accounts => { const rewardsLessAccountClaims = third(twoWeeksRewards); - assert.bnClose(totalRewardsAvailable, rewardsLessAccountClaims, 10); + assert.bnClose(totalRewardsAvailable, rewardsLessAccountClaims, '1000000000'); }); it('should mint SNX for the all claimable fee periods then all 3 accounts claim at the end of the claimable period', async () => { @@ -348,13 +356,13 @@ contract('Rewards Integration Tests', accounts => { // All 3 accounts have 1/3 of the rewards const accOneEscrowed = await rewardEscrow.getVestingEntry(account1, 1); - assert.bnEqual(accOneEscrowed.escrowAmount, twoWeeksRewards, '1'); + assert.bnClose(accOneEscrowed.escrowAmount, twoWeeksRewards, '1000000000'); const accTwoEscrowed = await rewardEscrow.getVestingEntry(account2, 2); - assert.bnEqual(accTwoEscrowed.escrowAmount, twoWeeksRewards, '1'); + assert.bnClose(accTwoEscrowed.escrowAmount, twoWeeksRewards, '1000000000'); const accThreeEscrowed = await rewardEscrow.getVestingEntry(account3, 3); - assert.bnEqual(accThreeEscrowed.escrowAmount, twoWeeksRewards, '1'); + assert.bnClose(accThreeEscrowed.escrowAmount, twoWeeksRewards, '1000000000'); }); it('should rollover the unclaimed SNX rewards', async () => { @@ -448,7 +456,11 @@ contract('Rewards Integration Tests', accounts => { const lastFeePeriod = await feePool.recentFeePeriods(CLAIMABLE_PERIODS); // Assert that Account 1 has claimed a third of the rewardsToDistribute - assert.bnClose(lastFeePeriod.rewardsClaimed, third(lastFeePeriod.rewardsToDistribute)); + assert.bnClose( + lastFeePeriod.rewardsClaimed, + third(lastFeePeriod.rewardsToDistribute), + gweiTolerance + ); // Assert rewards have rolled over assert.bnEqual(lastFeePeriod.rewardsToDistribute, previousRewards.add(rollOverRewards)); @@ -483,8 +495,8 @@ contract('Rewards Integration Tests', accounts => { // [1] ------------------------------------------------------- // Assert Account 1 has re-entered the system and has awards in period 0 & 1 - assert.bnEqual(feesByPeriod[0][1], rewardsAmount); - assert.bnEqual(feesByPeriod[1][1], rewardsAmount); + assert.bnClose(feesByPeriod[0][1], rewardsAmount, gweiTolerance); + assert.bnClose(feesByPeriod[1][1], rewardsAmount, gweiTolerance); // Only Account 1 claims rewards await feePool.claimFees({ from: account1 }); @@ -497,7 +509,7 @@ contract('Rewards Integration Tests', accounts => { // Assert Account 1 has their rewards const account1EscrowEntry = await rewardEscrow.getVestingEntry(account1, 1); - assert.bnEqual(account1EscrowEntry.escrowAmount, rewardsAmount); + assert.bnClose(account1EscrowEntry.escrowAmount, rewardsAmount, gweiTolerance); }); it('should allocate correct SNX rewards as others leave the system', async () => { @@ -513,7 +525,7 @@ contract('Rewards Integration Tests', accounts => { assert.bnClose( account1Escrowed.escrowAmount, third(periodOneMintableSupplyMinusMinterReward), - 1 + gweiTolerance ); // Account 1 leaves the system @@ -551,12 +563,12 @@ contract('Rewards Integration Tests', accounts => { // Check account2 has correct rewardsAvailable const account2Rewards = await feePool.feesAvailable(account2); // console.log('account2Rewards', rewardsAmount.toString(), account2Rewards[1].toString()); - assert.bnClose(account2Rewards[1], rewardsAmount, '2'); + assert.bnClose(account2Rewards[1], rewardsAmount, gweiTolerance); // Check account3 has correct rewardsAvailable const account3Rewards = await feePool.feesAvailable(account3); // console.log('rewardsAvailable', rewardsAmount.toString(), account3Rewards[1].toString()); - assert.bnClose(account3Rewards[1], rewardsAmount, '1'); + assert.bnClose(account3Rewards[1], rewardsAmount, gweiTolerance); // Accounts 2 & 3 claim await updateRatesWithDefaults({ exchangeRates, owner, debtCache }); @@ -566,10 +578,10 @@ contract('Rewards Integration Tests', accounts => { // Accounts 2 & 3 now have the rewards escrowed const account2Escrowed = await rewardEscrow.getVestingEntry(account2, 2); // console.log('account2Escrowed[3]', account2Escrowed[1].toString()); - assert.bnClose(account2Escrowed.escrowAmount, rewardsAmount, '1'); + assert.bnClose(account2Escrowed.escrowAmount, rewardsAmount, gweiTolerance); const account3Escrowed = await rewardEscrow.getVestingEntry(account3, 3); // console.log('account3Escrowed[3]', account2Escrowed[1].toString()); - assert.bnClose(account3Escrowed.escrowAmount, rewardsAmount, '1'); + assert.bnClose(account3Escrowed.escrowAmount, rewardsAmount, gweiTolerance); }); }); @@ -606,7 +618,7 @@ contract('Rewards Integration Tests', accounts => { assert.bnClose( account1Escrow.escrowAmount, half(periodOneMintableSupplyMinusMinterReward), - 1 + gweiTolerance ); const account2Escrow = await rewardEscrow.getVestingEntry(account2, 2); @@ -614,7 +626,7 @@ contract('Rewards Integration Tests', accounts => { assert.bnClose( account2Escrow.escrowAmount, half(periodOneMintableSupplyMinusMinterReward), - 1 + gweiTolerance ); // Increase sBTC price by 100% @@ -695,9 +707,21 @@ contract('Rewards Integration Tests', accounts => { // oneFifth(periodTwoMintableSupply).toString() // ); - assert.bnClose(account1EscrowEntry2.escrowAmount, twoFifths(periodTwoMintableSupply)); - assert.bnClose(account2EscrowEntry2.escrowAmount, twoFifths(periodTwoMintableSupply)); - assert.bnClose(account3EscrowEntry1.escrowAmount, oneFifth(periodTwoMintableSupply), 17); + assert.bnClose( + account1EscrowEntry2.escrowAmount, + twoFifths(periodTwoMintableSupply), + gweiTolerance + ); + assert.bnClose( + account2EscrowEntry2.escrowAmount, + twoFifths(periodTwoMintableSupply), + gweiTolerance + ); + assert.bnClose( + account3EscrowEntry1.escrowAmount, + oneFifth(periodTwoMintableSupply), + gweiTolerance + ); // Commenting out this logic for now (v2.14.x) - needs to be relooked at -JJ @@ -835,17 +859,17 @@ contract('Rewards Integration Tests', accounts => { assert.bnClose( account1Escrow.escrowAmount, half(periodOneMintableSupplyMinusMinterReward), - 49 + gweiTolerance ); assert.bnClose( account2Escrow.escrowAmount, quarter(periodOneMintableSupplyMinusMinterReward), - 26 + gweiTolerance ); assert.bnClose( account3Escrow.escrowAmount, quarter(periodOneMintableSupplyMinusMinterReward), - 24 + gweiTolerance ); // Acc1 Burns all @@ -889,9 +913,9 @@ contract('Rewards Integration Tests', accounts => { // console.log('account3Escrow2[3]', account3Escrow2[3].toString()); // console.log('half(periodTwoMintableSupply', half(periodTwoMintableSupply).toString()); // console.log('quarter(periodTwoMintableSupply)', quarter(periodTwoMintableSupply).toString()); - assert.bnClose(account1Escrow2.escrowAmount, half(periodTwoMintableSupply), 49); - assert.bnClose(account2Escrow2.escrowAmount, quarter(periodTwoMintableSupply), 26); - assert.bnClose(account3Escrow2.escrowAmount, quarter(periodTwoMintableSupply), 24); + assert.bnClose(account1Escrow2.escrowAmount, half(periodTwoMintableSupply), gweiTolerance); + assert.bnClose(account2Escrow2.escrowAmount, quarter(periodTwoMintableSupply), gweiTolerance); + assert.bnClose(account3Escrow2.escrowAmount, quarter(periodTwoMintableSupply), gweiTolerance); }); }); @@ -911,7 +935,11 @@ contract('Rewards Integration Tests', accounts => { await fastForwardAndCloseFeePeriod(); const rewardsAfter = await feePool.feesAvailable(account1); // console.log('rewardsAfter', rewardsAfter[1].toString()); - assert.bnEqual(rewardsAfter[1], third(periodOneMintableSupplyMinusMinterReward)); + assert.bnClose( + rewardsAfter[1], + third(periodOneMintableSupplyMinusMinterReward), + gweiTolerance + ); }); it('should apply no penalty when users claim rewards above the penalty threshold ratio of 1%', async () => { @@ -925,7 +953,7 @@ contract('Rewards Integration Tests', accounts => { assert.equal(await feePool.isFeesClaimable(account1), true); const snxRewards = await feePool.feesAvailable(account1); - assert.bnClose(snxRewards[1], third(periodOneMintableSupplyMinusMinterReward)); + assert.bnClose(snxRewards[1], third(periodOneMintableSupplyMinusMinterReward), gweiTolerance); // And if we claim them await feePool.claimFees({ from: account1 }); @@ -935,7 +963,7 @@ contract('Rewards Integration Tests', accounts => { assert.bnClose( vestingScheduleEntry.escrowAmount, third(periodOneMintableSupplyMinusMinterReward), - 2 + gweiTolerance ); }); it('should block user from claiming fees and rewards when users claim rewards >10% threshold collateralisation ratio', async () => { @@ -987,7 +1015,6 @@ contract('Rewards Integration Tests', accounts => { await feePool.importFeePeriod( period.index, period.feePeriodId, - period.startingDebtIndex, period.startTime, period.feesToDistribute, period.feesClaimed, @@ -1003,8 +1030,8 @@ contract('Rewards Integration Tests', accounts => { // however only 721,053.846153846153846153 Claimable after rounding to 18 decimals const transaction = await feePool.claimFees({ from: account1 }); assert.eventEqual(transaction, 'FeesClaimed', { - sUSDAmount: feesAvailableUSDAcc1[0].sub(toUnit('0.000000000000000001')), - snxRewards: feesAvailableUSDAcc1[1].sub(toUnit('0.000000000000000001')), + sUSDAmount: feesAvailableUSDAcc1[0], + snxRewards: feesAvailableUSDAcc1[1], }); }); }); diff --git a/test/contracts/SafeDecimalMath.js b/test/contracts/SafeDecimalMath.js index f4fdf172eb..7378a0f9e1 100644 --- a/test/contracts/SafeDecimalMath.js +++ b/test/contracts/SafeDecimalMath.js @@ -339,4 +339,25 @@ contract('SafeDecimalMath', async () => { toPreciseUnit('0.666666666666666666666666667') ); }); + + // ----------------------- + // decimalToPreciseDecimal + // ----------------------- + it('converts decimalToPreciseDecimal', async () => { + assert.bnEqual(await instance.decimalToPreciseDecimal(toUnit('20')), toPreciseUnit('20')); + }); + + // ----------------------- + // preciseDecimalToDecimal + // ----------------------- + it('converts preciseDecimalToDecimal', async () => { + assert.bnEqual( + await instance.preciseDecimalToDecimal(toPreciseUnit('0.66666666666666666666')), + toUnit('0.666666666666666667') + ); + assert.bnEqual( + await instance.preciseDecimalToDecimal(toPreciseUnit('0.33333333333333333333')), + toUnit('0.333333333333333333') + ); + }); }); diff --git a/test/contracts/SupplySchedule.js b/test/contracts/SupplySchedule.js index 20212cae56..66df7e838c 100644 --- a/test/contracts/SupplySchedule.js +++ b/test/contracts/SupplySchedule.js @@ -259,7 +259,7 @@ contract('SupplySchedule', async accounts => { describe('mintable supply', async () => { const DAY = 60 * 60 * 24; const WEEK = 604800; - const weekOne = inflationStartDate + 3600 + 1 * DAY; // 1 day and 60 mins within first week of Inflation supply > Inflation supply as 1 day buffer is added to lastMintEvent + const weekOne = inflationStartDate + 7200 + 1 * DAY; // 1 day and 120 mins within first week of Inflation supply > Inflation supply as 1 day buffer is added to lastMintEvent async function checkMintedValues( mintedSupply = new BN(0), diff --git a/test/contracts/SynthUtil.js b/test/contracts/SynthUtil.js index 9abd6f8360..bd95bf75c0 100644 --- a/test/contracts/SynthUtil.js +++ b/test/contracts/SynthUtil.js @@ -37,7 +37,6 @@ contract('SynthUtil', accounts => { 'Exchanger', 'ExchangeRates', 'ExchangeState', - 'FeePoolState', 'FeePoolEternalStorage', 'SystemSettings', 'DebtCache', diff --git a/test/contracts/Synthetix.js b/test/contracts/Synthetix.js index a7de48399f..60bdb215a5 100644 --- a/test/contracts/Synthetix.js +++ b/test/contracts/Synthetix.js @@ -57,7 +57,6 @@ contract('Synthetix', async accounts => { synths: ['sUSD', 'sETH', 'sEUR', 'sAUD'], contracts: [ 'Synthetix', - 'SynthetixState', 'SupplySchedule', 'AddressResolver', 'ExchangeRates', diff --git a/test/contracts/SynthetixDebtShare.js b/test/contracts/SynthetixDebtShare.js new file mode 100644 index 0000000000..afa4399d2b --- /dev/null +++ b/test/contracts/SynthetixDebtShare.js @@ -0,0 +1,661 @@ +'use strict'; + +const { contract } = require('hardhat'); + +const { assert, addSnapshotBeforeRestoreAfterEach } = require('./common'); + +const { setupContract } = require('./setup'); + +const { toUnit } = require('../utils')(); + +const { onlyGivenAddressCanInvoke, ensureOnlyExpectedMutativeFunctions } = require('./helpers'); + +const { + toBytes32, + constants: { ZERO_ADDRESS }, +} = require('../..'); + +const ethers = require('ethers'); + +contract('SynthetixDebtShare', async accounts => { + const [owner, issuer, account1, account2] = accounts; + + let addressResolver, synthetixDebtShare; + + before(async () => { + addressResolver = await setupContract({ + accounts, + args: [owner], + contract: 'AddressResolver', + }); + + synthetixDebtShare = await setupContract({ + accounts, + args: [owner, addressResolver.address], + contract: 'SynthetixDebtShare', + }); + + await addressResolver.importAddresses([toBytes32('Issuer')], [issuer], { from: owner }); + await synthetixDebtShare.rebuildCache(); + await synthetixDebtShare.addAuthorizedBroker(owner); + }); + + addSnapshotBeforeRestoreAfterEach(); + + it('ensure only expected functions are mutative', async () => { + ensureOnlyExpectedMutativeFunctions({ + abi: synthetixDebtShare.abi, + ignoreParents: ['Owned'], + expected: [ + 'mintShare', + 'burnShare', + 'transferFrom', + 'importAddresses', + 'takeSnapshot', + 'addAuthorizedBroker', + 'removeAuthorizedBroker', + 'addAuthorizedToSnapshot', + 'removeAuthorizedToSnapshot', + 'finishSetup', + 'rebuildCache', + ], + }); + }); + it('should set constructor params on deployment', async () => { + const instance = await setupContract({ + accounts, + contract: 'SynthetixDebtShare', + args: [owner, addressResolver.address], + }); + + assert.equal(await instance.owner(), owner); + }); + + describe('mintShare()', () => { + it('should disallow another from minting', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.mintShare, + args: [account2, toUnit('0.1')], + accounts, + address: issuer, + skipPassCheck: true, + reason: 'SynthetixDebtShare: only issuer can mint/burn', + }); + }); + + it('mints', async () => { + await synthetixDebtShare.mintShare(account1, toUnit('10'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('10')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('10')); + }); + + it('mints twice on the same period', async () => { + await synthetixDebtShare.mintShare(account1, toUnit('10'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('10')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('10')); + + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('30')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('30')); + }); + + it('more than one person can mint', async () => { + await synthetixDebtShare.mintShare(account1, toUnit('10'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('10')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('10')); + + await synthetixDebtShare.mintShare(account2, toUnit('20'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('10')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('30')); + }); + + describe('on new period', async () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('10'), { from: issuer }); + await synthetixDebtShare.takeSnapshot(toUnit('10'), { from: issuer }); + }); + + it('mints', async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('30')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('30')); + }); + + describe('on another new period', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.takeSnapshot(toUnit('50'), { from: issuer }); + }); + + it('previous period is preserved', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('30')); + + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('50')); + + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account1, toUnit('10')), + toUnit('30') + ); + assert.bnEqual(await synthetixDebtShare.totalSupplyOnPeriod(toUnit('10')), toUnit('30')); + }); + }); + }); + }); + + describe('burnShare()', () => { + it('should disallow another from burning', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.mintShare, + args: [account2, toUnit('0.1')], + address: issuer, + accounts, + reason: 'SynthetixDebtShare: only issuer can mint/burn', + }); + }); + + describe('when account already has shares minted', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('50'), { from: issuer }); + await synthetixDebtShare.takeSnapshot(toUnit('10'), { from: issuer }); + }); + + it('cannot burn more shares than the account has', async () => { + await assert.revert( + synthetixDebtShare.burnShare(account1, toUnit('60'), { from: issuer }), + 'SafeMath: subtraction overflow' + ); + }); + + it('burns', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('50')); + await synthetixDebtShare.burnShare(account1, toUnit('20'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('30')); + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('30')); + }); + + describe('on another new period', () => { + beforeEach(async () => { + await synthetixDebtShare.burnShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.takeSnapshot(toUnit('50'), { from: issuer }); + }); + + it('previous period is preserved', async () => { + await synthetixDebtShare.burnShare(account1, toUnit('20'), { from: issuer }); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('10')); + + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account1, toUnit('10')), + toUnit('30') + ); + assert.bnEqual(await synthetixDebtShare.totalSupplyOnPeriod(toUnit('10')), toUnit('30')); + }); + }); + }); + }); + + describe('takeSnapshot()', () => { + it('is only invokable by issuer', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.takeSnapshot, + args: [toUnit('10')], + address: issuer, + accounts, + reason: 'SynthetixDebtShare: not authorized to snapshot', + }); + }); + + describe('when authorized to snapshot address is set', () => { + beforeEach(async () => { + await synthetixDebtShare.addAuthorizedToSnapshot(account1); + }); + + it('becomes invokable by authorized snapshotter', async () => { + await synthetixDebtShare.takeSnapshot(toUnit('10'), { from: account1 }); + }); + }); + + describe('when successfully invoked', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('1'), { from: issuer }); + await synthetixDebtShare.takeSnapshot(toUnit('10'), { from: issuer }); + await synthetixDebtShare.mintShare(account1, toUnit('1'), { from: issuer }); + }); + + it('sets current period id', async () => { + assert.bnEqual(await synthetixDebtShare.currentPeriodId(), toUnit('10')); + }); + + it('rolls totalSupply', async () => { + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('2')); + assert.bnEqual(await synthetixDebtShare.totalSupplyOnPeriod(1), toUnit('1')); + }); + + it('prohibits lower period IDs in the future', async () => { + await assert.revert(synthetixDebtShare.takeSnapshot(toUnit('5'))); + await assert.revert(synthetixDebtShare.takeSnapshot(toUnit('10'))); + }); + }); + }); + + describe('authorized broker functions', () => { + it('only owner', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.addAuthorizedBroker, + args: [ZERO_ADDRESS], + address: owner, + accounts, + reason: 'Only the contract owner may perform this action', + }); + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.removeAuthorizedBroker, + args: [ZERO_ADDRESS], + address: owner, + accounts, + reason: 'Only the contract owner may perform this action', + }); + }); + + describe('when successfully invoked', () => { + beforeEach(async () => { + await synthetixDebtShare.addAuthorizedBroker(account1, { from: owner }); + }); + + it('sets broker', async () => { + assert.bnEqual(await synthetixDebtShare.authorizedBrokers(account1), true); + }); + + describe('when broker is removed', () => { + beforeEach(async () => { + await synthetixDebtShare.removeAuthorizedBroker(account1, { from: owner }); + }); + + it('sets broker', async () => { + assert.bnEqual(await synthetixDebtShare.authorizedBrokers(account1), false); + }); + }); + }); + }); + + describe('authorized to snapshot functions', () => { + it('only owner', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.addAuthorizedToSnapshot, + args: [ZERO_ADDRESS], + address: owner, + accounts, + reason: 'Only the contract owner may perform this action', + }); + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.removeAuthorizedToSnapshot, + args: [ZERO_ADDRESS], + address: owner, + accounts, + reason: 'Only the contract owner may perform this action', + }); + }); + + describe('when successfully invoked', () => { + beforeEach(async () => { + await synthetixDebtShare.addAuthorizedToSnapshot(account1, { from: owner }); + }); + + it('sets authorization', async () => { + assert.bnEqual(await synthetixDebtShare.authorizedToSnapshot(account1), true); + }); + + describe('when broker is removed', () => { + beforeEach(async () => { + await synthetixDebtShare.removeAuthorizedToSnapshot(account1, { from: owner }); + }); + + it('sets authorization', async () => { + assert.bnEqual(await synthetixDebtShare.authorizedToSnapshot(account1), false); + }); + }); + }); + }); + + describe('transfer()', () => { + it('should always fail', async () => { + await assert.revert( + synthetixDebtShare.transfer(account2, toUnit('0.1')), + 'debt shares are not transferrable' + ); + }); + }); + + describe('approve()', () => { + it('should always fail', async () => { + await assert.revert( + synthetixDebtShare.approve(account2, toUnit('0.1')), + 'debt shares are not transferrable' + ); + }); + }); + + describe('transferFrom()', () => { + describe('when account has some debt shares', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('100'), { from: issuer }); + }); + + it('only allows authorized brokers to transferFrom', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.transferFrom, + address: owner, + args: [account1, account2, toUnit('0.1')], + accounts, + reason: 'SynthetixDebtShare: only brokers can transferFrom', + }); + }); + + it('fails transfer if exceeds balance', async () => { + await assert.revert(synthetixDebtShare.transferFrom(account1, account2, toUnit('200')), ''); + }); + + it('transfers', async () => { + await synthetixDebtShare.transferFrom(account1, account2, toUnit('100')); + + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('0')); + assert.bnEqual(await synthetixDebtShare.balanceOf(account2), toUnit('100')); + }); + }); + }); + + describe('allowance()', () => { + it('returns 0 for non-brokers', async () => { + assert.bnEqual(await synthetixDebtShare.allowance(account1, account1), toUnit('0')); + }); + + it('returns MAX_UINT for brokers', async () => { + assert.bnNotEqual(await synthetixDebtShare.allowance(owner, owner), toUnit('0')); + }); + }); + + describe('balanceOf()', () => { + it('returns 0 balance initially', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('0')); + }); + + describe('when 2 accounts have minted shares', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.mintShare(account2, toUnit('80'), { from: issuer }); + }); + + it('returns correct balances', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('20')); + assert.bnEqual(await synthetixDebtShare.balanceOf(account2), toUnit('80')); + }); + }); + }); + + describe('totalSupply()', () => { + it('returns 0 balance initially', async () => { + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('0')); + }); + + describe('when 2 accounts have minted shares', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.mintShare(account2, toUnit('80'), { from: issuer }); + }); + + it('returns correct totalSupply', async () => { + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('100')); + }); + }); + }); + + describe('balanceOfOnPeriod()', () => { + addSnapshotBeforeRestoreAfterEach(); + + it('returns 0 balance initially', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('0')); + }); + + describe('when 2 accounts have minted shares', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.mintShare(account2, toUnit('80'), { from: issuer }); + }); + + it('returns correct percentages for current period', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account1, 1), toUnit('20')); + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account2, 1), toUnit('80')); + }); + + describe('when period changes', () => { + beforeEach(async () => { + await synthetixDebtShare.takeSnapshot(toUnit('100'), { from: issuer }); + }); + + it('returns correct percentages for last period', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account1, 1), toUnit('20')); + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account2, 1), toUnit('80')); + }); + + it('returns correct percentages for current period', async () => { + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account1, toUnit('100')), + toUnit('20') + ); + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account2, toUnit('100')), + toUnit('80') + ); + }); + + describe('when balance changes on new period', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('40'), { from: issuer }); + }); + + it('returns correct percentages for last period', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account1, 1), toUnit('20')); + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account2, 1), toUnit('80')); + }); + + it('returns correct percentages for current period', async () => { + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account1, toUnit('100')), + toUnit('60') + ); + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account2, toUnit('100')), + toUnit('80') + ); + }); + + it('still remembers 0 balance before first mint', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOfOnPeriod(account2, 0), 0); + }); + }); + }); + }); + + describe('when there is long period history', () => { + beforeEach(async () => { + // one account changes balance every period + for (let i = 1; i < 100; i++) { + await synthetixDebtShare.takeSnapshot(toUnit(i.toString()), { from: issuer }); + await synthetixDebtShare.mintShare(account1, toUnit('1'), { from: issuer }); + } + }); + + it('has correct latest balance', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('99')); + }); + + it('has balance from a couple periods ago', async () => { + assert.bnEqual( + await synthetixDebtShare.balanceOfOnPeriod(account1, toUnit('95')), + toUnit('95') + ); + }); + + it('reverts on oldest period', async () => { + await assert.revert( + synthetixDebtShare.balanceOfOnPeriod(account1, 10), + 'SynthetixDebtShare: not found in recent history' + ); + }); + }); + }); + + describe('sharePercent()', () => { + describe('when 2 accounts have minted shares', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.mintShare(account2, toUnit('80'), { from: issuer }); + }); + + it('returns correct percentages', async () => { + assert.bnEqual(await synthetixDebtShare.sharePercent(account1), toUnit('0.2')); + assert.bnEqual(await synthetixDebtShare.sharePercent(account2), toUnit('0.8')); + }); + }); + }); + + describe('sharePercentOnPeriod()', () => { + describe('when 2 accounts have minted shares', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('20'), { from: issuer }); + await synthetixDebtShare.mintShare(account2, toUnit('80'), { from: issuer }); + }); + + it('returns correct percentages for current period', async () => { + assert.bnEqual(await synthetixDebtShare.sharePercentOnPeriod(account1, 1), toUnit('0.2')); + assert.bnEqual(await synthetixDebtShare.sharePercentOnPeriod(account2, 1), toUnit('0.8')); + }); + + describe('when period changes', () => { + beforeEach(async () => { + await synthetixDebtShare.takeSnapshot(toUnit('100'), { from: issuer }); + }); + + it('returns correct percentages for last period', async () => { + assert.bnEqual(await synthetixDebtShare.sharePercentOnPeriod(account1, 1), toUnit('0.2')); + assert.bnEqual(await synthetixDebtShare.sharePercentOnPeriod(account2, 1), toUnit('0.8')); + }); + + it('returns correct percentages for current period', async () => { + assert.bnEqual(await synthetixDebtShare.sharePercentOnPeriod(account1, 1), toUnit('0.2')); + assert.bnEqual(await synthetixDebtShare.sharePercentOnPeriod(account2, 1), toUnit('0.8')); + }); + + describe('when balance changes on new period', () => { + beforeEach(async () => { + await synthetixDebtShare.mintShare(account1, toUnit('100'), { from: issuer }); + }); + + it('returns correct percentages for last period', async () => { + assert.bnEqual( + await synthetixDebtShare.sharePercentOnPeriod(account1, 1), + toUnit('0.2') + ); + assert.bnEqual( + await synthetixDebtShare.sharePercentOnPeriod(account2, 1), + toUnit('0.8') + ); + }); + + it('returns correct percentages for current period', async () => { + assert.bnEqual( + await synthetixDebtShare.sharePercentOnPeriod(account1, toUnit('100')), + toUnit('0.6') + ); + assert.bnEqual( + await synthetixDebtShare.sharePercentOnPeriod(account2, toUnit('100')), + toUnit('0.4') + ); + }); + }); + }); + }); + }); + + describe('importAddresses()', () => { + it('should disallow import outside of owner', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.importAddresses, + args: [[account2], [toUnit('0.1')]], + accounts, + address: owner, + skipPassCheck: true, + reason: 'Only the contract owner may perform this action', + }); + }); + + describe('when invoked by owner', () => { + let txn1, txn2; + + beforeEach(async () => { + txn1 = await synthetixDebtShare.importAddresses([account1], [toUnit('20')], { + from: owner, + }); + await synthetixDebtShare.importAddresses([account2, issuer], [toUnit('10'), toUnit('10')], { + from: owner, + }); + await synthetixDebtShare.importAddresses([account2], [toUnit('50')], { from: owner }); + txn2 = await synthetixDebtShare.importAddresses([account2], [toUnit('30')], { + from: owner, + }); + }); + + it('sets total supply', async () => { + assert.bnEqual(await synthetixDebtShare.totalSupply(), toUnit('60')); + }); + + it('sets balances balances', async () => { + assert.bnEqual(await synthetixDebtShare.balanceOf(account1), toUnit('20')); + assert.bnEqual(await synthetixDebtShare.balanceOf(account2), toUnit('30')); + assert.bnEqual(await synthetixDebtShare.balanceOf(issuer), toUnit('10')); + }); + + it('emits events', async () => { + assert.eventEqual(txn1.logs[0], 'Mint', [account1, toUnit('20')]); + assert.eventEqual(txn1.logs[1], 'Transfer', [ + ethers.constants.AddressZero, + account1, + toUnit('20'), + ]); + + assert.eventEqual(txn2.logs[0], 'Burn', [account2, toUnit('20')]); + }); + }); + }); + + describe('finishSetup()', () => { + it('should disallow another from minting', async () => { + await onlyGivenAddressCanInvoke({ + fnc: synthetixDebtShare.finishSetup, + args: [], + accounts, + address: owner, + skipPassCheck: true, + reason: 'Only the contract owner may perform this action', + }); + }); + + describe('when invoked by owner', () => { + beforeEach(async () => { + await synthetixDebtShare.finishSetup({ from: owner }); + }); + + it('becomes initialized', async () => { + assert.isTrue(await synthetixDebtShare.isInitialized()); + }); + }); + }); +}); diff --git a/test/contracts/SynthetixState.js b/test/contracts/SynthetixState.js deleted file mode 100644 index 1fdb2273d4..0000000000 --- a/test/contracts/SynthetixState.js +++ /dev/null @@ -1,186 +0,0 @@ -'use strict'; - -const { contract } = require('hardhat'); - -const { assert, addSnapshotBeforeRestoreAfterEach } = require('./common'); - -const { setupContract } = require('./setup'); - -const { toUnit } = require('../utils')(); - -const { onlyGivenAddressCanInvoke, ensureOnlyExpectedMutativeFunctions } = require('./helpers'); - -contract('SynthetixState', async accounts => { - const [, owner, account1, account2] = accounts; - - let synthetixState; - - before(async () => { - synthetixState = await setupContract({ - accounts, - contract: 'SynthetixState', - }); - }); - - addSnapshotBeforeRestoreAfterEach(); - - it('ensure only expected functions are mutative', async () => { - ensureOnlyExpectedMutativeFunctions({ - abi: synthetixState.abi, - ignoreParents: ['State', 'LimitedSetup'], - expected: [ - 'setCurrentIssuanceData', - 'clearIssuanceData', - 'incrementTotalIssuerCount', - 'decrementTotalIssuerCount', - 'appendDebtLedgerValue', - ], - }); - }); - it('should set constructor params on deployment', async () => { - const instance = await setupContract({ - accounts, - contract: 'SynthetixState', - args: [account1, account2], - }); - - assert.equal(await instance.owner(), account1); - assert.equal(await instance.associatedContract(), account2); - }); - - describe('setCurrentIssuanceData()', () => { - it('should allow the associated contract to setCurrentIssuanceData', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - await synthetixState.setCurrentIssuanceData(account2, toUnit('0.1'), { from: account1 }); - }); - - it('should disallow another from setting the setCurrentIssuanceData', async () => { - await onlyGivenAddressCanInvoke({ - fnc: synthetixState.setCurrentIssuanceData, - args: [account2, toUnit('0.1')], - accounts, - skipPassCheck: true, - reason: 'Only the associated contract can perform this action', - }); - }); - }); - - describe('clearIssuanceData()', () => { - it('should allow the associated contract to clearIssuanceData', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - await synthetixState.setCurrentIssuanceData(account2, toUnit('0.1'), { from: account1 }); - await synthetixState.clearIssuanceData(account2, { from: account1 }); - assert.bnEqual((await synthetixState.issuanceData(account2)).initialDebtOwnership, 0); - }); - - it('should disallow another address from calling clearIssuanceData', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - await assert.revert(synthetixState.clearIssuanceData(account2, { from: account2 })); - }); - - it('should disallow another from setting the setCurrentIssuanceData', async () => { - await onlyGivenAddressCanInvoke({ - fnc: synthetixState.clearIssuanceData, - args: [account2], - accounts, - skipPassCheck: true, - reason: 'Only the associated contract can perform this action', - }); - }); - }); - - describe('incrementTotalIssuerCount()', () => { - it('should allow the associated contract to incrementTotalIssuerCount', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - - await synthetixState.incrementTotalIssuerCount({ from: account1 }); - assert.bnEqual(await synthetixState.totalIssuerCount(), 1); - }); - - it('should disallow another address from calling incrementTotalIssuerCount', async () => { - await onlyGivenAddressCanInvoke({ - fnc: synthetixState.incrementTotalIssuerCount, - accounts, - args: [], - skipPassCheck: true, - reason: 'Only the associated contract can perform this action', - }); - }); - }); - - describe('decrementTotalIssuerCount()', () => { - it('should allow the associated contract to decrementTotalIssuerCount', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - - // We need to increment first or we'll overflow on subtracting from zero and revert that way - await synthetixState.incrementTotalIssuerCount({ from: account1 }); - await synthetixState.decrementTotalIssuerCount({ from: account1 }); - assert.bnEqual(await synthetixState.totalIssuerCount(), 0); - }); - - it('should disallow another address from calling decrementTotalIssuerCount', async () => { - await onlyGivenAddressCanInvoke({ - fnc: synthetixState.decrementTotalIssuerCount, - accounts, - args: [], - skipPassCheck: true, - reason: 'Only the associated contract can perform this action', - }); - }); - }); - - describe('appendDebtLedgerValue()', () => { - it('should allow the associated contract to appendDebtLedgerValue', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - - await synthetixState.appendDebtLedgerValue(toUnit('0.1'), { from: account1 }); - assert.bnEqual(await synthetixState.lastDebtLedgerEntry(), toUnit('0.1')); - }); - - it('should disallow another address from calling appendDebtLedgerValue', async () => { - await onlyGivenAddressCanInvoke({ - fnc: synthetixState.appendDebtLedgerValue, - accounts, - args: [toUnit('0.1')], - skipPassCheck: true, - reason: 'Only the associated contract can perform this action', - }); - }); - }); - - describe('debtLedgerLength()', () => { - it('should correctly report debtLedgerLength', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - - assert.bnEqual(await synthetixState.debtLedgerLength(), 0); - await synthetixState.appendDebtLedgerValue(toUnit('0.1'), { from: account1 }); - assert.bnEqual(await synthetixState.debtLedgerLength(), 1); - }); - }); - - describe('lastDebtLedgerEntry()', () => { - it('should correctly report lastDebtLedgerEntry', async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - - // Nothing in the array, so we should revert on invalid opcode - await assert.invalidOpcode(synthetixState.lastDebtLedgerEntry()); - await synthetixState.appendDebtLedgerValue(toUnit('0.1'), { from: account1 }); - assert.bnEqual(await synthetixState.lastDebtLedgerEntry(), toUnit('0.1')); - }); - }); - - describe('hasIssued()', () => { - it('is false by default', async () => { - assert.equal(await synthetixState.hasIssued(account2), false); - }); - describe('when an account has issuance data', () => { - beforeEach(async () => { - await synthetixState.setAssociatedContract(account1, { from: owner }); - await synthetixState.setCurrentIssuanceData(account2, toUnit('0.1'), { from: account1 }); - }); - it('then hasIssued() is true', async () => { - assert.equal(await synthetixState.hasIssued(account2), true); - }); - }); - }); -}); diff --git a/test/contracts/setup.js b/test/contracts/setup.js index 1e9dea986d..14a909bde5 100644 --- a/test/contracts/setup.js +++ b/test/contracts/setup.js @@ -176,6 +176,7 @@ const setupContract = async ({ ExchangerWithFeeRecAlternatives: [owner, tryGetAddressOf('AddressResolver')], SystemSettings: [owner, tryGetAddressOf('AddressResolver')], ExchangeState: [owner, tryGetAddressOf('Exchanger')], + SynthetixDebtShare: [owner, tryGetAddressOf('AddressResolver')], BaseSynthetix: [ tryGetAddressOf('ProxyERC20BaseSynthetix'), tryGetAddressOf('TokenStateBaseSynthetix'), @@ -217,7 +218,6 @@ const setupContract = async ({ EtherWrapper: [owner, tryGetAddressOf('AddressResolver'), tryGetAddressOf('WETH')], NativeEtherWrapper: [owner, tryGetAddressOf('AddressResolver')], WrapperFactory: [owner, tryGetAddressOf('AddressResolver')], - FeePoolState: [owner, tryGetAddressOf('FeePool')], FeePool: [tryGetAddressOf('ProxyFeePool'), owner, tryGetAddressOf('AddressResolver')], Synth: [ tryGetAddressOf('ProxyERC20Synth'), @@ -294,18 +294,6 @@ const setupContract = async ({ } const postDeployTasks = { - async Issuer() { - await Promise.all( - [].concat( - // Synthetix State is where the issuance data lives so it needs to be connected to Issuer - tryInvocationIfNotMocked({ - name: 'SynthetixState', - fncName: 'setAssociatedContract', - args: [instance.address], - }) || [] - ) - ); - }, async Synthetix() { // first give all SNX supply to the owner (using the hack that the deployerAccount was setup as the associatedContract via // the constructor args) @@ -454,13 +442,6 @@ const setupContract = async ({ args: [instance.address], }) || [] ) - .concat( - tryInvocationIfNotMocked({ - name: 'FeePoolState', - fncName: 'setFeePool', - args: [instance.address], - }) || [] - ) .concat( tryInvocationIfNotMocked({ name: 'FeePoolEternalStorage', @@ -568,6 +549,15 @@ const setupContract = async ({ returns: [toWei('0.0030'), '0'], }), ]); + } else if (mock === 'Issuer') { + await Promise.all([ + mockGenericContractFnc({ + instance, + mock, + fncName: 'debtBalanceOf', + returns: [toWei('0')], + }), + ]); } else if (mock === 'ExchangeState') { await Promise.all([ mockGenericContractFnc({ @@ -635,12 +625,7 @@ const setupAllContracts = async ({ contract: 'ExchangeRates', deps: ['AddressResolver', 'SystemSettings'], }, - { - contract: 'ExchangeRatesWithDexPricing', - resolverAlias: 'ExchangeRates', - deps: ['AddressResolver', 'SystemSettings'], - }, - { contract: 'SynthetixState' }, + { contract: 'SynthetixDebtShare' }, { contract: 'SupplySchedule' }, { contract: 'ProxyERC20', forContract: 'Synthetix' }, { contract: 'ProxyERC20', forContract: 'MintableSynthetix' }, @@ -672,7 +657,6 @@ const setupAllContracts = async ({ }, { contract: 'SynthetixEscrow' }, { contract: 'FeePoolEternalStorage' }, - { contract: 'FeePoolState', mocks: ['FeePool'] }, { contract: 'EternalStorage', forContract: 'DelegateApprovals' }, { contract: 'DelegateApprovals', deps: ['EternalStorage'] }, { contract: 'EternalStorage', forContract: 'Liquidations' }, @@ -715,7 +699,6 @@ const setupAllContracts = async ({ mocks: [ 'CollateralManager', 'Synthetix', - 'SynthetixState', 'Exchanger', 'FeePool', 'DelegateApprovals', @@ -724,7 +707,13 @@ const setupAllContracts = async ({ 'EtherWrapper', 'SynthRedeemer', ], - deps: ['AddressResolver', 'SystemStatus', 'FlexibleStorage', 'DebtCache'], + deps: [ + 'AddressResolver', + 'SystemStatus', + 'FlexibleStorage', + 'DebtCache', + 'SynthetixDebtShare', + ], }, { contract: 'Exchanger', @@ -739,6 +728,11 @@ const setupAllContracts = async ({ 'DebtCache', ], }, + { + contract: 'ExchangeRatesWithDexPricing', + resolverAlias: 'ExchangeRates', + deps: ['AddressResolver', 'SystemSettings'], + }, { contract: 'ExchangerWithFeeRecAlternatives', resolverAlias: 'Exchanger', @@ -769,15 +763,7 @@ const setupAllContracts = async ({ 'RewardsDistribution', 'Liquidations', ], - deps: [ - 'Issuer', - 'SynthetixState', - 'Proxy', - 'ProxyERC20', - 'AddressResolver', - 'TokenState', - 'SystemStatus', - ], + deps: ['Issuer', 'Proxy', 'ProxyERC20', 'AddressResolver', 'TokenState', 'SystemStatus'], }, { contract: 'BaseSynthetix', @@ -790,15 +776,7 @@ const setupAllContracts = async ({ 'RewardsDistribution', 'Liquidations', ], - deps: [ - 'Issuer', - 'SynthetixState', - 'Proxy', - 'ProxyERC20', - 'AddressResolver', - 'TokenState', - 'SystemStatus', - ], + deps: ['Issuer', 'Proxy', 'ProxyERC20', 'AddressResolver', 'TokenState', 'SystemStatus'], }, { contract: 'MintableSynthetix', @@ -818,7 +796,6 @@ const setupAllContracts = async ({ 'TokenState', 'RewardsDistribution', 'RewardEscrow', - 'SynthetixState', ], }, { @@ -848,7 +825,6 @@ const setupAllContracts = async ({ 'Synthetix', 'Exchanger', 'Issuer', - 'SynthetixState', 'RewardEscrow', 'RewardEscrowV2', 'DelegateApprovals', @@ -859,7 +835,7 @@ const setupAllContracts = async ({ 'EtherWrapper', 'WrapperFactory', ], - deps: ['SystemStatus', 'FeePoolState', 'AddressResolver'], + deps: ['SystemStatus', 'SynthetixDebtShare', 'AddressResolver'], }, { contract: 'CollateralState', diff --git a/test/integration/utils/balances.js b/test/integration/utils/balances.js index 6bfc8923a1..97d1a33a27 100644 --- a/test/integration/utils/balances.js +++ b/test/integration/utils/balances.js @@ -149,10 +149,24 @@ async function _getsUSD({ ctx, user, amount }) { Synthetix = Synthetix.connect(ctx.users.owner); + const tmpWallet = await ethers.Wallet.createRandom().connect(ctx.provider); + + await _getETHFromOtherUsers({ + ctx, + symbol: 'ETH', + user: tmpWallet, + amount: ethers.utils.parseEther('1'), + }); + + tx = await Synthetix.transfer(tmpWallet.address, requiredSNX.mul(2)); + await tx.wait(); + + Synthetix = Synthetix.connect(tmpWallet); + tx = await Synthetix.issueSynths(amount); await tx.wait(); - SynthsUSD = SynthsUSD.connect(ctx.users.owner); + SynthsUSD = SynthsUSD.connect(tmpWallet); tx = await SynthsUSD.transfer(user.address, amount); await tx.wait(); diff --git a/test/publish/index.js b/test/publish/index.js index f26ff15ed7..35fe2a3592 100644 --- a/test/publish/index.js +++ b/test/publish/index.js @@ -656,7 +656,7 @@ describe('publish scripts', () => { beforeEach(async () => { periodsAdded = []; const addPeriod = (feePeriodId, startTime) => { - periodsAdded.push([`${feePeriodId}`, '0', `${startTime}`, '3', '4', '5', '6']); + periodsAdded.push([`${startTime}`, '0', `${startTime}`, '3', '4', '5', '6']); }; for (let i = 0; i < feePeriodLength; i++) { const startTime = daysAgo((i + 1) * 6); @@ -664,8 +664,7 @@ describe('publish scripts', () => { const tx = await FeePool.importFeePeriod( i, - i + 1, - 0, + startTime, startTime, 3, 4, @@ -1103,15 +1102,14 @@ describe('publish scripts', () => { 'ExchangeState', 'FeePool', 'FeePoolEternalStorage', - 'FeePoolState', 'Issuer', 'Liquidations', 'RewardEscrow', 'RewardsDistribution', 'SupplySchedule', 'Synthetix', + 'SynthetixDebtShare', 'SynthetixEscrow', - 'SynthetixState', 'SynthsETH', 'SynthsUSD', 'SystemStatus',